当前位置: 首页>>代码示例>>C++>>正文


C++ CConfigParser::ReadInt方法代码示例

本文整理汇总了C++中CConfigParser::ReadInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigParser::ReadInt方法的具体用法?C++ CConfigParser::ReadInt怎么用?C++ CConfigParser::ReadInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CConfigParser的用法示例。


在下文中一共展示了CConfigParser::ReadInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeter::ReadOptions(parser, section);

	m_Path = parser.ReadString(section, L"Path", L"");
	if (!m_Path.empty())
	{
		if (!CSystem::IsPathSeparator(m_Path[m_Path.length() - 1]))
		{
			m_Path += L'\\';
		}
	}

	m_ImageName = parser.ReadString(section, L"ImageName", L"");

	m_PreserveAspectRatio = 0!=parser.ReadInt(section, L"PreserveAspectRatio", 0);
	m_Tile = 0!=parser.ReadInt(section, L"Tile", 0);

	static const RECT defMargins = {0};
	m_ScaleMargins = parser.ReadRECT(section, L"ScaleMargins", defMargins);

	// Read tinting options
	m_Image.ReadOptions(parser, section);

	if (m_Initialized && m_Measures.empty() && !m_DynamicVariables)
	{
		Initialize();
		m_NeedsRedraw = true;
	}
}
开发者ID:VladimirKhomenko,项目名称:rainmeter,代码行数:34,代码来源:MeterImage.cpp

示例2: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeasureCalc::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeasure::ReadOptions(parser, section);

	// Store the current values so we know if the value needs to be updated
	int oldLowBound = m_LowBound;
	int oldHighBound = m_HighBound;
	bool oldUpdateRandom = m_UpdateRandom;

	std::wstring oldFormula = m_Formula;
	m_Formula = parser.ReadString(section, L"Formula", L"");

	m_LowBound = parser.ReadInt(section, L"LowBound", 0);
	m_HighBound = parser.ReadInt(section, L"HighBound", 100);
	m_UpdateRandom = 0!=parser.ReadInt(section, L"UpdateRandom", 0);

	if (!m_Initialized ||
		wcscmp(m_Formula.c_str(), oldFormula.c_str()) != 0 ||
		oldLowBound != m_LowBound ||
		oldHighBound != m_HighBound ||
		oldUpdateRandom != m_UpdateRandom)
	{
		if (!m_UpdateRandom)
		{
			FormulaReplace();
		}

		const WCHAR* errMsg = MathParser::Check(m_Formula.c_str());
		if (errMsg != NULL)
		{
			LogWithArgs(LOG_ERROR, L"Calc: %s in [%s]", errMsg, m_Name.c_str());
			m_Formula.clear();
		}
	}
}
开发者ID:AlfiyaZi,项目名称:rainmeter,代码行数:39,代码来源:MeasureCalc.cpp

示例3: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
    // Store the current values so we know if the image needs to be updated
    std::wstring oldImageName = m_ImageName;
    int oldW = m_W;
    int oldH = m_H;

    CMeter::ReadOptions(parser, section);

    m_Color = parser.ReadColor(section, L"BarColor", Color::Green);

    m_ImageName = parser.ReadString(section, L"BarImage", L"");
    if (!m_ImageName.empty())
    {
        m_MeterWindow->MakePathAbsolute(m_ImageName);

        // Read tinting options
        m_Image.ReadOptions(parser, section);
    }
    else
    {
        m_Image.ClearOptionFlags();
    }

    m_Border = parser.ReadInt(section, L"BarBorder", 0);

    m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);

    const WCHAR* orientation = parser.ReadString(section, L"BarOrientation", L"VERTICAL").c_str();
    if (_wcsicmp(L"VERTICAL", orientation) == 0)
    {
        m_Orientation = VERTICAL;
    }
    else if (_wcsicmp(L"HORIZONTAL", orientation) == 0)
    {
        m_Orientation = HORIZONTAL;
    }
    else
    {
        LogWithArgs(LOG_ERROR, L"BarOrientation=%s is not valid in [%s]", orientation, m_Name.c_str());
    }

    if (m_Initialized)
    {
        m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);

        if (m_NeedsReload ||
                m_Image.IsOptionsChanged())
        {
            Initialize();  // Reload the image
        }
        else if (!m_ImageName.empty())
        {
            // Reset to old dimensions
            m_W = oldW;
            m_H = oldH;
        }
    }
}
开发者ID:jieah,项目名称:rainmeter,代码行数:63,代码来源:MeterBar.cpp

