mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Fixed that r716 (precompiled header) doesn't work on x64.
- Now uses constructor initialization list in each class. - TintedImage: Code cleanup.
This commit is contained in:
parent
fdae154245
commit
7ea3a762ac
@ -34,9 +34,11 @@ stdext::hash_map<std::wstring, std::wstring> 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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1522,6 +1522,7 @@
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4351"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;LIBRARY_EXPORTS"
|
||||
UsePrecompiledHeader="2"
|
||||
@ -1532,6 +1533,7 @@
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4351"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;LIBRARY_EXPORTS"
|
||||
UsePrecompiledHeader="2"
|
||||
@ -2045,6 +2047,7 @@
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4351"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;LIBRARY_EXPORTS"
|
||||
UsePrecompiledHeader="2"
|
||||
@ -2055,6 +2058,7 @@
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4351"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;LIBRARY_EXPORTS"
|
||||
UsePrecompiledHeader="2"
|
||||
@ -2586,6 +2590,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -2612,6 +2618,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -2638,6 +2646,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -2664,6 +2674,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -2690,6 +2702,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -2716,6 +2730,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -2742,6 +2758,8 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/wd4800"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="../../StdAfx.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -25,9 +25,9 @@
|
||||
** The constructor
|
||||
**
|
||||
*/
|
||||
CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow)
|
||||
CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow),
|
||||
m_Total(false)
|
||||
{
|
||||
m_Total = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -25,9 +25,9 @@
|
||||
** The constructor
|
||||
**
|
||||
*/
|
||||
CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow)
|
||||
CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow),
|
||||
m_Total(false)
|
||||
{
|
||||
m_Total = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -25,9 +25,9 @@
|
||||
** The constructor
|
||||
**
|
||||
*/
|
||||
CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow)
|
||||
CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow),
|
||||
m_Total(false)
|
||||
{
|
||||
m_Total = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user