Added ImagePath to all meters with general image options. This deprecates the Path option for Image meters.

Also fixes bug in MeterHistogram that crashes Rainmeter when the PrimaryImage is invalid.
Note: For Histogram the option is called PrimaryImagePath, SecondaryImagePath, and BothImagePath
This commit is contained in:
Brian Ferguson
2013-06-07 13:35:36 -06:00
parent c6ec9093b7
commit 136689bcfb
9 changed files with 54 additions and 65 deletions

View File

@ -22,6 +22,7 @@
#include <windows.h>
#include <gdiplus.h>
#include <string>
#include "MeterWindow.h"
/*
** Helper macro to define an array of option names. A prefix must be given.
@ -40,7 +41,8 @@
prefix L"ColorMatrix5", \
prefix L"ImageFlip", \
prefix L"ImageRotate", \
prefix L"UseExifOrientation" \
prefix L"UseExifOrientation", \
prefix L"ImagePath" \
};
class ConfigParser;
@ -62,14 +64,15 @@ public:
OptionIndexImageFlip,
OptionIndexImageRotate,
OptionIndexUseExifOrientation,
OptionIndexImagePath,
OptionCount
};
TintedImage(const WCHAR* name = L"Image", const WCHAR** optionArray = c_DefaultOptionArray, bool disableTransform = false);
TintedImage(const WCHAR* name = L"ImageName", const WCHAR** optionArray = c_DefaultOptionArray, bool disableTransform = false, MeterWindow* meterWindow = nullptr);
~TintedImage();
void ReadOptions(ConfigParser& parser, const WCHAR* section);
void ReadOptions(ConfigParser& parser, const WCHAR* section, const WCHAR* imagePath = L"");
bool IsLoaded() { return (m_Bitmap != nullptr); }
bool IsTinted() { return (m_BitmapTint != nullptr); }
@ -120,9 +123,12 @@ protected:
Gdiplus::RotateFlipType m_Flip;
Gdiplus::REAL m_Rotate;
bool m_UseExifOrientation;
std::wstring m_Path;
std::wstring m_CacheKey;
MeterWindow* m_MeterWindow;
static const Gdiplus::ColorMatrix c_GreyScaleMatrix;
static const Gdiplus::ColorMatrix c_IdentityMatrix;