示例4: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeasure::ReadOptions(parser, section);

	double value;
	const WCHAR* netName = NULL;

	if (m_Net == NET_IN)
	{
		netName = L"NetInSpeed";
		value = Rainmeter->GetGlobalOptions().netInSpeed;
	}
	else if (m_Net == NET_OUT)
	{
		netName = L"NetOutSpeed";
		value = Rainmeter->GetGlobalOptions().netOutSpeed;
	}
	else // if (m_Net == NET_TOTAL)
	{
		netName = L"NetTotalSpeed";
		value = Rainmeter->GetGlobalOptions().netInSpeed + Rainmeter->GetGlobalOptions().netOutSpeed;
	}

	double maxValue = parser.ReadFloat(section, L"MaxValue", -1);
	if (maxValue == -1)
	{
		maxValue = parser.ReadFloat(section, netName, -1);
		if (maxValue == -1)
		{
			maxValue = value;
		}
	}

	m_Interface = parser.ReadInt(section, L"Interface", 0);

	m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
	if (m_Cumulative)
	{
		Rainmeter->SetNetworkStatisticsTimer();
	}

	if (maxValue == 0.0)
	{
		if (!m_LogMaxValue)
		{
			m_MaxValue = 1.0;
			m_LogMaxValue = true;
			m_MedianValues.clear();
		}
	}
	else
	{
		m_MaxValue = maxValue / 8;
		m_LogMaxValue = false;
	}
}
开发者ID:AlfiyaZi,项目名称:rainmeter,代码行数:60,代码来源:MeasureNet.cpp

示例5: ReadOptions

/*
** Read the options specified in the ini file. Base implementation for In/Out/Total.
**
*/
void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section, NET net)
{
	double value;
	const WCHAR* netName = NULL;

	if (net == NET_IN)
	{
		netName = L"NetInSpeed";
		value = Rainmeter->GetGlobalOptions().netInSpeed;
	}
	else if (net == NET_OUT)
	{
		netName = L"NetOutSpeed";
		value = Rainmeter->GetGlobalOptions().netOutSpeed;
	}
	else
	{
		netName = L"NetTotalSpeed";
		value = Rainmeter->GetGlobalOptions().netInSpeed + Rainmeter->GetGlobalOptions().netOutSpeed;
	}

	double maxValue = parser.ReadFloat(section, L"MaxValue", -1);
	if (maxValue == -1)
	{
		maxValue = parser.ReadFloat(section, netName, -1);
		if (maxValue == -1)
		{
			maxValue = value;
		}
	}

	m_Interface = parser.ReadInt(section, L"Interface", 0);

	m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
	if (m_Cumulative)
	{
		Rainmeter->SetNetworkStatisticsTimer();
	}

	m_TrafficValue = parser.ReadFloat(section, L"TrafficValue", 0.0);
	m_TrafficAction = parser.ReadString(section, L"TrafficAction", L"", false);

	if (maxValue == 0)
	{
		m_MaxValue = 1;
		m_LogMaxValue = true;
	}
	else
	{
		m_MaxValue = maxValue / 8;
	}
}
开发者ID:JamesAC,项目名称:rainmeter,代码行数:56,代码来源:MeasureNet.cpp

