Reverted the changes from r209.

This commit is contained in:
Kimmo Pekkola 2009-09-04 16:37:51 +00:00
parent 8239919333
commit 4bf4e51126
16 changed files with 116 additions and 136 deletions

View File

@ -132,14 +132,27 @@ void CConfigParser::SetVariable(const std::wstring& strVariable, const std::wstr
** **
** **
*/ */
const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures, bool bReplaceDefValue) const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures)
{ {
static std::wstring result; static std::wstring result;
result = GetValue(section, key, defValue); if (section == NULL)
if (result == defValue && bReplaceDefValue == false)
{ {
return result; section = L"";
}
if (key == NULL)
{
key = L"";
}
if (defValue == NULL)
{
defValue = L"";
}
result = GetValue(section, key, defValue);
if (result == defValue)
{
return result;
} }
// Check Litestep vars // Check Litestep vars
@ -445,7 +458,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile)
items[0] = 0; items[0] = 0;
int res = GetPrivateProfileString( NULL, NULL, NULL, items, size, iniFile.c_str()); int res = GetPrivateProfileString( NULL, NULL, NULL, items, size, iniFile.c_str());
if (res == 0) return; // File not found if (res == 0) return; // File not found
if (res != size - 2) break; // Fits in the buffer if (res < size - 2) break; // Fits in the buffer
delete [] items; delete [] items;
size *= 2; size *= 2;
@ -474,7 +487,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile)
{ {
items[0] = 0; items[0] = 0;
int res = GetPrivateProfileString((*iter).first.c_str(), NULL, NULL, items, size, iniFile.c_str()); int res = GetPrivateProfileString((*iter).first.c_str(), NULL, NULL, items, size, iniFile.c_str());
if (res != size - 2) break; // Fits in the buffer if (res < size - 2) break; // Fits in the buffer
delete [] items; delete [] items;
size *= 2; size *= 2;
@ -490,11 +503,11 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile)
{ {
buffer[0] = 0; buffer[0] = 0;
int res = GetPrivateProfileString((*iter).first.c_str(), strKey.c_str(), L"", buffer, bufferSize, iniFile.c_str()); int res = GetPrivateProfileString((*iter).first.c_str(), strKey.c_str(), L"", buffer, bufferSize, iniFile.c_str());
if (res != size - 2) break; // Fits in the buffer if (res < bufferSize - 2) break; // Fits in the buffer
delete [] buffer; delete [] buffer;
bufferSize *= 2; bufferSize *= 2;
buffer = new WCHAR[size]; buffer = new WCHAR[bufferSize];
}; };
SetValue((*iter).first, strKey, buffer); SetValue((*iter).first, strKey, buffer);
@ -593,4 +606,3 @@ std::vector<std::wstring> CConfigParser::GetKeys(const std::wstring& strSection)
return std::vector<std::wstring>(); return std::vector<std::wstring>();
} }

View File

@ -40,7 +40,7 @@ public:
void AddMeasure(CMeasure* pMeasure); void AddMeasure(CMeasure* pMeasure);
void SetVariable(const std::wstring& strVariable, const std::wstring& strValue); void SetVariable(const std::wstring& strVariable, const std::wstring& strValue);
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true, bool bReplaceDefValue = false); const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true);
double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue); double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue);
double ReadFormula(LPCTSTR section, LPCTSTR key, double defValue); double ReadFormula(LPCTSTR section, LPCTSTR key, double defValue);
int ReadInt(LPCTSTR section, LPCTSTR key, int defValue); int ReadInt(LPCTSTR section, LPCTSTR key, int defValue);

View File

