Пример #1
0
bool CVideoDecoderOptions::ReadSettings(CSettings &Settings)
{
	CMediaViewer &MediaViewer = GetAppClass().CoreEngine.m_DtvEngine.m_MediaViewer;
	VideoDecoderSettings DecoderSettings;
	int Value;

	MediaViewer.GetVideoDecoderSettings(&DecoderSettings);

	Settings.Read(TEXT("EnableDeinterlace"), &DecoderSettings.bEnableDeinterlace);
	if (Settings.Read(TEXT("DeinterlaceMethod"), &Value))
		DecoderSettings.DeinterlaceMethod = static_cast<TVTVIDEODEC_DeinterlaceMethod>(Value);
	Settings.Read(TEXT("AdaptProgressive"), &DecoderSettings.bAdaptProgressive);
	Settings.Read(TEXT("AdaptTelecine"), &DecoderSettings.bAdaptTelecine);
	Settings.Read(TEXT("SetInterlacedFlag"), &DecoderSettings.bSetInterlacedFlag);
	Settings.Read(TEXT("Brightness"), &DecoderSettings.Brightness);
	Settings.Read(TEXT("Contrast"), &DecoderSettings.Contrast);
	Settings.Read(TEXT("Hue"), &DecoderSettings.Hue);
	Settings.Read(TEXT("Saturation"), &DecoderSettings.Saturation);
	Settings.Read(TEXT("NumThreads"), &DecoderSettings.NumThreads);
	Settings.Read(TEXT("EnableDXVA2"), &DecoderSettings.bEnableDXVA2);

	MediaViewer.SetVideoDecoderSettings(DecoderSettings);

	return true;
}
Пример #2
0
bool CControllerManager::ReadSettings(CSettings &Settings)
{
	TCHAR szText[256];

	if (Settings.Read(TEXT("CurController"),szText,lengthof(szText)))
		m_CurController=szText;
	return true;
}
Пример #3
0
bool CInformationPanel::ReadSettings(CSettings &Settings)
{
	for (int i=0;i<NUM_ITEMS;i++) {
		CItem *pItem=m_ItemList[i];
		bool f;

		if (Settings.Read(pItem->GetName(),&f))
			pItem->SetVisible(f);
	}
	return true;
}
Пример #4
0
bool CLogger::ReadSettings(CSettings &Settings)
{
	CBlockLock Lock(&m_Lock);

	Settings.Read(TEXT("OutputLogToFile"),&m_fOutputToFile);
	if (m_fOutputToFile && m_LogList.size()>0) {
		TCHAR szFileName[MAX_PATH];

		GetDefaultLogFileName(szFileName);
		SaveToFile(szFileName,true);
	}
	return true;
}
Пример #5
0
bool CControllerManager::LoadControllerSettings(LPCTSTR pszName)
{
	int Index=FindController(pszName);
	if (Index<0)
		return false;

	ControllerInfo &Info=m_ControllerList[Index];

	if (Info.fSettingsLoaded)
		return true;

	CSettings Settings;
	TCHAR szFileName[MAX_PATH];

	if (!Info.pController->GetIniFileName(szFileName,lengthof(szFileName)))
		return false;
	if (Settings.Open(szFileName,CSettings::OPEN_READ)
			&& Settings.SetSection(Info.pController->GetIniFileSection())) {
		const int NumButtons=Info.pController->NumButtons();
		const CCommandList &CommandList=GetAppClass().CommandList;

		for (int i=0;i<NumButtons;i++) {
			TCHAR szName[64],szCommand[CCommandList::MAX_COMMAND_TEXT];

			::wsprintf(szName,TEXT("Button%d_Command"),i);
			if (Settings.Read(szName,szCommand,lengthof(szCommand))
					&& szCommand[0]!='\0') {
				Info.Settings.AssignList[i]=CommandList.ParseText(szCommand);
			}
		}
		if (!Info.pController->IsActiveOnly())
			Settings.Read(TEXT("ActiveOnly"),&Info.Settings.fActiveOnly);
		Info.fSettingsLoaded=true;
	}
	return true;
}
Пример #6
0
bool CSideBarOptions::ReadSettings(CSettings &Settings)
{
	int Value,NumItems;

	Settings.Read(TEXT("ShowPopup"),&m_fShowPopup);
	Settings.Read(TEXT("ShowToolTips"),&m_fShowToolTips);
	Settings.Read(TEXT("ShowChannelLogo"),&m_fShowChannelLogo);
	if (Settings.Read(TEXT("PopupOpacity"),&Value))
		m_PopupOpacity=CLAMP(Value,OPACITY_MIN,OPACITY_MAX);
	if (Settings.Read(TEXT("Place"),&Value)
			&& Value>=PLACE_FIRST && Value<=PLACE_LAST)
		m_Place=(PlaceType)Value;

	if (Settings.Read(TEXT("ItemCount"),&NumItems) && NumItems>0) {
		// はまるのを防ぐために、200を上限にしておく
		if (NumItems>=200)
			NumItems=200;

		m_ItemNameList.clear();

		TVTest::String Command;

		for (int i=0;i<NumItems;i++) {
			TCHAR szName[32];

			StdUtil::snprintf(szName,lengthof(szName),TEXT("Item%d"),i);
			if (Settings.Read(szName,&Command)) {
				m_ItemNameList.push_back(Command);
				/*
				if (szCommand[0]=='\0') {
					m_ItemNameList.push_back(TVTest::String());
				} else {
					m_ItemNameList.push_back(TVTest::String(szCommand));
					int Command=m_pSideBar->GetCommandList()->ParseText(szCommand);

					if (Command!=0) {
						for (int j=0;j<lengthof(ItemList);j++) {
							if (ItemList[j].Command==Command) {
								m_ItemList.push_back(Command);
								break;
							}
						}
					}
				}
				*/
			}
		}
	}

	return true;
}
Пример #7
0
bool CChannelManager::LoadChannelSettings(LPCTSTR pszFileName,LPCTSTR pszDriverName)
{
	if (m_TuningSpaceList.IsEmpty() || m_fChannelFileHasStreamIDs)
		return true;

	CSettings Settings;
	int SpaceCount;

	TRACE(TEXT("ストリーム情報の読み込み : \"%s\" [%s]\n"),pszFileName,pszDriverName);
	if (!Settings.Open(pszFileName,CSettings::OPEN_READ)
			|| !Settings.SetSection(::PathFindFileName(pszDriverName)))
		return false;
	if (Settings.Read(TEXT("SpaceCount"),&SpaceCount) && SpaceCount>0) {
		for (int i=0;i<SpaceCount;i++) {
			int NumChannels;
			TCHAR szName[64];

			::wsprintf(szName,TEXT("Space%d_Count"),i);
			if (Settings.Read(szName,&NumChannels) && NumChannels>0) {
				for (int j=0;j<NumChannels;j++) {
					int ChannelIndex;
					int NumServices;
					unsigned int NetworkID,TSID,ServiceID;

					::wsprintf(szName,TEXT("Space%d_ChannelMap%d"),i,j);
					if (Settings.Read(szName,&ChannelIndex)) {
						::wsprintf(szName,TEXT("Space%d_Channel%d_NID"),i,ChannelIndex);
						if (!Settings.Read(szName,&NetworkID))
							NetworkID=0;
						::wsprintf(szName,TEXT("Space%d_Channel%d_TSID"),i,ChannelIndex);
						if (!Settings.Read(szName,&TSID))
							TSID=0;
						if (NetworkID!=0 || TSID!=0) {
							::wsprintf(szName,TEXT("Space%d_Channel%d_Count"),i,ChannelIndex);
							if (Settings.Read(szName,&NumServices) && NumServices>0) {
								for (int k=0;k<NumServices;k++) {
									::wsprintf(szName,TEXT("Space%d_Channel%d_Service%d_SID"),i,ChannelIndex,k);
									if (Settings.Read(szName,&ServiceID) && ServiceID!=0)
										UpdateStreamInfo(i,ChannelIndex,NetworkID,TSID,ServiceID);
								}
							}
						}
					}
				}
			}
		}
	}
	return true;
}
Пример #8
0
bool CGeneralOptions::ReadSettings(CSettings &Settings)
{
	int Value;

	TCHAR szDirectory[MAX_PATH];
	if (Settings.Read(TEXT("DriverDirectory"),szDirectory,lengthof(szDirectory))
			&& szDirectory[0]!='\0') {
		m_BonDriverDirectory=szDirectory;
		GetAppClass().CoreEngine.SetDriverDirectory(szDirectory);
	}

	if (Settings.Read(TEXT("DefaultDriverType"),&Value)
			&& Value>=DEFAULT_DRIVER_NONE && Value<=DEFAULT_DRIVER_CUSTOM)
		m_DefaultDriverType=(DefaultDriverType)Value;
	Settings.Read(TEXT("DefaultDriver"),&m_DefaultBonDriverName);
	Settings.Read(TEXT("Driver"),&m_LastBonDriverName);

	Settings.Read(TEXT("Resident"),&m_fResident);
	Settings.Read(TEXT("KeepSingleTask"),&m_fKeepSingleTask);
	Settings.Read(TEXT("StandaloneProgramGuide"),&m_fStandaloneProgramGuide);
	Settings.Read(TEXT("Enable1SegFallback"),&m_fEnable1SegFallback);

	return true;
}
Пример #9
0
bool CColorScheme::Load(LPCTSTR pszFileName,bool fLegacy)
{
	CSettings Settings;
	TCHAR szText[MAX_COLORSCHEME_NAME];
	int i;

	if (!Settings.Open(pszFileName,TEXT("ColorScheme"),CSettings::OPEN_READ))
		return false;
	if (Settings.Read(TEXT("Name"),szText,lengthof(szText)))
		SetName(szText);
	::ZeroMemory(m_LoadedFlags,sizeof(m_LoadedFlags));
	for (i=0;i<NUM_COLORS;i++) {
		if (Settings.ReadColor((fLegacy?m_ColorInfoLegacyList:m_ColorInfoList)[i].pszText,&m_ColorList[i]))
			SetLoadedFlag(i);
	}
	for (i=0;i<NUM_COLORS;i++) {
		if (IsLoaded(i)) {
			for (int j=0;j<NUM_GRADIENTS;j++) {
				if (m_GradientInfoList[j].Color1==i
						|| m_GradientInfoList[j].Color2==i) {
					if (m_GradientInfoList[j].Color1==i
							&& !IsLoaded(m_GradientInfoList[j].Color2)) {
						m_ColorList[m_GradientInfoList[j].Color2]=m_ColorList[i];
						SetLoadedFlag(m_GradientInfoList[j].Color2);
					}
					m_GradientList[j].Type=Theme::GRADIENT_NORMAL;
					break;
				}
			}
		} else {
			static const struct {
				int To,From;
			} Map[] = {
			//	{COLOR_STATUSBORDER,						COLOR_STATUSBACK1},
				{COLOR_STATUSBOTTOMITEMBACK1,				COLOR_STATUSBACK2},
				{COLOR_STATUSBOTTOMITEMBACK2,				COLOR_STATUSBOTTOMITEMBACK1},
				{COLOR_STATUSBOTTOMITEMTEXT,				COLOR_STATUSTEXT},
				{COLOR_STATUSBOTTOMITEMBORDER,				COLOR_STATUSBOTTOMITEMBACK1},
			};

			static const struct {
				int To,From1,From2;
			} MixMap[] = {
				{COLOR_STATUSBORDER,		COLOR_STATUSBACK1,			COLOR_STATUSBACK2},
			};

			bool fFound=false;

			for (int j=0;j<lengthof(Map);j++) {
				if (Map[j].To==i && IsLoaded(Map[j].From)) {
					m_ColorList[i]=m_ColorList[Map[j].From];
					SetLoadedFlag(i);
					fFound=true;
					break;
				}
			}

			if (!fFound) {
				for (int j=0;j<lengthof(MixMap);j++) {
					if (MixMap[j].To==i && IsLoaded(MixMap[j].From1) && IsLoaded(MixMap[j].From2)) {
						m_ColorList[i]=MixColor(m_ColorList[MixMap[j].From1],m_ColorList[MixMap[j].From2]);
						SetLoadedFlag(i);
						break;
					}
				}
			}
		}
	}

	for (i=0;i<NUM_GRADIENTS;i++) {
		if (Settings.Read(m_GradientInfoList[i].pszText,szText,lengthof(szText))) {
			if (szText[0]=='\0' || ::lstrcmpi(szText,TEXT("normal"))==0)
				m_GradientList[i].Type=Theme::GRADIENT_NORMAL;
			else if (::lstrcmpi(szText,TEXT("glossy"))==0)
				m_GradientList[i].Type=Theme::GRADIENT_GLOSSY;
			else if (::lstrcmpi(szText,TEXT("interlaced"))==0)
				m_GradientList[i].Type=Theme::GRADIENT_INTERLACED;
		}

		TCHAR szName[128];
		::wsprintf(szName,TEXT("%sDirection"),m_GradientInfoList[i].pszText);
		m_GradientList[i].Direction=m_GradientInfoList[i].Direction;
		if (Settings.Read(szName,szText,lengthof(szText))) {
			for (int j=0;j<lengthof(GradientDirectionList);j++) {
				if (::lstrcmpi(szText,GradientDirectionList[j])==0) {
					m_GradientList[i].Direction=(Theme::GradientDirection)j;
					break;
				}
			}
		}
	}

	Settings.Close();

	for (i=0;i<NUM_BORDERS;i++)
		m_BorderList[i]=m_BorderInfoList[i].DefaultType;
	if (Settings.Open(pszFileName,TEXT("Style"),CSettings::OPEN_READ)) {
		for (i=0;i<NUM_BORDERS;i++) {
			if (Settings.Read(m_BorderInfoList[i].pszText,szText,lengthof(szText))) {
				if (::lstrcmpi(szText,TEXT("none"))==0) {
					if (!m_BorderInfoList[i].fAlways)
						m_BorderList[i]=Theme::BORDER_NONE;
				} else if (::lstrcmpi(szText,TEXT("solid"))==0)
					m_BorderList[i]=Theme::BORDER_SOLID;
				else if (::lstrcmpi(szText,TEXT("sunken"))==0)
					m_BorderList[i]=Theme::BORDER_SUNKEN;
				else if (::lstrcmpi(szText,TEXT("raised"))==0)
					m_BorderList[i]=Theme::BORDER_RAISED;
			}
		}
		Settings.Close();
	}

	SetFileName(pszFileName);
	return true;
}
Пример #10
0
bool CEpgOptions::ReadSettings(CSettings &Settings)
{
	Settings.Read(TEXT("SaveEpgData"),&m_fSaveEpgFile);
	Settings.Read(TEXT("EpgDataFileName"),m_szEpgFileName,lengthof(m_szEpgFileName));
	Settings.Read(TEXT("EpgUpdateWhenStandby"),&m_fUpdateWhenStandby);
	Settings.Read(TEXT("EpgUpdateBSExtended"),&m_fUpdateBSExtended);
	Settings.Read(TEXT("EpgUpdateCSExtended"),&m_fUpdateCSExtended);
	Settings.Read(TEXT("UseEpgData"),&m_fUseEDCBData);
	Settings.Read(TEXT("EpgDataFolder"),m_szEDCBDataFolder,lengthof(m_szEDCBDataFolder));

	int Value;
	if (Settings.Read(TEXT("EpgTimeMode"),&Value)
			&& Value>=EPGTIME_FIRST && Value<=EPGTIME_LAST)
		m_EpgTimeMode=(EpgTimeMode)Value;

	Settings.Read(TEXT("SaveLogoData"),&m_fSaveLogoFile);
	Settings.Read(TEXT("LogoDataFileName"),m_szLogoFileName,lengthof(m_szLogoFileName));

	CLogoManager &LogoManager=GetAppClass().LogoManager;
	bool fSaveLogo;
	if (Settings.Read(TEXT("SaveRawLogo"),&fSaveLogo))
		LogoManager.SetSaveLogo(fSaveLogo);
	if (Settings.Read(TEXT("SaveBmpLogo"),&fSaveLogo))
		LogoManager.SetSaveLogoBmp(fSaveLogo);
	TCHAR szLogoDir[MAX_PATH];
	if (Settings.Read(TEXT("LogoDirectory"),szLogoDir,MAX_PATH)) {
		LogoManager.SetLogoDirectory(szLogoDir);
	} else {
		// TVLogoMark のロゴがあれば利用する
		GetAppClass().GetAppDirectory(szLogoDir);
		::PathAppend(szLogoDir,TEXT("Plugins\\Logo"));
		if (::PathIsDirectory(szLogoDir))
			LogoManager.SetLogoDirectory(TEXT(".\\Plugins\\Logo"));
	}

	bool f;
	if (TVTest::StyleUtil::ReadFontSettings(Settings,TEXT("EventInfoFont"),&m_EventInfoFont,false,&f)) {
		if (!f)
			m_fChanged=true;
	}

	return true;
}
Пример #11
0
bool COperationOptions::ReadSettings(CSettings &Settings)
{
	int Value;

	Settings.Read(TEXT("DisplayDragMove"),&m_fDisplayDragMove);
	Settings.Read(TEXT("HideCursor"),&m_fHideCursor);
	Settings.Read(TEXT("VolumeStep"),&m_VolumeStep);
	Settings.Read(TEXT("AudioDelayStep"),&m_AudioDelayStep);

	// ver.0.9.0 より前との互換用
	static const int WheelModeList[] = {
		0,
		CM_WHEEL_VOLUME,
		CM_WHEEL_CHANNEL,
		CM_WHEEL_AUDIO,
		CM_WHEEL_ZOOM,
		CM_WHEEL_ASPECTRATIO,
	};
	TVTest::String Command;
	if (Settings.Read(TEXT("WheelCommand"),&Command)) {
		m_WheelCommand=m_WheelCommandManager.ParseCommand(Command.c_str());
	} else if (Settings.Read(TEXT("WheelMode"),&Value)
			&& Value>=0 && Value<lengthof(WheelModeList)) {
		m_WheelCommand=WheelModeList[Value];
	}
	if (Settings.Read(TEXT("WheelShiftCommand"),&Command)) {
		m_WheelShiftCommand=m_WheelCommandManager.ParseCommand(Command.c_str());
	} else if (Settings.Read(TEXT("WheelShiftMode"),&Value)
			&& Value>=0 && Value<lengthof(WheelModeList)) {
		m_WheelShiftCommand=WheelModeList[Value];
	}
	if (Settings.Read(TEXT("WheelCtrlCommand"),&Command)) {
		m_WheelCtrlCommand=m_WheelCommandManager.ParseCommand(Command.c_str());
	} else if (Settings.Read(TEXT("WheelCtrlMode"),&Value)
			&& Value>=0 && Value<lengthof(WheelModeList)) {
		m_WheelCtrlCommand=WheelModeList[Value];
	}
	if (Settings.Read(TEXT("WheelTiltCommand"),&Command)) {
		m_WheelTiltCommand=m_WheelCommandManager.ParseCommand(Command.c_str());
	} else if (Settings.Read(TEXT("WheelTiltMode"),&Value)
			&& Value>=0 && Value<lengthof(WheelModeList)) {
		m_WheelTiltCommand=WheelModeList[Value];
	}

	Settings.Read(TEXT("StatusBarWheel"),&m_fStatusBarWheel);
	Settings.Read(TEXT("ReverseWheelChannel"),&m_fWheelChannelReverse);
	Settings.Read(TEXT("ReverseWheelVolume"),&m_fWheelVolumeReverse);
	if (Settings.Read(TEXT("WheelChannelDelay"),&Value)) {
		if (Value<WHEEL_CHANNEL_DELAY_MIN)
			Value=WHEEL_CHANNEL_DELAY_MIN;
		m_WheelChannelDelay=Value;
	}
	Settings.Read(TEXT("WheelZoomStep"),&m_WheelZoomStep);

	if (m_pCommandList!=NULL) {
		TCHAR szText[CCommandList::MAX_COMMAND_TEXT];

		if (Settings.Read(TEXT("LeftDoubleClickCommand"),szText,lengthof(szText))) {
			m_LeftDoubleClickCommand=m_pCommandList->ParseText(szText);
		}
		if (Settings.Read(TEXT("RightClickCommand"),szText,lengthof(szText))) {
			m_RightClickCommand=m_pCommandList->ParseText(szText);
		}
		if (Settings.Read(TEXT("MiddleClickCommand"),szText,lengthof(szText))) {
			m_MiddleClickCommand=m_pCommandList->ParseText(szText);
		}
	}

	return true;
}
Пример #12
0
int main(int argc, char* argv[])
{
	string usbId;
	printf(VERSIONINFO "\n");

	if (argc != 2) { help(); return 1; }
	strncpy(filename, argv[1], sizeof(filename));

	// --- load settings ----------------------------------
	if (!settings.Read("psi46test.ini"))
	{
		printf("error reading \"psi46test.ini\"\n");
		return 2;
	}

	// --- open log file ----------------------------------
/*	FILE *f = fopen(filename,"rb");
	if (f)
	{
		printf("Log file \"%s\" exist!\n", filename);
		fclose(f);
		return 1;
	} */
	if (!Log.open(filename))
	{
		printf("log: error creating file\n");
		return 3;
	}

	// --- open test board --------------------------------
	Log.section("DTB");

	try
	{
		if (!tb.FindDTB(usbId)) {}
		else if (tb.Open(usbId))
		{
			printf("\nDTB %s opened\n", usbId.c_str());
			string info;
			try
			{
				tb.GetInfo(info);
				printf("--- DTB info-------------------------------------\n"
					   "%s"
					   "-------------------------------------------------\n", info.c_str());
				Log.puts(info.c_str());
				tb.Welcome();
				tb.Flush();
			}
			catch(CRpcError &e)
			{
				e.What();
				printf("ERROR: DTB software version could not be identified, please update it!\n");
				tb.Close();
				printf("Connection to Board %s has been cancelled\n", usbId.c_str());
			}
		}
		else
		{
			printf("USB error: %s\n", tb.ConnectionError());
			printf("Connect testboard and try command 'scan' to find connected devices.\n");
			printf("Make sure you have permission to access USB devices.\n");
		}

		// --- open prober ------------------------------------
		if (settings.proberPort>=0)
			if (!prober.open(settings.proberPort))
			{
				printf("Prober: could not open port %i\n",
					settings.proberPort);
				Log.puts("Prober: could not open port\n");
				return 4;
			}

		Log.flush();

		// --- call command interpreter -----------------------
		nEntry = 0;

		cmd();
		tb.Close();
	}
	catch (CRpcError &e)
	{
		e.What();
	}

	return 0;
}
Пример #13
0
bool CPanelOptions::ReadSettings(CSettings &Settings)
{
	int Value;

	Settings.Read(TEXT("InfoCurTab"),&m_LastTab);
	Settings.Read(TEXT("PanelFirstTab"),&m_InitialTab);
	Settings.Read(TEXT("PanelSnapAtMainWindow"),&m_fSnapAtMainWindow);
	Settings.Read(TEXT("PanelAttachToMainWindow"),&m_fAttachToMainWindow);
	if (Settings.Read(TEXT("PanelOpacity"),&m_Opacity))
		GetAppClass().Panel.Frame.SetPanelOpacity(m_Opacity*255/100);

	// Font
	TCHAR szFont[LF_FACESIZE];
	if (Settings.Read(TEXT("PanelFontName"),szFont,LF_FACESIZE) && szFont[0]!='\0') {
		::lstrcpy(m_Font.lfFaceName,szFont);
		m_Font.lfEscapement=0;
		m_Font.lfOrientation=0;
		m_Font.lfUnderline=0;
		m_Font.lfStrikeOut=0;
		m_Font.lfCharSet=DEFAULT_CHARSET;
		m_Font.lfOutPrecision=OUT_DEFAULT_PRECIS;
		m_Font.lfClipPrecision=CLIP_DEFAULT_PRECIS;
		m_Font.lfQuality=DRAFT_QUALITY;
		m_Font.lfPitchAndFamily=DEFAULT_PITCH | FF_DONTCARE;
	}
	if (Settings.Read(TEXT("PanelFontSize"),&Value)) {
		m_Font.lfHeight=Value;
		m_Font.lfWidth=0;
	}
	if (Settings.Read(TEXT("PanelFontWeight"),&Value))
		m_Font.lfWeight=Value;
	if (Settings.Read(TEXT("PanelFontItalic"),&Value))
		m_Font.lfItalic=Value;
	Settings.Read(TEXT("CaptionPanelFontSpec"),&m_fSpecCaptionFont);
	if (!Settings.Read(TEXT("CaptionPanelFont"),&m_CaptionFont))
		m_CaptionFont=m_Font;

	if (Settings.Read(TEXT("PanelTabStyle"),&Value)
			&& Value>=CPanelForm::TABSTYLE_FIRST && Value<=CPanelForm::TABSTYLE_LAST)
		m_TabStyle=static_cast<CPanelForm::TabStyle>(Value);

	Settings.Read(TEXT("PanelTabTooltip"),&m_fTabTooltip);

	int TabCount;
	if (Settings.Read(TEXT("PanelTabCount"),&TabCount) && TabCount>0) {
		PanelItemInfoList ItemList;
		TVTest::String ID;

		for (int i=0;i<TabCount;i++) {
			TCHAR szName[32];

			StdUtil::snprintf(szName,lengthof(szName),TEXT("PanelTab%d_ID"),i);
			if (!Settings.Read(szName,&ID) || ID.empty())
				continue;

			PanelItemInfo Item;
			LPTSTR p;
			long IDNum=std::_tcstol(ID.c_str(),&p,10);
			if (*p==_T('\0')) {
				if (IDNum<PANEL_ID_FIRST || IDNum>PANEL_ID_LAST)
					continue;
				Item.ID=m_AvailItemList[IDNum].ID;
			} else {
				Item.ID=ID;
			}
			size_t j;
			for (j=0;j<ItemList.size();j++) {
				if (CompareID(ItemList[j].ID,Item.ID))
					break;
			}
			if (j<ItemList.size())
				continue;

			StdUtil::snprintf(szName,lengthof(szName),TEXT("PanelTab%d_Visible"),i);
			if (!Settings.Read(szName,&Item.fVisible))
				Item.fVisible=true;

			ItemList.push_back(Item);
		}

#if 0
		for (size_t i=0;i<m_AvailItemList.size();i++) {
			const TVTest::String &ID=m_AvailItemList[i].ID;
			if (std::find_if(ItemList.begin(),ItemList.end(),
					[&](const PanelItemInfo &Item) -> bool {
						return CompareID(Item.ID,ID); })==ItemList.end()) {
				PanelItemInfo Item;
				Item.ID=ID;
				Item.fVisible=false;
				ItemList.push_back(Item);
			}
		}
#endif

		m_ItemList=ItemList;
	}

	Settings.Read(TEXT("InfoPanelUseRichEdit"),&m_fProgramInfoUseRichEdit);

	return true;
}
Пример #14
0
bool CMenuOptions::ReadSettings(CSettings &Settings)
{
	int Value;

	if (Settings.Read(TEXT("MaxChannelMenuRows"),&Value) && Value>0)
		m_MaxChannelMenuRows=Value;
	Settings.Read(TEXT("MaxChannelMenuEventInfo"),&m_MaxChannelMenuEventInfo);

	int ItemCount;
	if (Settings.Read(TEXT("ItemCount"),&ItemCount) && ItemCount>0) {
		const CCommandList *pCommandList=GetAppClass().GetCommandList();
		std::vector<MenuItemInfo> ItemList;

		for (int i=0;i<ItemCount;i++) {
			TCHAR szName[32],szText[CCommandList::MAX_COMMAND_TEXT];

			::wsprintf(szName,TEXT("Item%d_ID"),i);
			if (Settings.Read(szName,szText,lengthof(szText))) {
				MenuItemInfo Item;

				Item.fVisible=true;
				::wsprintf(szName,TEXT("Item%d_State"),i);
				if (Settings.Read(szName,&Value))
					Item.fVisible=(Value&ITEM_STATE_VISIBLE)!=0;

				if (szText[0]==_T('\0')) {
					Item.ID=MENU_ID_SEPARATOR;
					ItemList.push_back(Item);
				} else {
					int Command=pCommandList->ParseText(szText);
					if (Command>0) {
						int ID=CommandToID(Command);
						if (ID>=0) {
							Item.ID=ID;
							ItemList.push_back(Item);
						}
					}
#ifdef _DEBUG
					else {
						TRACE(TEXT("CMenuOptions::ReadSettings() : Unknown command \"%s\"\n"),szText);
					}
#endif
				}
			}
		}

		for (int i=0;i<lengthof(m_DefaultMenuItemList);i++) {
			bool fFound=false;
			for (size_t j=0;j<ItemList.size();j++) {
				if (ItemList[j].ID==m_DefaultMenuItemList[i].ID) {
					fFound=true;
					break;
				}
			}
			if (!fFound) {
				MenuItemInfo Item;
				Item.ID=m_DefaultMenuItemList[i].ID;
				Item.fVisible=false;
				ItemList.push_back(Item);
			}
		}

		m_MenuItemList=ItemList;
	}

	return true;
}
Пример #15
0
bool CViewOptions::ReadSettings(CSettings &Settings)
{
	int Value;

	Settings.Read(TEXT("AdjustAspectResizing"),&m_fAdjustAspectResizing);
	Settings.Read(TEXT("SnapToWindowEdge"),&m_fSnapAtWindowEdge);
	Settings.Read(TEXT("NearCornerResizeOrigin"),&m_fNearCornerResizeOrigin);
	Settings.Read(TEXT("ZoomKeepAspectRatio"),&m_fZoomKeepAspectRatio);
	if (Settings.Read(TEXT("PanScanAdjustWindow"),&Value)
			&& Value>=ADJUSTWINDOW_FIRST && Value<=ADJUSTWINDOW_LAST) {
		m_PanScanAdjustWindowMode=(AdjustWindowMode)Value;
	} else {
		// 以前のバージョンとの互換用
		bool f;
		if (Settings.Read(TEXT("PanScanNoResizeWindow"),&f))
			m_PanScanAdjustWindowMode=f?ADJUSTWINDOW_WIDTH:ADJUSTWINDOW_FIT;
	}
	Settings.Read(TEXT("Remember1SegWindowSize"),&m_fRemember1SegWindowSize);
	Settings.Read(TEXT("MinimizeToTray"),&m_fMinimizeToTray);
	Settings.Read(TEXT("DisablePreviewWhenMinimized"),&m_fDisablePreviewWhenMinimized);
	Settings.Read(TEXT("UseLogoIcon"),&m_fUseLogoIcon);
	Settings.Read(TEXT("TitleEventTime"),&m_fShowTitleEventTime);
	Settings.Read(TEXT("ShowLogo"),&m_fShowLogo);
	Settings.Read(TEXT("LogoFileName"),m_szLogoFileName,lengthof(m_szLogoFileName));
	Settings.Read(TEXT("NoScreenSaver"),&m_fNoScreenSaver);
	Settings.Read(TEXT("NoMonitorLowPower"),&m_fNoMonitorLowPower);
	Settings.Read(TEXT("NoMonitorLowPowerActiveOnly"),&m_fNoMonitorLowPowerActiveOnly);

	return true;
}