示例6: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeter::ReadOptions(parser, section);

	m_Path = parser.ReadString(section, L"Path", L"");
	if (!m_Path.empty())
	{
		if (!CSystem::IsPathSeparator(m_Path[m_Path.length() - 1]))
		{
			m_Path += L'\\';
		}
	}

	m_ImageName = parser.ReadString(section, L"ImageName", L"");

	int mode = parser.ReadInt(section, L"Tile", 0);
	if (mode != 0)
	{
		m_DrawMode = DRAWMODE_TILE;
	}
	else
	{
		mode = parser.ReadInt(section, L"PreserveAspectRatio", 0);
		switch (mode)
		{
		case 0:
			m_DrawMode = DRAWMODE_NONE;
			break;
		case 1:
		default:
			m_DrawMode = DRAWMODE_KEEPRATIO;
			break;
		case 2:
			m_DrawMode = DRAWMODE_KEEPRATIOANDCROP;
			break;
		}
	}

	static const RECT defMargins = {0};
	m_ScaleMargins = parser.ReadRECT(section, L"ScaleMargins", defMargins);

	// Read tinting options
	m_Image.ReadOptions(parser, section);

	if (m_Initialized && m_Measures.empty() && !m_DynamicVariables)
	{
		Initialize();
		m_NeedsRedraw = true;
	}
}
开发者ID:AlfiyaZi,项目名称:rainmeter,代码行数:54,代码来源:MeterImage.cpp

示例7: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeasure::ReadOptions(parser, section);

	m_Format = parser.ReadString(section, L"Format", L"");

	const WCHAR* timezone = parser.ReadString(section, L"TimeZone", L"local").c_str();
	if (_wcsicmp(L"local", timezone) == 0)
	{
		SYSTEMTIME sysLocalTime, sysUTCTime;
		GetLocalTime(&sysLocalTime);
		GetSystemTime(&sysUTCTime);

		FILETIME ftLocalTime, ftUTCTime;
		SystemTimeToFileTime(&sysLocalTime, &ftLocalTime);
		SystemTimeToFileTime(&sysUTCTime, &ftUTCTime);

		LARGE_INTEGER largeInt1, largeInt2;
		largeInt1.HighPart = ftLocalTime.dwHighDateTime;
		largeInt1.LowPart = ftLocalTime.dwLowDateTime;
		largeInt2.HighPart = ftUTCTime.dwHighDateTime;
		largeInt2.LowPart = ftUTCTime.dwLowDateTime;

		m_DeltaTime.QuadPart = largeInt1.QuadPart - largeInt2.QuadPart;
	}
	else
	{
		double zone = wcstod(timezone, NULL);
		bool dst = 1 == parser.ReadInt(section, L"DaylightSavingTime", 1);

		struct tm* today;
		time_t now;
		time(&now);
		today = localtime(&now);

		if (dst && today->tm_isdst)
		{
			// Add DST
			TIME_ZONE_INFORMATION tzi;
			GetTimeZoneInformation(&tzi);

			m_DeltaTime.QuadPart = (LONGLONG)((zone * 3600) - tzi.DaylightBias * 60) * 10000000;
		}
		else
		{
			m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000;
		}
	}

	if (!m_Initialized)
	{
		// Initialize m_Time to avoid causing EINVAL in TimeToString() until calling UpdateValue()
		FillCurrentTime();
	}
}
开发者ID:JamesAC,项目名称:rainmeter,代码行数:59,代码来源:MeasureTime.cpp

示例8: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeasureVirtualMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeasure::ReadOptions(parser, section);

	m_Total = (1 == parser.ReadInt(section, L"Total", 0));

	MEMORYSTATUSEX stat;
	stat.dwLength = sizeof(MEMORYSTATUSEX);
	GlobalMemoryStatusEx(&stat);
	m_MaxValue = (double)(__int64)stat.ullTotalPageFile;
}
开发者ID:PChou,项目名称:rainmeter,代码行数:15,代码来源:MeasureVirtualMemory.cpp

示例9: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	// Store the current values so we know if the image needs to be updated
	std::wstring oldImageName = m_ImageName;

	CMeter::ReadOptions(parser, section);

	m_ImageName = parser.ReadString(section, L"ImageName", L"");
	if (!m_ImageName.empty())
	{
		m_MeterWindow->MakePathAbsolute(m_ImageName);

		// Read tinting options
		m_Image.ReadOptions(parser, section);
	}
	else
	{
		m_Image.ClearOptionFlags();
	}

	m_OffsetX = parser.ReadFloat(section, L"OffsetX", 0.0);
	m_OffsetY = parser.ReadFloat(section, L"OffsetY", 0.0);
	m_StartAngle = parser.ReadFloat(section, L"StartAngle", 0.0);
	m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", 6.2832);

	m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", 0);		// Typo
	m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", m_ValueRemainder);

	if (m_Initialized)
	{
		m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);

		if (m_NeedsReload ||
			m_Image.IsOptionsChanged())
		{
			Initialize();  // Reload the image
		}
	}
}
开发者ID:RichVRed,项目名称:rainmeter,代码行数:43,代码来源:MeterRotator.cpp