@ -212,8 +212,6 @@ void CMeter::ReadConfig(const WCHAR* section)
{ {
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_StyleName = parser.ReadString(section, L"MeterStyle", L"");
const std::wstring& x = parser.ReadString(section, L"X", L"0"); const std::wstring& x = parser.ReadString(section, L"X", L"0");
if (x.size() > 0) if (x.size() > 0)
{ {
@ -250,30 +248,29 @@ void CMeter::ReadConfig(const WCHAR* section)
} }
} }
m_W = (int)parser.ReadFormula(section, L"W", 1.0);
m_H = (int)parser.ReadFormula(section, L"H", 1.0);
m_W = (int)parser.ReadFormula(section, L"W", (int)parser.ReadFormula(m_StyleName.c_str(), L"W", 1.0)); m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0);
m_H = (int)parser.ReadFormula(section, L"H", (int)parser.ReadFormula(m_StyleName.c_str(), L"H", 1.0)); m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", m_SolidBevel);
m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0!=parser.ReadInt(m_StyleName.c_str(), L"Hidden", 0)); m_SolidColor = parser.ReadColor(section, L"SolidColor", Color(0, 0, 0, 0));
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", (BEVELTYPE)parser.ReadInt(m_StyleName.c_str(), L"BevelType", m_SolidBevel)); m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", m_SolidColor);
m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", 0.0);
m_SolidColor = parser.ReadColor(section, L"SolidColor", parser.ReadColor(m_StyleName.c_str(), L"SolidColor", Color(0, 0, 0, 0))); m_RightMouseDownAction = parser.ReadString(section, L"RightMouseDownAction", L"");
m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", parser.ReadColor(m_StyleName.c_str(), L"SolidColor2", m_SolidColor)); m_LeftMouseDownAction = parser.ReadString(section, L"LeftMouseDownAction", L"");
m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", (Gdiplus::REAL)parser.ReadFloat(m_StyleName.c_str(), L"GradientAngle", 0.0)); m_RightMouseUpAction = parser.ReadString(section, L"RightMouseUpAction", L"");
m_LeftMouseUpAction = parser.ReadString(section, L"LeftMouseUpAction", L"");
m_MouseOverAction = parser.ReadString(section, L"MouseOverAction", L"");
m_MouseLeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"");
m_RightMouseDownAction = parser.ReadString(section, L"RightMouseDownAction", parser.ReadString(m_StyleName.c_str(), L"RightMouseDownAction", L"").c_str(),true,true); m_MeasureName = parser.ReadString(section, L"MeasureName", L"");
m_LeftMouseDownAction = parser.ReadString(section, L"LeftMouseDownAction", parser.ReadString(m_StyleName.c_str(), L"LeftMouseDownAction", L"").c_str(),true,true);
m_RightMouseUpAction = parser.ReadString(section, L"RightMouseUpAction", parser.ReadString(m_StyleName.c_str(), L"RightMouseUpAction", L"").c_str(),true,true);
m_LeftMouseUpAction = parser.ReadString(section, L"LeftMouseUpAction", parser.ReadString(m_StyleName.c_str(), L"LeftMouseUpAction", L"").c_str(),true,true);
m_MouseOverAction = parser.ReadString(section, L"MouseOverAction", parser.ReadString(m_StyleName.c_str(), L"MouseOverAction", L"").c_str(),true,true);
m_MouseLeaveAction = parser.ReadString(section, L"MouseLeaveAction", parser.ReadString(m_StyleName.c_str(), L"MouseLeaveAction", L"").c_str(),true,true);
m_MeasureName = parser.ReadString(section, L"MeasureName", parser.ReadString(m_StyleName.c_str(), L"MeasureName", L"").c_str(),true,true); m_UpdateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
m_UpdateDivider = parser.ReadInt(section, L"UpdateDivider", parser.ReadInt(m_StyleName.c_str(), L"UpdateDivider", 1));
m_UpdateCounter = m_UpdateDivider; m_UpdateCounter = m_UpdateDivider;
m_AntiAlias = 0!=parser.ReadInt(section, L"AntiAlias", 0!=parser.ReadInt(m_StyleName.c_str(), L"AntiAlias", 0)); m_AntiAlias = 0!=parser.ReadInt(section, L"AntiAlias", 0);
m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0!=parser.ReadInt(m_StyleName.c_str(), L"DynamicVariables", 0)); m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
std::vector<Gdiplus::REAL> matrix = parser.ReadFloats(section, L"TransformationMatrix"); std::vector<Gdiplus::REAL> matrix = parser.ReadFloats(section, L"TransformationMatrix");
if (matrix.size() == 6) if (matrix.size() == 6)

View File

@ -128,8 +128,6 @@ protected:
bool m_AntiAlias; // If true, the line is antialiased bool m_AntiAlias; // If true, the line is antialiased
bool m_Initialized; bool m_Initialized;
std::wstring m_StyleName;
CMeterWindow* m_MeterWindow; CMeterWindow* m_MeterWindow;
}; };

View File

