diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index e47852f8..1944ed88 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -34,9 +34,11 @@ stdext::hash_map CConfigParser::c_MonitorVariables; ** The constructor ** */ -CConfigParser::CConfigParser() +CConfigParser::CConfigParser() : + m_Parser(MathParser_Create(NULL)), + m_LastReplaced(false), + m_LastDefaultUsed(false) { - m_Parser = MathParser_Create(NULL); } /* diff --git a/Library/Library.vcproj b/Library/Library.vcproj index 20b69dd1..c14c727f 100644 --- a/Library/Library.vcproj +++ b/Library/Library.vcproj @@ -1522,6 +1522,7 @@ > @@ -2612,6 +2618,8 @@ @@ -2638,6 +2646,8 @@ @@ -2664,6 +2674,8 @@ @@ -2690,6 +2702,8 @@ @@ -2716,6 +2730,8 @@ @@ -2742,6 +2758,8 @@ diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 6c4f40b5..714b6e61 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -67,27 +67,27 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeasure::CMeasure(CMeterWindow* meterWindow) : m_MeterWindow(meterWindow) +CMeasure::CMeasure(CMeterWindow* meterWindow) : m_MeterWindow(meterWindow), + m_DynamicVariables(false), + m_Invert(false), + m_LogMaxValue(false), + m_MinValue(), + m_MaxValue(1.0), + m_Value(), + m_MedianPos(), + m_AveragePos(), + m_AverageSize(), + m_IfEqualValue(), + m_IfAboveValue(), + m_IfBelowValue(), + m_IfEqualCommited(false), + m_IfAboveCommited(false), + m_IfBelowCommited(false), + m_Disabled(false), + m_UpdateDivider(1), + m_UpdateCounter(1), + m_Initialized(false) { - m_Invert = false; - m_LogMaxValue = false; - m_MinValue = 0.0; - m_MaxValue = 1.0; - m_Value = 0.0; - m_IfAboveValue = 0.0; - m_IfBelowValue = 0.0; - m_IfEqualValue = 0.0; - m_IfAboveCommited = false; - m_IfBelowCommited = false; - m_IfEqualCommited = false; - m_Disabled = false; - m_UpdateDivider = 1; - m_UpdateCounter = 1; - m_MedianPos = 0; - m_AveragePos = 0; - m_AverageSize = 0; - m_DynamicVariables = false; - m_Initialized = false; } /* diff --git a/Library/MeasureCPU.cpp b/Library/MeasureCPU.cpp index e1e9904b..4adb6b12 100644 --- a/Library/MeasureCPU.cpp +++ b/Library/MeasureCPU.cpp @@ -55,22 +55,13 @@ ** The constructor ** */ -CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_FirstTime(true), + m_Processor(), + m_NtQuerySystemInformation((PROCNTQSI)GetProcAddress(GetModuleHandle(L"ntdll"), "NtQuerySystemInformation")), + m_GetSystemTimes((PROCGST)GetProcAddress(GetModuleHandle(L"kernel32"), "GetSystemTimes")) { m_MaxValue = 100.0; - m_MinValue = 0.0; - m_FirstTime = true; - - m_Processor = 0; - - m_NtQuerySystemInformation = (PROCNTQSI)GetProcAddress( - GetModuleHandle(L"ntdll"), - "NtQuerySystemInformation" - ); - m_GetSystemTimes = (PROCGST)GetProcAddress( - GetModuleHandle(L"kernel32"), - "GetSystemTimes" - ); SYSTEM_INFO systemInfo = {0}; GetSystemInfo(&systemInfo); diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index 7e3422fe..cb09d46b 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -31,7 +31,11 @@ bool CMeasureCalc::c_RandSeeded = false; ** The constructor ** */ -CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_Parser(MathParser_Create(NULL)), + m_LowBound(), + m_HighBound(100), + m_UpdateRandom(false) { if(!c_RandSeeded) { @@ -39,12 +43,6 @@ CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow) : CMeasure(meterWindow) srand((unsigned)time(0)); } - m_Parser = MathParser_Create(NULL); - - m_LowBound = 0; - m_HighBound = 100; - m_UpdateRandom = false; - rand(); } diff --git a/Library/MeasureCalc.h b/Library/MeasureCalc.h index a7c8791e..0a1e5d5f 100644 --- a/Library/MeasureCalc.h +++ b/Library/MeasureCalc.h @@ -41,12 +41,12 @@ private: std::wstring m_FormulaHolder; hqMathParser* m_Parser; - static hqStrMap* c_VarMap; - static bool c_RandSeeded; - int m_LowBound; int m_HighBound; bool m_UpdateRandom; + + static hqStrMap* c_VarMap; + static bool c_RandSeeded; }; #endif diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index 6267dac3..c9ed2ced 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -26,12 +26,12 @@ ** The constructor ** */ -CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_Total(false), + m_Label(false), + m_IgnoreRemovable(true), + m_OldTotalBytes() { - m_Total = false; - m_Label = false; - m_IgnoreRemovable = true; - m_OldTotalBytes = 0; } /* diff --git a/Library/MeasureMemory.cpp b/Library/MeasureMemory.cpp index 9e109302..57d2f7d4 100644 --- a/Library/MeasureMemory.cpp +++ b/Library/MeasureMemory.cpp @@ -25,9 +25,9 @@ ** The constructor ** */ -CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_Total(false) { - m_Total = false; } /* diff --git a/Library/MeasureNet.cpp b/Library/MeasureNet.cpp index fdee3715..494ba6c3 100644 --- a/Library/MeasureNet.cpp +++ b/Library/MeasureNet.cpp @@ -38,12 +38,12 @@ extern CRainmeter* Rainmeter; ** The constructor. This is the base class for the net-meters. ** */ -CMeasureNet::CMeasureNet(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureNet::CMeasureNet(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_CurrentTraffic(), + m_TrafficValue(), + m_Interface(), + m_Cumulative(false) { - m_TrafficValue = 0; - m_CurrentTraffic = 0; - m_Interface = 0; - m_Cumulative = false; } /* diff --git a/Library/MeasureNetIn.cpp b/Library/MeasureNetIn.cpp index 7109617f..d34fa9fa 100644 --- a/Library/MeasureNetIn.cpp +++ b/Library/MeasureNetIn.cpp @@ -25,10 +25,10 @@ ** The constructor ** */ -CMeasureNetIn::CMeasureNetIn(CMeterWindow* meterWindow) : CMeasureNet(meterWindow) +CMeasureNetIn::CMeasureNetIn(CMeterWindow* meterWindow) : CMeasureNet(meterWindow), + m_FirstTime(true), + m_InOctets() { - m_FirstTime = true; - m_InOctets = 0; } /* diff --git a/Library/MeasureNetOut.cpp b/Library/MeasureNetOut.cpp index d3f1e0f5..7be46a45 100644 --- a/Library/MeasureNetOut.cpp +++ b/Library/MeasureNetOut.cpp @@ -25,10 +25,10 @@ ** The constructor ** */ -CMeasureNetOut::CMeasureNetOut(CMeterWindow* meterWindow) : CMeasureNet(meterWindow) +CMeasureNetOut::CMeasureNetOut(CMeterWindow* meterWindow) : CMeasureNet(meterWindow), + m_FirstTime(true), + m_OutOctets() { - m_FirstTime = true; - m_OutOctets = 0; } /* diff --git a/Library/MeasureNetTotal.cpp b/Library/MeasureNetTotal.cpp index 563a20a0..db9aaca5 100644 --- a/Library/MeasureNetTotal.cpp +++ b/Library/MeasureNetTotal.cpp @@ -25,10 +25,10 @@ ** The constructor ** */ -CMeasureNetTotal::CMeasureNetTotal(CMeterWindow* meterWindow) : CMeasureNet(meterWindow) +CMeasureNetTotal::CMeasureNetTotal(CMeterWindow* meterWindow) : CMeasureNet(meterWindow), + m_FirstTime(true), + m_TotalOctets() { - m_FirstTime = true; - m_TotalOctets = 0; } /* diff --git a/Library/MeasurePhysicalMemory.cpp b/Library/MeasurePhysicalMemory.cpp index 0e2e0882..7f2057c6 100644 --- a/Library/MeasurePhysicalMemory.cpp +++ b/Library/MeasurePhysicalMemory.cpp @@ -25,9 +25,9 @@ ** The constructor ** */ -CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_Total(false) { - m_Total = false; } /* diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 069ba628..1778367c 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -30,18 +30,17 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_Plugin(), + m_ID(), + InitializeFunc(), + UpdateFunc(), + UpdateFunc2(), + FinalizeFunc(), + GetStringFunc(), + ExecuteBangFunc() { - m_Plugin = NULL; - m_ID = 0; - m_MaxValue = 0; - - InitializeFunc = NULL; - UpdateFunc = NULL; - UpdateFunc2 = NULL; - FinalizeFunc = NULL; - GetStringFunc = NULL; - ExecuteBangFunc = NULL; + m_MaxValue = 0.0; } /* diff --git a/Library/MeasureRegistry.cpp b/Library/MeasureRegistry.cpp index 4d9ae858..675351b6 100644 --- a/Library/MeasureRegistry.cpp +++ b/Library/MeasureRegistry.cpp @@ -27,10 +27,10 @@ ** The constructor ** */ -CMeasureRegistry::CMeasureRegistry(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureRegistry::CMeasureRegistry(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_RegKey(), + m_HKey() { - m_RegKey = NULL; - m_HKey = NULL; m_MaxValue = 0.0; } diff --git a/Library/MeasureScript.cpp b/Library/MeasureScript.cpp index 2e6e7e16..edf2a3bc 100644 --- a/Library/MeasureScript.cpp +++ b/Library/MeasureScript.cpp @@ -9,16 +9,14 @@ const char* g_strUpdateFunction = "Update"; const char* g_strGetValueFunction = "GetValue"; const char* g_strGetStringValueFunction = "GetStringValue"; -CMeasureScript::CMeasureScript(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureScript::CMeasureScript(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_pLuaScript(), + m_bUpdateDefined(false), + m_bGetValueDefined(false), + m_bGetStringValueDefined(false), + m_bInitializeDefined(false) { LuaManager::Init(); - - m_pLuaScript = NULL; - - m_bUpdateDefined = false; - m_bGetValueDefined = false; - m_bGetStringValueDefined = false; - m_bInitializeDefined = false; } CMeasureScript::~CMeasureScript() diff --git a/Library/MeasureTime.cpp b/Library/MeasureTime.cpp index 336cdb72..9aa37517 100644 --- a/Library/MeasureTime.cpp +++ b/Library/MeasureTime.cpp @@ -46,16 +46,15 @@ int GetYearDay(int year, int month, int day) ** The constructor ** */ -CMeasureTime::CMeasureTime(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureTime::CMeasureTime(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_DeltaTime(), + m_Time() { /* Set time zone from TZ environment variable. If TZ is not set, * the operating system is queried to obtain the default value * for the variable. */ _tzset(); - - m_DeltaTime.QuadPart = 0; - m_Time.QuadPart = 0; } /* diff --git a/Library/MeasureVirtualMemory.cpp b/Library/MeasureVirtualMemory.cpp index 0369759f..98595efa 100644 --- a/Library/MeasureVirtualMemory.cpp +++ b/Library/MeasureVirtualMemory.cpp @@ -25,9 +25,9 @@ ** The constructor ** */ -CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow), + m_Total(false) { - m_Total = false; } /* diff --git a/Library/Meter.cpp b/Library/Meter.cpp index 1e55bb07..c55a52ec 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -39,31 +39,32 @@ using namespace Gdiplus; ** The constructor ** */ -CMeter::CMeter(CMeterWindow* meterWindow) : m_MeterWindow(meterWindow) +CMeter::CMeter(CMeterWindow* meterWindow) : m_MeterWindow(meterWindow), + m_Measure(), + m_X(), + m_Y(), + m_W(), + m_H(), + m_Hidden(false), + m_RelativeMeter(), + m_DynamicVariables(false), + m_ToolTipWidth(), + m_ToolTipDelay(), + m_ToolTipType(false), + m_ToolTipHidden(false), + m_ToolTipHandle(), + m_HasMouseAction(false), + m_MouseActionCursor(true), + m_MouseOver(false), + m_RelativeX(POSITION_ABSOLUTE), + m_RelativeY(POSITION_ABSOLUTE), + m_UpdateDivider(1), + m_UpdateCounter(1), + m_SolidBevel(BEVELTYPE_NONE), + m_SolidAngle(), + m_AntiAlias(false), + m_Initialized(false) { - m_Measure = NULL; - - m_X = 0; - m_Y = 0; - m_W = 0; - m_H = 0; - m_RelativeMeter = NULL; - m_Hidden = false; - m_SolidBevel = BEVELTYPE_NONE; - m_MouseOver = false; - m_UpdateDivider = 1; - m_UpdateCounter = 1; - m_RelativeX = POSITION_ABSOLUTE; - m_RelativeY = POSITION_ABSOLUTE; - m_SolidAngle = 0.0f; - m_AntiAlias = false; - m_DynamicVariables = false; - m_Initialized = false; - m_HasMouseAction = false; - m_MouseActionCursor = true; - m_ToolTipHidden = false; - - m_ToolTipHandle = NULL; } /* diff --git a/Library/MeterBar.cpp b/Library/MeterBar.cpp index 3ea09bba..752fb531 100644 --- a/Library/MeterBar.cpp +++ b/Library/MeterBar.cpp @@ -34,14 +34,14 @@ extern CRainmeter* Rainmeter; ** */ CMeterBar::CMeterBar(CMeterWindow* meterWindow) : CMeter(meterWindow), - m_Color(Color::Green) + m_NeedsReload(false), + m_Color(Color::Green), + m_Orientation(VERTICAL), + m_Value(), + m_Border(), + m_Flip(false) { m_Image.SetConfigAttributes(L"BarImage", NULL); - - m_NeedsReload = false; - m_Value = 0.0; - m_Border = 0; - m_Flip = false; } /* diff --git a/Library/MeterBitmap.cpp b/Library/MeterBitmap.cpp index dfc1b29d..062da5c9 100644 --- a/Library/MeterBitmap.cpp +++ b/Library/MeterBitmap.cpp @@ -33,20 +33,20 @@ extern CRainmeter* Rainmeter; ** */ CMeterBitmap::CMeterBitmap(CMeterWindow* meterWindow) : CMeter(meterWindow), - m_Image(true) + m_Image(true), + m_NeedsReload(false), + m_ZeroFrame(false), + m_FrameCount(1), + m_TransitionFrameCount(), + m_Align(ALIGN_LEFT), + m_Extend(false), + m_Separation(), + m_Digits(), + m_Value(), + m_TransitionStartTicks(), + m_TransitionStartValue() { m_Image.SetConfigAttributes(L"BitmapImage", NULL); - - m_NeedsReload = false; - m_FrameCount = 1; - m_ZeroFrame = false; - m_Align = ALIGN_LEFT; - m_Extend = false; - m_Separation = 0; - m_Digits = 0; - m_Value = 0; - m_TransitionFrameCount = 0; - m_TransitionStartTicks = 0; } /* diff --git a/Library/MeterButton.cpp b/Library/MeterButton.cpp index 92c5c86f..8668a4e3 100644 --- a/Library/MeterButton.cpp +++ b/Library/MeterButton.cpp @@ -40,18 +40,14 @@ enum BUTTON_STATE ** */ CMeterButton::CMeterButton(CMeterWindow* meterWindow) : CMeter(meterWindow), - m_Image(true) + m_Image(true), + m_NeedsReload(false), + m_Bitmaps(), + m_State(BUTTON_STATE_NORMAL), + m_Clicked(false), + m_Executable(false) { m_Image.SetConfigAttributes(L"ButtonImage", NULL); - - for (int i = 0; i < BUTTON_FRAMES; ++i) - { - m_Bitmaps[i] = NULL; - } - m_NeedsReload = false; - m_State = BUTTON_STATE_NORMAL; - m_Clicked = false; - m_Executable = false; } /* diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index 73e61b9a..550b3d21 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -33,28 +33,27 @@ extern CRainmeter* Rainmeter; ** */ CMeterHistogram::CMeterHistogram(CMeterWindow* meterWindow) : CMeter(meterWindow), + m_SecondaryMeasure(), m_PrimaryColor(Color::Green), m_SecondaryColor(Color::Red), - m_BothColor(Color::Yellow) + m_BothColor(Color::Yellow), + m_MeterPos(), + m_Autoscale(false), + m_Flip(false), + m_PrimaryNeedsReload(false), + m_SecondaryNeedsReload(false), + m_BothNeedsReload(false), + m_PrimaryValues(), + m_SecondaryValues(), + m_MaxPrimaryValue(1.0), + m_MinPrimaryValue(), + m_MaxSecondaryValue(1.0), + m_MinSecondaryValue(), + m_WidthChanged(true) { m_PrimaryImage.SetConfigAttributes(L"PrimaryImage", L"Primary"); m_SecondaryImage.SetConfigAttributes(L"SecondaryImage", L"Secondary"); m_BothImage.SetConfigAttributes(L"BothImage", L"Both"); - - m_PrimaryNeedsReload = false; - m_SecondaryNeedsReload = false; - m_BothNeedsReload = false; - m_SecondaryMeasure = NULL; - m_MeterPos = 0; - m_PrimaryValues = NULL; - m_SecondaryValues = NULL; - m_Autoscale = false; - m_Flip = false; - m_MaxPrimaryValue = 1.0; - m_MinPrimaryValue = 0.0; - m_MaxSecondaryValue = 1.0; - m_MinSecondaryValue = 0.0; - m_WidthChanged = true; } /* diff --git a/Library/MeterImage.cpp b/Library/MeterImage.cpp index cc366b19..b34ddd25 100644 --- a/Library/MeterImage.cpp +++ b/Library/MeterImage.cpp @@ -32,18 +32,14 @@ using namespace Gdiplus; ** The constructor ** */ -CMeterImage::CMeterImage(CMeterWindow* meterWindow) : CMeter(meterWindow) +CMeterImage::CMeterImage(CMeterWindow* meterWindow) : CMeter(meterWindow), + m_NeedsReload(false), + m_WidthDefined(false), + m_HeightDefined(false), + m_PreserveAspectRatio(false), + m_Tile(false), + m_ScaleMargins() { - m_NeedsReload = false; - m_WidthDefined = false; - m_HeightDefined = false; - m_PreserveAspectRatio = false; - m_Tile = false; - - m_ScaleMargins.left = 0; - m_ScaleMargins.top = 0; - m_ScaleMargins.right = 0; - m_ScaleMargins.bottom = 0; } /* diff --git a/Library/MeterLine.cpp b/Library/MeterLine.cpp index b0fdd8bd..4995f38b 100644 --- a/Library/MeterLine.cpp +++ b/Library/MeterLine.cpp @@ -30,13 +30,13 @@ using namespace Gdiplus; ** */ CMeterLine::CMeterLine(CMeterWindow* meterWindow) : CMeter(meterWindow), - m_HorizontalColor(Color::Black) + m_Autoscale(false), + m_HorizontalLines(false), + m_Flip(false), + m_LineWidth(1.0), + m_HorizontalColor(Color::Black), + m_CurrentPos() { - m_Autoscale = false; - m_HorizontalLines = false; - m_CurrentPos = 0; - m_Flip = false; - m_LineWidth = 1.0; } /* diff --git a/Library/MeterRotator.cpp b/Library/MeterRotator.cpp index 2fea4295..ba4d6509 100644 --- a/Library/MeterRotator.cpp +++ b/Library/MeterRotator.cpp @@ -33,10 +33,15 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeterRotator::CMeterRotator(CMeterWindow* meterWindow) : CMeter(meterWindow) +CMeterRotator::CMeterRotator(CMeterWindow* meterWindow) : CMeter(meterWindow), + m_NeedsReload(false), + m_OffsetX(), + m_OffsetY(), + m_StartAngle(), + m_RotationAngle(6.2832), + m_ValueRemainder(), + m_Value() { - m_NeedsReload = false; - m_Value = 0.0; } /* diff --git a/Library/MeterRoundLine.cpp b/Library/MeterRoundLine.cpp index a2013c98..966405b4 100644 --- a/Library/MeterRoundLine.cpp +++ b/Library/MeterRoundLine.cpp @@ -33,21 +33,21 @@ using namespace Gdiplus; ** */ CMeterRoundLine::CMeterRoundLine(CMeterWindow* meterWindow) : CMeter(meterWindow), - m_LineColor(Color::Black) + m_Solid(false), + m_LineWidth(1.0), + m_LineLength(20.0), + m_LineStart(-1.0), + m_StartAngle(), + m_RotationAngle(6.2832), + m_CntrlAngle(true), + m_CntrlLineStart(false), + m_CntrlLineLength(false), + m_LineStartShift(), + m_LineLengthShift(), + m_ValueRemainder(), + m_LineColor(Color::Black), + m_Value() { - m_LineWidth = 1.0; - m_LineLength = 20; - m_LineStart = -1.0; - m_StartAngle = 0.0; - m_RotationAngle = 0.0; - m_ValueRemainder = 0; - m_Solid = false; - m_Value = 0.0; - m_CntrlAngle = true; - m_CntrlLineStart = false; - m_CntrlLineLength = false; - m_LineStartShift = 0; - m_LineLengthShift = 0; } /* @@ -85,8 +85,8 @@ void CMeterRoundLine::ReadConfig(const WCHAR* section) 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); - m_LineLengthShift = parser.ReadFloat(section, L"LengthShift", 0); + m_LineStartShift = parser.ReadFloat(section, L"StartShift", 0.0); + m_LineLengthShift = parser.ReadFloat(section, L"LengthShift", 0.0); } /* diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index 4a1236a5..42c23261 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -68,23 +68,23 @@ void StringToProper(std::wstring& str) */ CMeterString::CMeterString(CMeterWindow* meterWindow) : CMeter(meterWindow), m_Color(Color::White), - m_EffectColor(Color::Black) + m_EffectColor(Color::Black), + m_AutoScale(AUTOSCALE_OFF), + m_Align(ALIGN_LEFT), + m_Style(NORMAL), + m_Effect(EFFECT_NONE), + m_textCase(TEXTCASE_NONE), + m_FontSize(10), + m_Scale(1.0), + m_NoDecimals(true), + m_Percentual(true), + m_ClipString(false), + m_Font(), + m_FontFamily(), + m_NumOfDecimals(-1), + m_DimensionsDefined(false), + m_Angle() { - m_Effect = EFFECT_NONE; - m_AutoScale = AUTOSCALE_OFF; - m_Align = ALIGN_LEFT; - m_Font = NULL; - m_FontFamily = NULL; - m_Style = NORMAL; - m_FontSize = 10; - m_Scale = 1.0; - m_NoDecimals = true; - m_Percentual = true; - m_ClipString = false; - m_NumOfDecimals = -1; - m_DimensionsDefined = false; - m_Angle = 0.0; - m_textCase = TEXTCASE_NONE; } /* diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index b0ab8e0f..96a51e7b 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -54,89 +54,72 @@ extern CRainmeter* Rainmeter; ** */ CMeterWindow::CMeterWindow(const std::wstring& path, const std::wstring& config, const std::wstring& iniFile) : m_SkinPath(path), m_SkinName(config), m_SkinIniFile(iniFile), + m_DoubleBuffer(), + m_Background(), + m_BackgroundSize(), + m_Window(), + m_ChildWindow(false), + m_MouseOver(false), + m_BackgroundMargins(), + m_DragMargins(), m_WindowX(L"0"), - m_WindowY(L"0") + m_WindowY(L"0"), + m_WindowXScreen(1), + m_WindowYScreen(1), + m_WindowXScreenDefined(false), + m_WindowYScreenDefined(false), + m_WindowXFromRight(false), + m_WindowYFromBottom(false), + m_WindowXPercentage(false), + m_WindowYPercentage(false), + m_WindowW(), + m_WindowH(), + m_ScreenX(), + m_ScreenY(), + m_AnchorXFromRight(false), + m_AnchorYFromBottom(false), + m_AnchorXPercentage(false), + m_AnchorYPercentage(false), + m_AnchorScreenX(), + m_AnchorScreenY(), + m_WindowDraggable(true), + m_WindowUpdate(1000), + m_TransitionUpdate(100), + m_ActiveTransition(false), + m_HasNetMeasures(false), + m_HasButtons(false), + m_WindowHide(HIDEMODE_NONE), + m_WindowStartHidden(false), + m_SavePosition(false), // Must be false + m_SnapEdges(true), + m_NativeTransparency(true), + m_AlphaValue(255), + m_FadeDuration(250), +// m_MeasuresToVariables(false), + m_WindowZPosition(ZPOSITION_NORMAL), + m_DynamicWindowSize(false), + m_ClickThrough(false), + m_KeepOnScreen(true), + m_AutoSelectScreen(false), + m_Dragging(false), + m_Dragged(false), + m_BackgroundMode(BGMODE_IMAGE), + m_SolidAngle(), + m_SolidBevel(BEVELTYPE_NONE), + m_FadeStartTime(), + m_FadeStartValue(), + m_FadeEndValue(), + m_TransparencyValue(), + m_Refreshing(false), + m_Hidden(false), + m_ResetRegion(false), + m_UpdateCounter(), + m_MouseMoveCounter(), + m_Rainmeter(), + m_FontCollection(), + m_MouseActionCursor(true), + m_ToolTipHidden(false) { - m_Rainmeter = NULL; - - m_Background = NULL; - m_Window = NULL; - m_ChildWindow = false; - - m_DoubleBuffer = NULL; - - m_ScreenX = 0; - m_ScreenY = 0; - m_WindowW = 0; - m_WindowH = 0; - m_WindowXPercentage = false; - m_WindowYPercentage = false; - m_WindowXFromRight = false; - m_WindowYFromBottom = false; - m_WindowXScreen = 1; - m_WindowYScreen = 1; - m_WindowXScreenDefined = false; - m_WindowYScreenDefined = false; - m_AnchorXFromRight = false; - m_AnchorYFromBottom = false; - m_AnchorXPercentage = false; - m_AnchorYPercentage = false; - m_AnchorScreenX = 0; - m_AnchorScreenY = 0; - m_WindowZPosition = ZPOSITION_NORMAL; - m_WindowDraggable = true; - m_WindowUpdate = 1000; - m_TransitionUpdate = 100; - m_ActiveTransition = false; - m_HasNetMeasures = false; - m_HasButtons = false; - m_WindowHide = HIDEMODE_NONE; - m_WindowStartHidden = false; - m_SnapEdges = true; - m_Hidden = false; - m_ResetRegion = false; - m_Refreshing = false; - m_NativeTransparency = true; - m_MeasuresToVariables = false; - m_SavePosition = false; // Must be false - m_AlphaValue = 255; - m_FadeDuration = 250; - m_ClickThrough = false; - m_DynamicWindowSize = false; - m_KeepOnScreen = true; - m_AutoSelectScreen = false; - m_Dragging = false; - m_Dragged = false; - - m_BackgroundSize.cx = 0; - m_BackgroundSize.cy = 0; - - m_BackgroundMargins.left = 0; - m_BackgroundMargins.top = 0; - m_BackgroundMargins.right = 0; - m_BackgroundMargins.bottom = 0; - m_DragMargins.left = 0; - m_DragMargins.top = 0; - m_DragMargins.right = 0; - m_DragMargins.bottom = 0; - - m_FadeStartTime = 0; - m_FadeStartValue = 0; - m_FadeEndValue = 0; - m_TransparencyValue = 0; - - m_MouseOver = false; - - m_BackgroundMode = BGMODE_IMAGE; - m_SolidBevel = BEVELTYPE_NONE; - - m_UpdateCounter = 0; - m_MouseMoveCounter = 0; - m_FontCollection = NULL; - - m_MouseActionCursor = true; - m_ToolTipHidden = false; - ++c_InstanceCount; } @@ -1633,7 +1616,7 @@ void CMeterWindow::ReadConfig() m_WindowStartHidden = false; m_SavePosition = true; m_SnapEdges = true; - m_MeasuresToVariables = false; +// m_MeasuresToVariables = false; m_NativeTransparency = true; m_ClickThrough = false; m_KeepOnScreen = true; @@ -1709,7 +1692,7 @@ void CMeterWindow::ReadConfig() m_WindowStartHidden = 0!=parser.ReadInt(section, L"StartHidden", m_WindowStartHidden); m_SavePosition = 0!=parser.ReadInt(section, L"SavePosition", m_SavePosition); m_SnapEdges = 0!=parser.ReadInt(section, L"SnapEdges", m_SnapEdges); - m_MeasuresToVariables = 0!=parser.ReadInt(section, L"MeasuresToVariables", m_MeasuresToVariables); +// m_MeasuresToVariables = 0!=parser.ReadInt(section, L"MeasuresToVariables", m_MeasuresToVariables); m_NativeTransparency = 0!=parser.ReadInt(section, L"NativeTransparency", m_NativeTransparency); m_ClickThrough = 0!=parser.ReadInt(section, L"ClickThrough", m_ClickThrough); m_KeepOnScreen = 0!=parser.ReadInt(section, L"KeepOnScreen", m_KeepOnScreen); diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index d801897f..d2f7410c 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -307,7 +307,7 @@ private: SIZE m_BackgroundSize; HWND m_Window; // Handle to the Rainmeter window - BOOL m_ChildWindow; + bool m_ChildWindow; std::wstring m_RightMouseDownAction; // Action to run when right mouse is pressed std::wstring m_LeftMouseDownAction; // Action to run when left mouse is pressed @@ -364,7 +364,7 @@ private: bool m_NativeTransparency; // If true, use the W2k/XP native transparency int m_AlphaValue; // The 'from' transparency value 0 - 255 int m_FadeDuration; // Time it takes to fade the window - bool m_MeasuresToVariables; // If true, Measured values are transformed to Litestep's eVars +// bool m_MeasuresToVariables; // If true, Measured values are transformed to Litestep's eVars ZPOSITION m_WindowZPosition; // Window's Z-position bool m_DynamicWindowSize; // bool m_ClickThrough; // @@ -401,12 +401,12 @@ private: CRainmeter* m_Rainmeter; // Pointer to the main object - static int c_InstanceCount; - Gdiplus::PrivateFontCollection* m_FontCollection; bool m_MouseActionCursor; bool m_ToolTipHidden; + + static int c_InstanceCount; }; #endif diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index d4a51612..295c59c2 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -1557,27 +1557,21 @@ bool CRainmeter::c_Debug = false; ** Constructor ** */ -CRainmeter::CRainmeter() +CRainmeter::CRainmeter() : + m_TrayWindow(), + m_DisableVersionCheck(FALSE), + m_NewVersion(FALSE), + m_DesktopWorkAreaChanged(false), + m_DesktopWorkAreaType(false), + m_MenuActive(false), + m_DisableRDP(false), + m_DisableDragging(false), + m_Logging(false), + m_CsLogData(), + m_CurrentParser(), + m_Instance(), + m_GDIplusToken() { - m_MenuActive = false; - - m_DisableRDP = false; - - m_DisableDragging = false; - - m_Logging = false; - - m_DesktopWorkAreaChanged = false; - m_DesktopWorkAreaType = false; - - m_DisableVersionCheck = false; - m_NewVersion = false; - - m_Instance = NULL; - m_CurrentParser = NULL; - - m_TrayWindow = NULL; - InitializeCriticalSection(&m_CsLogData); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index 9a30719a..c7f0780c 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -54,26 +54,21 @@ const Gdiplus::ColorMatrix CTintedImage::c_IdentifyMatrix = { ** */ CTintedImage::CTintedImage(bool disableTransform) : m_DisableTransform(disableTransform), + m_Bitmap(), + m_BitmapTint(), + m_hBuffer(), + m_Modified(), + m_NeedsCrop(false), + m_NeedsTinting(false), + m_NeedsTransform(false), m_Crop(-1, -1, -1, -1), - m_ColorMatrix(c_IdentifyMatrix) + m_CropMode(CROPMODE_TL), + m_GreyScale(false), + m_ColorMatrix(c_IdentifyMatrix), + m_Flip(RotateNoneFlipNone), + m_Rotate() { SetConfigAttributes(L"Image", L""); - - m_Bitmap = NULL; - m_BitmapTint = NULL; - - m_hBuffer = NULL; - m_Modified.dwHighDateTime = 0; - m_Modified.dwLowDateTime = 0; - - m_NeedsCrop = false; - m_NeedsTinting = false; - m_NeedsTransform = false; - - m_CropMode = CROPMODE_TL; - m_GreyScale = false; - m_Flip = RotateNoneFlipNone; - m_Rotate = 0.0f; } /* @@ -111,6 +106,54 @@ void CTintedImage::DisposeImage() m_Modified.dwLowDateTime = 0; } +/* +** LoadImageFromFileHandle +** +** Loads the image from file handle +** +*/ +bool CTintedImage::LoadImageFromFileHandle(HANDLE fileHandle, Bitmap** pBitmap, HGLOBAL* phBuffer) +{ + DWORD imageSize = GetFileSize(fileHandle, NULL); + + if (imageSize != INVALID_FILE_SIZE) + { + HGLOBAL hBuffer = ::GlobalAlloc(GMEM_MOVEABLE, imageSize); + if (hBuffer) + { + void* pBuffer = ::GlobalLock(hBuffer); + if (pBuffer) + { + DWORD readBytes; + ReadFile(fileHandle, pBuffer, imageSize, &readBytes, NULL); + ::GlobalUnlock(hBuffer); + + IStream* pStream = NULL; + if (::CreateStreamOnHGlobal(hBuffer, FALSE, &pStream) == S_OK) + { + Bitmap* bitmap = Bitmap::FromStream(pStream); + pStream->Release(); + + if (bitmap && Ok == bitmap->GetLastStatus()) + { + *pBitmap = bitmap; + *phBuffer = hBuffer; + return true; + } + else + { + delete bitmap; + } + } + } + + ::GlobalFree(hBuffer); + } + } + + return false; +} + /* ** LoadImage ** @@ -142,112 +185,74 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) if (bLoadAlways || CompareFileTime(&tmpTime, &m_Modified) != 0) { DisposeImage(); - m_Modified = tmpTime; - DWORD imageSize = GetFileSize(fileHandle, NULL); - - if (imageSize != INVALID_FILE_SIZE) + if (LoadImageFromFileHandle(fileHandle, &m_Bitmap, &m_hBuffer)) { - m_hBuffer = ::GlobalAlloc(GMEM_MOVEABLE, imageSize); - if (m_hBuffer) + m_Modified = tmpTime; + + // Check whether the new image needs tinting (or cropping, flipping, rotating) + if (!m_NeedsCrop) { - void* pBuffer = ::GlobalLock(m_hBuffer); - if (pBuffer) + if (m_Crop.Width >= 0 || m_Crop.Height >= 0) { - DWORD readBytes; - ReadFile(fileHandle, pBuffer, imageSize, &readBytes, NULL); - ::GlobalUnlock(m_hBuffer); - - IStream* pStream = NULL; - if (::CreateStreamOnHGlobal(m_hBuffer, FALSE, &pStream) == S_OK) - { - m_Bitmap = Bitmap::FromStream(pStream); - pStream->Release(); - - if (m_Bitmap && Ok == m_Bitmap->GetLastStatus()) - { - // Check whether the new image needs tinting (or cropping, flipping, rotating) - if (!m_NeedsCrop) - { - if (m_Crop.Width >= 0 || m_Crop.Height >= 0) - { - m_NeedsCrop = true; - } - } - if (!m_NeedsTinting) - { - if (m_GreyScale || !CompareColorMatrix(m_ColorMatrix, c_IdentifyMatrix)) - { - m_NeedsTinting = true; - } - } - if (!m_NeedsTransform) - { - if (m_Flip != RotateNoneFlipNone || m_Rotate != 0.0f) - { - m_NeedsTransform = true; - } - } - } - else // failed - { - delete m_Bitmap; - m_Bitmap = NULL; - } - } - } - - if (!m_Bitmap) - { - LogWithArgs(LOG_ERROR, L"Unable to create %s: %s", m_ConfigName.c_str(), filename.c_str()); - DisposeImage(); + m_NeedsCrop = true; } } - else + if (!m_NeedsTinting) { - LogWithArgs(LOG_ERROR, L"Unable to allocate memory ( %i bytes ) for %s: %s", imageSize, m_ConfigName.c_str(), filename.c_str()); + if (m_GreyScale || !CompareColorMatrix(m_ColorMatrix, c_IdentifyMatrix)) + { + m_NeedsTinting = true; + } + } + if (!m_NeedsTransform) + { + if (m_Flip != RotateNoneFlipNone || m_Rotate != 0.0f) + { + m_NeedsTransform = true; + } } } else { - LogWithArgs(LOG_ERROR, L"Unable to get %s's file size: %s", m_ConfigName.c_str(), filename.c_str()); + LogWithArgs(LOG_ERROR, L"Unable to load %s: %s", m_ConfigName.c_str(), filename.c_str()); } } CloseHandle(fileHandle); + + if (m_Bitmap) + { + // We need a copy of the image if has tinting (or flipping, rotating) + if (m_NeedsCrop || m_NeedsTinting || m_NeedsTransform) + { + if (m_BitmapTint) + { + delete m_BitmapTint; + m_BitmapTint = NULL; + } + + if (m_Bitmap->GetWidth() > 0 && m_Bitmap->GetHeight() > 0) + { + ApplyCrop(); + + if (!m_BitmapTint || (m_BitmapTint->GetWidth() > 0 && m_BitmapTint->GetHeight() > 0)) + { + ApplyTint(); + ApplyTransform(); + } + } + + m_NeedsCrop = false; + m_NeedsTinting = false; + m_NeedsTransform = false; + } + } } else { - LogWithArgs(LOG_ERROR, L"Unable to load %s: %s", m_ConfigName.c_str(), filename.c_str()); + LogWithArgs(LOG_ERROR, L"Unable to open %s: %s", m_ConfigName.c_str(), filename.c_str()); DisposeImage(); } - - if (m_Bitmap) - { - // We need a copy of the image if has tinting (or flipping, rotating) - if (m_NeedsCrop || m_NeedsTinting || m_NeedsTransform) - { - if (m_BitmapTint) - { - delete m_BitmapTint; - m_BitmapTint = NULL; - } - - if (m_Bitmap->GetWidth() > 0 && m_Bitmap->GetHeight() > 0) - { - ApplyCrop(); - - if (!m_BitmapTint || (m_BitmapTint->GetWidth() > 0 && m_BitmapTint->GetHeight() > 0)) - { - ApplyTint(); - ApplyTransform(); - } - } - - m_NeedsCrop = false; - m_NeedsTinting = false; - m_NeedsTransform = false; - } - } } else if (IsLoaded()) { diff --git a/Library/TintedImage.h b/Library/TintedImage.h index 3069083c..042280b0 100644 --- a/Library/TintedImage.h +++ b/Library/TintedImage.h @@ -57,6 +57,8 @@ protected: void ApplyTint(); void ApplyTransform(); + static bool LoadImageFromFileHandle(HANDLE fileHandle, Gdiplus::Bitmap** pBitmap, HGLOBAL* phBuffer); + static Gdiplus::Bitmap* TurnGreyscale(Gdiplus::Bitmap* source); static bool CompareColorMatrix(const Gdiplus::ColorMatrix& a, const Gdiplus::ColorMatrix& b); diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 5ccd0045..381f38f2 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -38,8 +38,14 @@ extern CRainmeter* Rainmeter; using namespace Gdiplus; CTrayWindow::CTrayWindow(HINSTANCE instance) : m_Instance(instance), + m_TrayIcon(), + m_Measure(), + m_MeterType(TRAY_METER_TYPE_HISTOGRAM), m_TrayColor1(0, 100, 0), - m_TrayColor2(0, 255, 0) + m_TrayColor2(0, 255, 0), + m_Bitmap(), + m_TrayValues(), + m_TrayPos() { WNDCLASS wc; @@ -70,21 +76,11 @@ CTrayWindow::CTrayWindow(HINSTANCE instance) : m_Instance(instance), instance, this); - m_Measure = NULL; - m_TrayIcon = NULL; - - m_MeterType = TRAY_METER_TYPE_HISTOGRAM; - - m_Bitmap = NULL; - #ifndef _WIN64 SetWindowLong(m_Window, GWL_USERDATA, magicDWord); #endif SetWindowPos(m_Window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING); - - m_TrayPos = 0; - memset(m_TrayValues, 0, sizeof(double) * TRAYICON_SIZE); } CTrayWindow::~CTrayWindow() diff --git a/Library/lua/LuaScript.cpp b/Library/lua/LuaScript.cpp index b600311f..52340828 100644 --- a/Library/lua/LuaScript.cpp +++ b/Library/lua/LuaScript.cpp @@ -3,14 +3,10 @@ #include "LuaManager.h" #include "../Rainmeter.h" -LuaScript::LuaScript(lua_State* p_pState, const char* p_strFile, const char* p_strTableName) : - m_pState(p_pState) +LuaScript::LuaScript(lua_State* p_pState, const char* p_strFile, const char* p_strTableName) : m_pState(p_pState), m_strTableName(_strdup(p_strTableName)), + m_bInitialized(true) { - m_bInitialized = true; - int result = luaL_loadfile(m_pState, p_strFile); - - m_strTableName = _strdup(p_strTableName); // If the file loaded okay. if(result == 0)