示例10: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeasureUptime::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeasure::ReadOptions(parser, section);

	m_Format = parser.ReadString(section, L"Format", L"%4!i!d %3!i!:%2!02i!");

	if (m_Format.find(L"%4") == std::wstring::npos)
	{
		m_AddDaysToHours = 0!=parser.ReadInt(section, L"AddDaysToHours", 1);
	}
	else
	{
		m_AddDaysToHours = false;
	}
}
开发者ID:AlfiyaZi,项目名称:rainmeter,代码行数:19,代码来源:MeasureUptime.cpp

示例11: ReadConfig

/*
** Reads the measure specific configs.
**
*/
void CMeasureCPU::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
    CMeasure::ReadConfig(parser, section);

    int processor = parser.ReadInt(section, L"Processor", 0);

    if (processor < 0 || processor > c_NumOfProcessors)
    {
        LogWithArgs(LOG_WARNING, L"CPU: Processor=%i invalid in [%s]", m_Processor, section);
        processor = 0;
    }

    if (processor != m_Processor)
    {
        m_Processor = processor;
        m_OldTime[0] = m_OldTime[1] = 0.0;
    }
}
开发者ID:fluffyfreak,项目名称:rainmeter,代码行数:22,代码来源:MeasureCPU.cpp

示例12: ReadStats

/*
** Reads statistics.
**
*/
void CMeasureNet::ReadStats(const WCHAR* iniFile, std::wstring& statsDate)
{
	WCHAR buffer[64];

	CConfigParser parser;
	parser.Initialize(iniFile, NULL, NULL, L"Statistics");

	const std::wstring& date = parser.ReadString(L"Statistics", L"Since", L"", false);
	if (!date.empty())
	{
		statsDate = date;
	}

	int count = parser.ReadInt(L"Statistics", L"NetStatsCount", 0);

	c_StatValues.clear();
	c_StatValues.reserve(count * 2);

	for (int i = 1; i <= count; ++i)
	{
		ULARGE_INTEGER value;

		_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", i);
		value.HighPart = parser.ReadUInt(L"Statistics", buffer, 0);

		_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", i);
		value.LowPart = parser.ReadUInt(L"Statistics", buffer, 0);

		c_StatValues.push_back(value.QuadPart);

		_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", i);
		value.HighPart = parser.ReadUInt(L"Statistics", buffer, 0);

		_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", i);
		value.LowPart = parser.ReadUInt(L"Statistics", buffer, 0);

		c_StatValues.push_back(value.QuadPart);
	}
}
开发者ID:testaccountx,项目名称:testrepo,代码行数:43,代码来源:MeasureNet.cpp

示例13: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeterRoundLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	CMeter::ReadOptions(parser, section);

	m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
	m_LineLength = parser.ReadFloat(section, L"LineLength", 20.0);
	m_LineStart = parser.ReadFloat(section, L"LineStart", -1.0);
	m_StartAngle = parser.ReadFloat(section, L"StartAngle", 0.0);
	m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", 6.2832);
	m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", 0);		// Typo
	m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", m_ValueRemainder);
	m_LineColor = parser.ReadColor(section, L"LineColor", Color::Black);
	m_Solid = 0!=parser.ReadInt(section, L"Solid", 0);
	m_CntrlAngle = 0!=parser.ReadInt(section, L"ControlAngle", 1);
	m_CntrlLineStart = 0!=parser.ReadInt(section, L"ControlStart", 0);
	m_CntrlLineLength = 0!=parser.ReadInt(section, L"ControlLength", 0);
	m_LineStartShift = parser.ReadFloat(section, L"StartShift", 0.0);
	m_LineLengthShift = parser.ReadFloat(section, L"LengthShift", 0.0);
}
开发者ID:JamesAC,项目名称:rainmeter,代码行数:23,代码来源:MeterRoundLine.cpp