@ -94,17 +94,17 @@ void CMeterBar::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_Color = parser.ReadColor(section, L"BarColor", parser.ReadColor(m_StyleName.c_str(), L"BarColor", Color::Green)); m_Color = parser.ReadColor(section, L"BarColor", Color::Green);
m_ImageName = parser.ReadString(section, L"BarImage", parser.ReadString(m_StyleName.c_str(), L"BarImage", L"").c_str(),true,true); m_ImageName = parser.ReadString(section, L"BarImage", L"");
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName); m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
m_Border = parser.ReadInt(section, L"BarBorder", parser.ReadInt(m_StyleName.c_str(), L"BarBorder", 0)); m_Border = parser.ReadInt(section, L"BarBorder", 0);
m_Flip = parser.ReadInt(section, L"Flip", 0) == 1; m_Flip = parser.ReadInt(section, L"Flip", 0) == 1;
std::wstring orientation; std::wstring orientation;
orientation = parser.ReadString(section, L"BarOrientation", parser.ReadString(m_StyleName.c_str(), L"BarOrientation", L"VERTICAL").c_str(),true,true); orientation = parser.ReadString(section, L"BarOrientation", L"VERTICAL");
if(_wcsicmp(L"VERTICAL", orientation.c_str()) == 0) if(_wcsicmp(L"VERTICAL", orientation.c_str()) == 0)
{ {

View File

@ -168,20 +168,20 @@ void CMeterBitmap::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_ImageName = parser.ReadString(section, L"BitmapImage", parser.ReadString(m_StyleName.c_str(), L"BitmapImage", L"").c_str(),true,true); m_ImageName = parser.ReadString(section, L"BitmapImage", L"");
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName); m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
m_FrameCount = parser.ReadInt(section, L"BitmapFrames", parser.ReadInt(m_StyleName.c_str(), L"BitmapFrames", 1)); m_FrameCount = parser.ReadInt(section, L"BitmapFrames", 1);
m_ZeroFrame = 0!=parser.ReadInt(section, L"BitmapZeroFrame", 0!=parser.ReadInt(m_StyleName.c_str(), L"BitmapZeroFrame", 0)); m_ZeroFrame = 0!=parser.ReadInt(section, L"BitmapZeroFrame", 0);
m_Separation = parser.ReadInt(section, L"BitmapSeparation", parser.ReadInt(m_StyleName.c_str(), L"BitmapSeparation", 0)); m_Separation = parser.ReadInt(section, L"BitmapSeparation", 0);
m_Extend = 0!=parser.ReadInt(section, L"BitmapExtend", 0!=parser.ReadInt(m_StyleName.c_str(), L"BitmapExtend", 0)); m_Extend = 0!=parser.ReadInt(section, L"BitmapExtend", 0);
m_Digits = parser.ReadInt(section, L"BitmapDigits", parser.ReadInt(m_StyleName.c_str(), L"BitmapDigits", 0)); m_Digits = parser.ReadInt(section, L"BitmapDigits", 0);
m_TransitionFrameCount = parser.ReadInt(section, L"BitmapTransitionFrames", parser.ReadInt(m_StyleName.c_str(), L"BitmapTransitionFrames", 0)); m_TransitionFrameCount = parser.ReadInt(section, L"BitmapTransitionFrames", 0);
std::wstring align; std::wstring align;
align = parser.ReadString(section, L"BitmapAlign", parser.ReadString(m_StyleName.c_str(), L"BitmapAlign", L"LEFT").c_str(),true,true); align = parser.ReadString(section, L"BitmapAlign", L"LEFT");
if(_wcsicmp(align.c_str(), L"LEFT") == 0) if(_wcsicmp(align.c_str(), L"LEFT") == 0)
{ {

View File

@ -135,10 +135,10 @@ void CMeterButton::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_ImageName = parser.ReadString(section, L"ButtonImage", parser.ReadString(m_StyleName.c_str(), L"ButtonImage", L"").c_str(),true,true); m_ImageName = parser.ReadString(section, L"ButtonImage", L"");
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName); m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
m_Command = parser.ReadString(section, L"ButtonCommand", parser.ReadString(m_StyleName.c_str(), L"ButtonCommand", L"").c_str(),true,true); m_Command = parser.ReadString(section, L"ButtonCommand", L"");
} }
/* /*

View File

@ -143,22 +143,22 @@ void CMeterHistogram::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", parser.ReadColor(m_StyleName.c_str(), L"PrimaryColor", Color::Green)); m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", Color::Green);
m_SecondaryColor = parser.ReadColor(section, L"SecondaryColor", parser.ReadColor(m_StyleName.c_str(), L"SecondaryColor", Color::Red)); m_SecondaryColor = parser.ReadColor(section, L"SecondaryColor", Color::Red);
m_BothColor = parser.ReadColor(section, L"BothColor", parser.ReadColor(m_StyleName.c_str(), L"BothColor", Color::Yellow)); m_BothColor = parser.ReadColor(section, L"BothColor", Color::Yellow);
m_SecondaryMeasureName = parser.ReadString(section, L"SecondaryMeasureName", parser.ReadString(m_StyleName.c_str(), L"SecondaryMeasureName", L"").c_str(),true,true); m_SecondaryMeasureName = parser.ReadString(section, L"SecondaryMeasureName", L"");
m_PrimaryImageName = parser.ReadString(section, L"PrimaryImage", parser.ReadString(m_StyleName.c_str(), L"PrimaryImage", L"").c_str(),true,true); m_PrimaryImageName = parser.ReadString(section, L"PrimaryImage", L"");
m_PrimaryImageName = m_MeterWindow->MakePathAbsolute(m_PrimaryImageName); m_PrimaryImageName = m_MeterWindow->MakePathAbsolute(m_PrimaryImageName);
m_SecondaryImageName = parser.ReadString(section, L"SecondaryImage", parser.ReadString(m_StyleName.c_str(), L"SecondaryImage", L"").c_str(),true,true); m_SecondaryImageName = parser.ReadString(section, L"SecondaryImage", L"");
m_SecondaryImageName = m_MeterWindow->MakePathAbsolute(m_SecondaryImageName); m_SecondaryImageName = m_MeterWindow->MakePathAbsolute(m_SecondaryImageName);
m_BothImageName = parser.ReadString(section, L"BothImage", parser.ReadString(m_StyleName.c_str(), L"BothImage", L"").c_str(),true,true); m_BothImageName = parser.ReadString(section, L"BothImage", L"");
m_BothImageName = m_MeterWindow->MakePathAbsolute(m_BothImageName); m_BothImageName = m_MeterWindow->MakePathAbsolute(m_BothImageName);
m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0!=parser.ReadInt(m_StyleName.c_str(), L"AutoScale", 0)); m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0);
m_Flip = 0!=parser.ReadInt(section, L"Flip", 0); m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);
} }

View File

@ -197,9 +197,9 @@ void CMeterImage::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_ImageName = parser.ReadString(section, L"ImageName", parser.ReadString(m_StyleName.c_str(), L"ImageName", L"").c_str(),true,true); m_ImageName = parser.ReadString(section, L"ImageName", L"");
m_Path = parser.ReadString(section, L"Path", parser.ReadString(m_StyleName.c_str(), L"Path", L"").c_str(),true,true); m_Path = parser.ReadString(section, L"Path", L"");
if (!m_Path.empty()) if (!m_Path.empty())
{ {
if (m_Path[m_Path.length() - 1] != L'\\') if (m_Path[m_Path.length() - 1] != L'\\')
@ -209,7 +209,7 @@ void CMeterImage::ReadConfig(const WCHAR* section)
} }
m_ImageName = m_MeterWindow->MakePathAbsolute(m_Path + m_ImageName); m_ImageName = m_MeterWindow->MakePathAbsolute(m_Path + m_ImageName);
m_PreserveAspectRatio = 0!=parser.ReadInt(section, L"PreserveAspectRatio", 0!=parser.ReadInt(m_StyleName.c_str(), L"PreserveAspectRatio", 0)); m_PreserveAspectRatio = 0!=parser.ReadInt(section, L"PreserveAspectRatio", 0);
if (-1 != parser.ReadInt(section, L"W", -1)) if (-1 != parser.ReadInt(section, L"W", -1))
{ {

View File

@ -86,7 +86,7 @@ void CMeterLine::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
int lineCount = parser.ReadInt(section, L"LineCount", parser.ReadInt(m_StyleName.c_str(), L"LineCount", 1)); int lineCount = parser.ReadInt(section, L"LineCount", 1);
for (i = 0; i < lineCount; i++) for (i = 0; i < lineCount; i++)
{ {
@ -99,7 +99,7 @@ void CMeterLine::ReadConfig(const WCHAR* section)
swprintf(tmpName, L"LineColor%i", i + 1); swprintf(tmpName, L"LineColor%i", i + 1);
} }
m_Colors.push_back(parser.ReadColor(section, tmpName, parser.ReadColor(m_StyleName.c_str(), tmpName, Color::White))); m_Colors.push_back(parser.ReadColor(section, tmpName, Color::White));
if (i == 0) if (i == 0)
{ {
@ -110,21 +110,21 @@ void CMeterLine::ReadConfig(const WCHAR* section)
swprintf(tmpName, L"Scale%i", i + 1); swprintf(tmpName, L"Scale%i", i + 1);
} }
m_ScaleValues.push_back(parser.ReadFloat(section, tmpName, parser.ReadFloat(m_StyleName.c_str(), tmpName, 1.0))); m_ScaleValues.push_back(parser.ReadFloat(section, tmpName, 1.0));
if (i != 0) if (i != 0)
{ {
swprintf(tmpName, L"MeasureName%i", i + 1); swprintf(tmpName, L"MeasureName%i", i + 1);
m_MeasureNames.push_back(parser.ReadString(section, tmpName, parser.ReadString(m_StyleName.c_str(), tmpName, L"").c_str(),true,true)); m_MeasureNames.push_back(parser.ReadString(section, tmpName, L""));
} }
} }
m_Flip = 0!=parser.ReadInt(section, L"Flip", 0!=parser.ReadInt(m_StyleName.c_str(), L"Flip", 0)); m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);
m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0!=parser.ReadInt(m_StyleName.c_str(), L"AutoScale", 0)); m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0);
m_LineWidth = parser.ReadFloat(section, L"LineWidth", parser.ReadFloat(m_StyleName.c_str(), L"LineWidth", 1.0)); m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
m_HorizontalLines = 0!=parser.ReadInt(section, L"HorizontalLines", 0!=parser.ReadInt(m_StyleName.c_str(), L"HorizontalLines", 0)); m_HorizontalLines = 0!=parser.ReadInt(section, L"HorizontalLines", 0);
m_HorizontalColor = parser.ReadColor(section, L"HorizontalColor", parser.ReadColor(m_StyleName.c_str(), L"HorizontalColor", Color::Black)); // This is left here for backwards compatibility m_HorizontalColor = parser.ReadColor(section, L"HorizontalColor", Color::Black); // This is left here for backwards compatibility
m_HorizontalColor = parser.ReadColor(section, L"HorizontalLineColor", parser.ReadColor(m_StyleName.c_str(), L"HorizontalLineColor", m_HorizontalColor)); // This is what it should be m_HorizontalColor = parser.ReadColor(section, L"HorizontalLineColor", m_HorizontalColor); // This is what it should be
} }
/* /*

View File

@ -87,16 +87,16 @@ void CMeterRotator::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_ImageName = parser.ReadString(section, L"ImageName", parser.ReadString(m_StyleName.c_str(), L"ImageName", L"").c_str(),true,true); m_ImageName = parser.ReadString(section, L"ImageName", L"");
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName); m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
m_OffsetX = parser.ReadFloat(section, L"OffsetX", parser.ReadFloat(m_StyleName.c_str(), L"OffsetX", 0.0)); m_OffsetX = parser.ReadFloat(section, L"OffsetX", 0.0);
m_OffsetY = parser.ReadFloat(section, L"OffsetY", parser.ReadFloat(m_StyleName.c_str(), L"OffsetY", 0.0)); m_OffsetY = parser.ReadFloat(section, L"OffsetY", 0.0);
m_StartAngle = parser.ReadFloat(section, L"StartAngle", parser.ReadFloat(m_StyleName.c_str(), L"StartAngle", 0.0)); m_StartAngle = parser.ReadFloat(section, L"StartAngle", 0.0);
m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", parser.ReadFloat(m_StyleName.c_str(), L"RotationAngle", 6.2832)); m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", 6.2832);
m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", parser.ReadInt(m_StyleName.c_str(), L"ValueReminder", 0)); // Typo m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", 0); // Typo
m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", parser.ReadInt(m_StyleName.c_str(), L"ValueRemainder", m_ValueRemainder)); m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", m_ValueRemainder);
} }
/* /*

View File

@ -74,23 +74,20 @@ void CMeterRoundLine::ReadConfig(const WCHAR* section)
CConfigParser& parser = m_MeterWindow->GetParser(); CConfigParser& parser = m_MeterWindow->GetParser();
m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
parser.ReadString(section, L"Prefix", parser.ReadString(m_StyleName.c_str(), L"Prefix", L"").c_str(),true,true); m_LineLength = parser.ReadFloat(section, L"LineLength", 20.0);
m_LineStart = parser.ReadFloat(section, L"LineStart", -1.0);
m_LineWidth = parser.ReadFloat(section, L"LineWidth", parser.ReadFloat(m_StyleName.c_str(), L"LineWidth", 1.0)); m_StartAngle = parser.ReadFloat(section, L"StartAngle", 0.0);
m_LineLength = parser.ReadFloat(section, L"LineLength", parser.ReadFloat(m_StyleName.c_str(), L"LineLength", 20.0)); m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", 6.2832);
m_LineStart = parser.ReadFloat(section, L"LineStart", parser.ReadFloat(m_StyleName.c_str(), L"LineStart", -1.0)); m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", 0); // Typo
m_StartAngle = parser.ReadFloat(section, L"StartAngle", parser.ReadFloat(m_StyleName.c_str(), L"StartAngle", 0.0)); m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", m_ValueRemainder);
m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", parser.ReadFloat(m_StyleName.c_str(), L"RotationAngle", 6.2832)); m_LineColor = parser.ReadColor(section, L"LineColor", Color::Black);
m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", parser.ReadInt(m_StyleName.c_str(), L"ValueReminder", 0)); // Typo m_Solid = 0!=parser.ReadInt(section, L"Solid", 0);
m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", parser.ReadInt(m_StyleName.c_str(), L"ValueRemainder", m_ValueRemainder)); m_CntrlAngle = 0!=parser.ReadInt(section, L"ControlAngle", 1);
m_LineColor = parser.ReadColor(section, L"LineColor", parser.ReadColor(m_StyleName.c_str(), L"LineColor", Color::Black)); m_CntrlLineStart = 0!=parser.ReadInt(section, L"ControlStart", 0);
m_Solid = 0!=parser.ReadInt(section, L"Solid", 0!=parser.ReadInt(m_StyleName.c_str(), L"Solid", 0)); m_CntrlLineLength = 0!=parser.ReadInt(section, L"ControlLength", 0);
m_CntrlAngle = 0!=parser.ReadInt(section, L"ControlAngle", 0!=parser.ReadInt(m_StyleName.c_str(), L"ControlAngle", 1)); m_LineStartShift = parser.ReadFloat(section, L"StartShift", 0);
m_CntrlLineStart = 0!=parser.ReadInt(section, L"ControlStart", 0!=parser.ReadInt(m_StyleName.c_str(), L"ControlStart", 0)); m_LineLengthShift = parser.ReadFloat(section, L"LengthShift", 0);
m_CntrlLineLength = 0!=parser.ReadInt(section, L"ControlLength", 0!=parser.ReadInt(m_StyleName.c_str(), L"ControlLength", 0));
m_LineStartShift = parser.ReadFloat(section, L"StartShift", parser.ReadFloat(m_StyleName.c_str(), L"StartShift", 0));
m_LineLengthShift = parser.ReadFloat(section, L"LengthShift", parser.ReadFloat(m_StyleName.c_str(), L"LengthShift", 0));
} }
/* /*

View File

@ -109,7 +109,6 @@ void CMeterString::Initialize()
if(m_FontFamily) delete m_FontFamily; if(m_FontFamily) delete m_FontFamily;
m_FontFamily = new FontFamily(m_FontFace.c_str()); m_FontFamily = new FontFamily(m_FontFace.c_str());
Status status = m_FontFamily->GetLastStatus(); Status status = m_FontFamily->GetLastStatus();
//=================================================== //===================================================
/* Matt King Code */ /* Matt King Code */
// It couldn't find the font family // It couldn't find the font family
@ -214,26 +213,24 @@ void CMeterString::ReadConfig(const WCHAR* section)
i++; i++;
} while(loop); } while(loop);
m_Color = parser.ReadColor(section, L"FontColor", Color::Black);
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", Color::Black);
m_Color = parser.ReadColor(section, L"FontColor", parser.ReadColor(m_StyleName.c_str(), L"FontColor", Color::Black)); m_Prefix = parser.ReadString(section, L"Prefix", L"");
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", parser.ReadColor(m_StyleName.c_str(), L"FontEffectColor", Color::Black)); m_Postfix = parser.ReadString(section, L"Postfix", L"");
m_Text = parser.ReadString(section, L"Text", L"");
m_Prefix = parser.ReadString(section, L"Prefix", parser.ReadString(m_StyleName.c_str(), L"Prefix", L"").c_str(),true,true); m_Percentual = 0!=parser.ReadInt(section, L"Percentual", 0);
m_Postfix = parser.ReadString(section, L"Postfix", parser.ReadString(m_StyleName.c_str(), L"Postfix", L"").c_str(),true,true); m_AutoScale = 0!=parser.ReadInt(section, L"AutoScale", 0);
m_Text = parser.ReadString(section, L"Text", parser.ReadString(m_StyleName.c_str(), L"Text", L"").c_str(),true,true); m_ClipString = 0!=parser.ReadInt(section, L"ClipString", 0);
m_Percentual = 0!=parser.ReadInt(section, L"Percentual", 0!=parser.ReadInt(m_StyleName.c_str(), L"Percentual", 0)); m_FontSize = parser.ReadFormula(section, L"FontSize", 10);
m_AutoScale = 0!=parser.ReadInt(section, L"AutoScale", 0!=parser.ReadInt(m_StyleName.c_str(), L"AutoScale", 0)); m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", -1);
m_ClipString = 0!=parser.ReadInt(section, L"ClipString", 0!=parser.ReadInt(m_StyleName.c_str(), L"ClipString", 0));
m_FontSize = parser.ReadFormula(section, L"FontSize", parser.ReadFormula(m_StyleName.c_str(), L"FontSize", 10)); m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", 0.0);
m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", parser.ReadInt(m_StyleName.c_str(), L"NumOfDecimals", -1));
m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", (Gdiplus::REAL)parser.ReadFloat(m_StyleName.c_str(), L"Angle",0.0));
std::wstring scale; std::wstring scale;
scale = parser.ReadString(section, L"Scale", parser.ReadString(m_StyleName.c_str(), L"Scale", L"1").c_str(),true,true); scale = parser.ReadString(section, L"Scale", L"1");
if (wcschr(scale.c_str(), '.') == NULL) if (wcschr(scale.c_str(), '.') == NULL)
{ {
@ -245,11 +242,10 @@ void CMeterString::ReadConfig(const WCHAR* section)
} }
m_Scale = wcstod(scale.c_str(), NULL); m_Scale = wcstod(scale.c_str(), NULL);
m_FontFace = parser.ReadString(section, L"FontFace", parser.ReadString(m_StyleName.c_str(), L"FontFace", L"Arial").c_str(),true,true); m_FontFace = parser.ReadString(section, L"FontFace", L"Arial");
std::wstring align; std::wstring align;
align = parser.ReadString(section, L"StringAlign", parser.ReadString(m_StyleName.c_str(), L"StringAlign", L"LEFT").c_str(),true,true); align = parser.ReadString(section, L"StringAlign", L"LEFT");
if(_wcsicmp(align.c_str(), L"LEFT") == 0) if(_wcsicmp(align.c_str(), L"LEFT") == 0)
{ {
@ -269,7 +265,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
} }
std::wstring style; std::wstring style;
style = parser.ReadString(section, L"StringStyle", parser.ReadString(m_StyleName.c_str(), L"StringStyle", L"NORMAL").c_str(),true,true); style = parser.ReadString(section, L"StringStyle", L"NORMAL");
if(_wcsicmp(style.c_str(), L"NORMAL") == 0) if(_wcsicmp(style.c_str(), L"NORMAL") == 0)
{ {
@ -293,7 +289,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
} }
std::wstring effect; std::wstring effect;
effect = parser.ReadString(section, L"StringEffect", parser.ReadString(m_StyleName.c_str(), L"StringEffect", L"NONE").c_str(),true,true); effect = parser.ReadString(section, L"StringEffect", L"NONE");
if(_wcsicmp(effect.c_str(), L"NONE") == 0) if(_wcsicmp(effect.c_str(), L"NONE") == 0)
{ {
@ -326,15 +322,6 @@ void CMeterString::ReadConfig(const WCHAR* section)
} }
} }
/*
** Update
**
** Updates the value(s) from the measures.
**
*/
/* /*
** Update ** Update
** **

View File

@ -38,7 +38,6 @@
#include "MeasureNet.h" #include "MeasureNet.h"
#include "MeasurePlugin.h" #include "MeasurePlugin.h"
#include "MeterButton.h" #include "MeterButton.h"
#include <algorithm>
using namespace Gdiplus; using namespace Gdiplus;
@ -1522,7 +1521,7 @@ void CMeterWindow::ReadSkin()
{ {
int res = GetPrivateProfileString( NULL, NULL, NULL, items, size, iniFile.c_str()); int res = GetPrivateProfileString( NULL, NULL, NULL, items, size, iniFile.c_str());
if (res == 0) return; // File not found if (res == 0) return; // File not found
if (res != size - 2) break; // Fits in the buffer if (res < size - 2) break; // Fits in the buffer
delete [] items; delete [] items;
size *= 2; size *= 2;
@ -1536,12 +1535,11 @@ void CMeterWindow::ReadSkin()
wcsicmp(L"Variables", pos) != 0 && wcsicmp(L"Variables", pos) != 0 &&
wcsicmp(L"Metadata", pos) != 0) wcsicmp(L"Metadata", pos) != 0)
{ {
std::wstring meterName, measureName, styleName; std::wstring meterName, measureName;
// Check if the item is a meter or a measure (or perhaps something else) // Check if the item is a meter or a measure (or perhaps something else)
measureName = m_Parser.ReadString(pos, L"Measure", L""); measureName = m_Parser.ReadString(pos, L"Measure", L"");
meterName = m_Parser.ReadString(pos, L"Meter", L""); meterName = m_Parser.ReadString(pos, L"Meter", L"");
styleName = m_Parser.ReadString(pos, L"Style", L"");
if (measureName.length() > 0) if (measureName.length() > 0)
{ {
try try
@ -1574,10 +1572,6 @@ void CMeterWindow::ReadSkin()
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }
else if (styleName.length() > 0)
{
//ignore sections with Style= in them.
}
else else
{ {
// It's something else // It's something else
@ -3386,4 +3380,3 @@ std::wstring CMeterWindow::MakePathAbsolute(std::wstring path)
return root + path; return root + path;
} }

View File

@ -28,8 +28,6 @@
#include <vector> #include <vector>
#include "ConfigParser.h" #include "ConfigParser.h"
#include "Export.h" #include "Export.h"
#include <map>
#include <utility>
#define BEGIN_MESSAGEPROC switch(uMsg) { #define BEGIN_MESSAGEPROC switch(uMsg) {
#define MESSAGE(handler, msg) case msg: return Window?Window->handler(wParam, lParam):DefWindowProc(hWnd, uMsg, wParam, lParam); #define MESSAGE(handler, msg) case msg: return Window?Window->handler(wParam, lParam):DefWindowProc(hWnd, uMsg, wParam, lParam);
@ -115,7 +113,6 @@ typedef struct
int vsT, vsL, vsH, vsW; int vsT, vsL, vsH, vsW;
} MULTIMONITOR_INFO; } MULTIMONITOR_INFO;
class CRainmeter; class CRainmeter;
class CMeasure; class CMeasure;
class CMeter; class CMeter;

View File

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008 # Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Application", "Application\Application.vcproj", "{D2A0903C-E760-4134-AE61-3D55BF8F760C}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Application", "Application\Application.vcproj", "{D2A0903C-E760-4134-AE61-3D55BF8F760C}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{BE9D2400-7F1C-49D6-8498-5CE495491AD6} = {BE9D2400-7F1C-49D6-8498-5CE495491AD6} {BE9D2400-7F1C-49D6-8498-5CE495491AD6} = {BE9D2400-7F1C-49D6-8498-5CE495491AD6}
@ -138,7 +138,6 @@ Global
{761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|Win32.ActiveCfg = Release64|Win32 {761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|Win32.ActiveCfg = Release64|Win32
{761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|Win32.Build.0 = Release64|Win32 {761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|Win32.Build.0 = Release64|Win32
{761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|x64.ActiveCfg = Release64|x64 {761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|x64.ActiveCfg = Release64|x64
{761BAD94-EA54-4DBD-9FF0-50FDAFECBE93}.Release64|x64.Build.0 = Release64|x64
{BCE0E543-7ADC-4E10-AD66-52E90F70ED4A}.Debug|Win32.ActiveCfg = Debug|Win32 {BCE0E543-7ADC-4E10-AD66-52E90F70ED4A}.Debug|Win32.ActiveCfg = Debug|Win32
{BCE0E543-7ADC-4E10-AD66-52E90F70ED4A}.Debug|Win32.Build.0 = Debug|Win32 {BCE0E543-7ADC-4E10-AD66-52E90F70ED4A}.Debug|Win32.Build.0 = Debug|Win32
{BCE0E543-7ADC-4E10-AD66-52E90F70ED4A}.Debug|x64.ActiveCfg = Debug|Win32 {BCE0E543-7ADC-4E10-AD66-52E90F70ED4A}.Debug|x64.ActiveCfg = Debug|Win32