/* ** Read the common options specified in the ini file. The inherited classes must ** call this base implementation if they overwrite this method. ** */ void Meter::ReadOptions(ConfigParser& parser, const WCHAR* section) { // The MeterStyle defines a template where the values are read if the meter doesn't have it itself const std::wstring& style = parser.ReadString(section, L"MeterStyle", L""); if (!style.empty()) { parser.SetStyleTemplate(style); } Section::ReadOptions(parser, section); BindMeasures(parser, section); int oldX = m_X; std::wstring& x = (std::wstring&)parser.ReadString(section, L"X", L"0"); if (!x.empty()) { WCHAR lastChar = x[x.size() - 1]; if (lastChar == L'r') { m_RelativeX = POSITION_RELATIVE_TL; x.pop_back(); } else if (lastChar == L'R') { m_RelativeX = POSITION_RELATIVE_BR; x.pop_back(); } else { m_RelativeX = POSITION_ABSOLUTE; } m_X = parser.ParseInt(x.c_str(), 0); } else { m_X = 0; m_RelativeX = POSITION_ABSOLUTE; } int oldY = m_Y; std::wstring& y = (std::wstring&)parser.ReadString(section, L"Y", L"0"); if (!y.empty()) { WCHAR lastChar = y[y.size() - 1]; if (lastChar == L'r') { m_RelativeY = POSITION_RELATIVE_TL; y.pop_back(); } else if (lastChar == L'R') { m_RelativeY = POSITION_RELATIVE_BR; y.pop_back(); } else { m_RelativeY = POSITION_ABSOLUTE; } m_Y = parser.ParseInt(y.c_str(), 0); } else { m_Y = 0; m_RelativeY = POSITION_ABSOLUTE; } static const Gdiplus::Rect defPadding; m_Padding = parser.ReadRect(section, L"Padding", defPadding); const int oldW = m_W; const bool oldWDefined = m_WDefined; const int widthPadding = GetWidthPadding(); const int w = parser.ReadInt(section, L"W", m_W); m_WDefined = parser.GetLastValueDefined(); if (IsFixedSize(true)) m_W = w; if (oldW != (m_W - widthPadding)) m_W += widthPadding; if (!m_WDefined && oldWDefined && IsFixedSize()) { m_W = 0; } const int oldH = m_H; const bool oldHDefined = m_HDefined; const int heightPadding = GetHeightPadding(); const int h = parser.ReadInt(section, L"H", m_H); m_HDefined = parser.GetLastValueDefined(); if (IsFixedSize(true)) m_H = h; if (oldH != (m_H - heightPadding)) m_H += heightPadding; if (!m_HDefined && oldHDefined && IsFixedSize()) { m_H = 0; } bool oldHidden = m_Hidden; m_Hidden = parser.ReadBool(section, L"Hidden", false); if (oldX != m_X || oldY != m_Y || oldHidden != m_Hidden) { m_Skin->SetResizeWindowMode(RESIZEMODE_CHECK); // Need to recalculate the window size } m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE); m_SolidColor = parser.ReadColor(section, L"SolidColor", Color::MakeARGB(0, 0, 0, 0)); m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", m_SolidColor.GetValue()); m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", 0.0); m_Mouse.ReadOptions(parser, section); m_HasMouseAction = m_Mouse.HasButtonAction() || m_Mouse.HasScrollAction(); m_ToolTipText = parser.ReadString(section, L"ToolTipText", L""); m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L""); m_ToolTipIcon = parser.ReadString(section, L"ToolTipIcon", L""); m_ToolTipWidth = parser.ReadInt(section, L"ToolTipWidth", 1000); m_ToolTipType = parser.ReadBool(section, L"ToolTipType", false); m_ToolTipHidden = parser.ReadBool(section, L"ToolTipHidden", m_Skin->GetMeterToolTipHidden()); m_AntiAlias = parser.ReadBool(section, L"AntiAlias", false); std::vector<Gdiplus::REAL> matrix = parser.ReadFloats(section, L"TransformationMatrix"); if (matrix.size() == 6) { if (m_Transformation) { m_Transformation->SetElements(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); } else { m_Transformation = new Matrix(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); } } else if (!matrix.empty()) { delete m_Transformation; m_Transformation = nullptr; LogErrorF(this, L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str()); } }