示例14: ReadOptions

/*
** Read the options specified in the ini file.
**
*/
void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
	WCHAR tmpName[64];

	// Store the current number of lines so we know if the buffer needs to be updated
	int oldLineCount = (int)m_Colors.size();
	int oldW = m_W;

	CMeter::ReadOptions(parser, section);

	int lineCount = parser.ReadInt(section, L"LineCount", 1);

	m_Colors.clear();
	m_ScaleValues.clear();

	for (int i = 0; i < lineCount; ++i)
	{
		if (i == 0)
		{
			wcsncpy_s(tmpName, L"LineColor", _TRUNCATE);
		}
		else
		{
			_snwprintf_s(tmpName, _TRUNCATE, L"LineColor%i", i + 1);
		}

		m_Colors.push_back(parser.ReadColor(section, tmpName, Color::White));

		if (i == 0)
		{
			wcsncpy_s(tmpName, L"Scale", _TRUNCATE);
		}
		else
		{
			_snwprintf_s(tmpName, _TRUNCATE, L"Scale%i", i + 1);
		}

		m_ScaleValues.push_back(parser.ReadFloat(section, tmpName, 1.0));

		if (!m_Initialized && !m_MeasureName.empty())
		{
			if (i != 0)
			{
				_snwprintf_s(tmpName, _TRUNCATE, L"MeasureName%i", i + 1);
				m_MeasureNames.push_back(parser.ReadString(section, tmpName, L""));
			}
		}
	}

	m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);
	m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0);
	m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
	m_HorizontalLines = 0!=parser.ReadInt(section, L"HorizontalLines", 0);
	ARGB color = parser.ReadColor(section, L"HorizontalColor", Color::Black);		// This is left here for backwards compatibility
	m_HorizontalColor = parser.ReadColor(section, L"HorizontalLineColor", color);	// This is what it should be

	if (m_Initialized &&
		(oldLineCount != lineCount || oldW != m_W))
	{
		Initialize();
	}

	const WCHAR* graph = parser.ReadString(section, L"GraphStart", L"RIGHT").c_str();
	if (_wcsicmp(graph, L"RIGHT") == 0)
	{
		m_GraphStartLeft = false;
	}
	else if (_wcsicmp(graph, L"LEFT") ==  0)
	{
		m_GraphStartLeft = true;
	}
	else
	{
		LogWithArgs(LOG_ERROR, L"StartFrom=%s is not valid in [%s]", graph, m_Name.c_str());
	}

	graph = parser.ReadString(section, L"GraphOrientation", L"VERTICAL").c_str();
	if (_wcsicmp(graph, L"VERTICAL") == 0)
	{
		// Restart graph
		if (m_GraphHorizontalOrientation)
		{
			m_GraphHorizontalOrientation = false;
			m_AllValues.clear();
			Initialize();
			m_CurrentPos = 0;
		}
		else
		{
			m_GraphHorizontalOrientation = false;
		}
	}
	else if (_wcsicmp(graph, L"HORIZONTAL") ==  0)
	{
		// Restart graph
		if (!m_GraphHorizontalOrientation)
//.........这里部分代码省略.........
开发者ID:RichVRed,项目名称:rainmeter,代码行数:101,代码来源:MeterLine.cpp

示例15: ReadOptions

void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section, CMeterWindow* meterWindow)
{
	DestroyCustomCursor();

	m_LeftDownAction = parser.ReadString(section, L"LeftMouseDownAction", L"", false);
	m_RightDownAction = parser.ReadString(section, L"RightMouseDownAction", L"", false);
	m_MiddleDownAction = parser.ReadString(section, L"MiddleMouseDownAction", L"", false);
	m_X1DownAction = parser.ReadString(section, L"X1MouseDownAction", L"", false);
	m_X2DownAction = parser.ReadString(section, L"X2MouseDownAction", L"", false);
	m_LeftUpAction = parser.ReadString(section, L"LeftMouseUpAction", L"", false);
	m_RightUpAction = parser.ReadString(section, L"RightMouseUpAction", L"", false);
	m_MiddleUpAction = parser.ReadString(section, L"MiddleMouseUpAction", L"", false);
	m_X1UpAction = parser.ReadString(section, L"X1MouseUpAction", L"", false);
	m_X2UpAction = parser.ReadString(section, L"X2MouseUpAction", L"", false);
	m_LeftDoubleClickAction = parser.ReadString(section, L"LeftMouseDoubleClickAction", L"", false);
	m_RightDoubleClickAction = parser.ReadString(section, L"RightMouseDoubleClickAction", L"", false);
	m_MiddleDoubleClickAction = parser.ReadString(section, L"MiddleMouseDoubleClickAction", L"", false);
	m_X1DoubleClickAction = parser.ReadString(section, L"X1MouseDoubleClickAction", L"", false);	
	m_X2DoubleClickAction = parser.ReadString(section, L"X2MouseDoubleClickAction", L"", false);

	m_OverAction = parser.ReadString(section, L"MouseOverAction", L"", false);
	m_LeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false);

	m_MouseScrollDownAction = parser.ReadString(section, L"MouseScrollDownAction", L"", false);
	m_MouseScrollUpAction = parser.ReadString(section, L"MouseScrollUpAction", L"", false);
	m_MouseScrollLeftAction = parser.ReadString(section, L"MouseScrollLeftAction", L"", false);
	m_MouseScrollRightAction = parser.ReadString(section, L"MouseScrollRightAction", L"", false);
	if (!m_MouseScrollDownAction.empty() || !m_MouseScrollUpAction.empty() ||
		!m_MouseScrollLeftAction.empty() || !m_MouseScrollRightAction.empty())
	{
		meterWindow->SetHasMouseScrollAction();
	}

	const bool defaultState = (section == L"Rainmeter") ? true : meterWindow->GetMouse().GetCursorState();
	m_CursorState = 0!=parser.ReadInt(section, L"MouseActionCursor", defaultState);

	const WCHAR* defaultMouseCursor = (section == L"Rainmeter") ? L"HAND" : L"";
	const WCHAR* mouseCursor = parser.ReadString(section, L"MouseActionCursorName", defaultMouseCursor).c_str();
	if (_wcsicmp(mouseCursor, L"HAND") == 0)
	{
		m_CursorType = MOUSECURSOR_HAND;
	}
	else if (_wcsicmp(mouseCursor, L"TEXT") == 0)
	{
		m_CursorType = MOUSECURSOR_TEXT;
	}
	else if (_wcsicmp(mouseCursor, L"HELP") == 0)
	{
		m_CursorType = MOUSECURSOR_HELP;
	}
	else if (_wcsicmp(mouseCursor, L"BUSY") == 0)
	{
		m_CursorType = MOUSECURSOR_BUSY;
	}
	else if (_wcsicmp(mouseCursor, L"CROSS") == 0)
	{
		m_CursorType = MOUSECURSOR_CROSS;
	}
	else if (_wcsicmp(mouseCursor, L"PEN") == 0)
	{
		m_CursorType = MOUSECURSOR_PEN;
	}
	else if (wcschr(mouseCursor, L'.'))
	{
		m_CursorType = MOUSECURSOR_CUSTOM;
	}
	else
	{
		// Inherit from [Rainmeter].
		m_CursorType = meterWindow->GetMouse().GetCursorType();
		if (m_CursorType == MOUSECURSOR_CUSTOM)
		{
			mouseCursor = meterWindow->GetParser().ReadString(L"Rainmeter", L"MouseActionCursorName", L"").c_str();
		}
	}

	if (m_CursorType == MOUSECURSOR_CUSTOM)
	{
		std::wstring cursorPath = meterWindow->GetResourcesPath();
		cursorPath += L"Cursors\\";
		cursorPath += mouseCursor;
		m_CustomCursor = LoadCursorFromFile(cursorPath.c_str());
		if (!m_CustomCursor)
		{
			m_CursorType = MOUSECURSOR_ARROW;
			LogWithArgs(LOG_ERROR, L"Invalid cursor: %s", cursorPath.c_str());
		}
	}
}
开发者ID:dpvreony-forks,项目名称:rainmeter,代码行数:89,代码来源:Mouse.cpp


注:本文中的CConfigParser::ReadInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。