2009-02-10 18:37:48 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2002 Kimmo Pekkola
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2012-01-23 06:36:15 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-02-10 18:37:48 +00:00
|
|
|
*/
|
|
|
|
|
2009-10-07 16:45:14 +00:00
|
|
|
#include "StdAfx.h"
|
2009-02-10 18:37:48 +00:00
|
|
|
#include "MeterImage.h"
|
|
|
|
#include "Measure.h"
|
|
|
|
#include "Error.h"
|
|
|
|
#include "Rainmeter.h"
|
2011-11-05 09:01:06 +00:00
|
|
|
#include "System.h"
|
2013-06-12 18:14:55 +00:00
|
|
|
#include "../Common/PathUtil.h"
|
2013-03-25 15:42:18 +00:00
|
|
|
#include "../Common/Gfx/Canvas.h"
|
2009-02-10 18:37:48 +00:00
|
|
|
|
|
|
|
using namespace Gdiplus;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** The constructor
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
MeterImage::MeterImage(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
2013-06-07 19:35:36 +00:00
|
|
|
m_Image(L"ImageName", nullptr, false, meterWindow),
|
2011-07-27 14:18:02 +00:00
|
|
|
m_NeedsRedraw(false),
|
2012-08-17 17:20:25 +00:00
|
|
|
m_DrawMode(DRAWMODE_NONE),
|
2011-01-29 00:11:01 +00:00
|
|
|
m_ScaleMargins()
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** The destructor
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
MeterImage::~MeterImage()
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Load the image and get the dimensions of the meter from it.
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
void MeterImage::Initialize()
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2013-05-31 14:18:52 +00:00
|
|
|
Meter::Initialize();
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2012-07-17 07:37:53 +00:00
|
|
|
if (m_Measures.empty() && !m_DynamicVariables && !m_ImageName.empty())
|
2010-12-05 15:34:37 +00:00
|
|
|
{
|
2013-06-17 12:05:31 +00:00
|
|
|
m_ImageNameResult = m_ImageName;
|
2013-06-07 19:35:36 +00:00
|
|
|
LoadImage(m_ImageName, true);
|
2010-12-05 15:34:37 +00:00
|
|
|
}
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Loads the image from disk
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
void MeterImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2010-12-05 15:34:37 +00:00
|
|
|
m_Image.LoadImage(imageName, bLoadAlways);
|
2010-11-27 19:53:23 +00:00
|
|
|
|
|
|
|
if (m_Image.IsLoaded())
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2010-11-27 19:53:23 +00:00
|
|
|
// Calculate size of the meter
|
|
|
|
Bitmap* bitmap = m_Image.GetImage();
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2010-11-27 19:53:23 +00:00
|
|
|
int imageW = bitmap->GetWidth();
|
|
|
|
int imageH = bitmap->GetHeight();
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2011-11-01 04:56:46 +00:00
|
|
|
if (m_WDefined)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2011-11-01 04:56:46 +00:00
|
|
|
if (!m_HDefined)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2012-08-17 17:20:25 +00:00
|
|
|
m_H = (imageW == 0) ? 0 : (m_DrawMode == DRAWMODE_TILE) ? imageH : m_W * imageH / imageW;
|
2013-07-20 16:07:51 +00:00
|
|
|
m_H += GetHeightPadding();
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-01 04:56:46 +00:00
|
|
|
if (m_HDefined)
|
2010-02-24 14:58:35 +00:00
|
|
|
{
|
2012-08-17 17:20:25 +00:00
|
|
|
m_W = (imageH == 0) ? 0 : (m_DrawMode == DRAWMODE_TILE) ? imageW : m_H * imageW / imageH;
|
2013-07-20 16:07:51 +00:00
|
|
|
m_W += GetWidthPadding();
|
2009-08-28 07:42:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-20 16:07:51 +00:00
|
|
|
m_W = imageW + GetWidthPadding();
|
|
|
|
m_H = imageH + GetHeightPadding();
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-02-24 14:58:35 +00:00
|
|
|
}
|
|
|
|
|
2009-02-10 18:37:48 +00:00
|
|
|
/*
|
2012-06-01 13:06:36 +00:00
|
|
|
** Read the options specified in the ini file.
|
2009-02-10 18:37:48 +00:00
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
void MeterImage::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2013-05-31 14:18:52 +00:00
|
|
|
Meter::ReadOptions(parser, section);
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2010-12-05 15:34:37 +00:00
|
|
|
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2012-08-17 17:20:25 +00:00
|
|
|
int mode = parser.ReadInt(section, L"Tile", 0);
|
|
|
|
if (mode != 0)
|
|
|
|
{
|
|
|
|
m_DrawMode = DRAWMODE_TILE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mode = parser.ReadInt(section, L"PreserveAspectRatio", 0);
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_DrawMode = DRAWMODE_NONE;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
default:
|
|
|
|
m_DrawMode = DRAWMODE_KEEPRATIO;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_DrawMode = DRAWMODE_KEEPRATIOANDCROP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-08-28 07:42:28 +00:00
|
|
|
|
2010-12-13 08:19:45 +00:00
|
|
|
static const RECT defMargins = {0};
|
|
|
|
m_ScaleMargins = parser.ReadRECT(section, L"ScaleMargins", defMargins);
|
|
|
|
|
2013-06-07 19:35:36 +00:00
|
|
|
// Deprecated!
|
|
|
|
std::wstring path = parser.ReadString(section, L"Path", L"");
|
2013-06-12 18:14:55 +00:00
|
|
|
PathUtil::AppendBacklashIfMissing(path);
|
2013-06-07 19:35:36 +00:00
|
|
|
|
2012-06-01 13:06:36 +00:00
|
|
|
// Read tinting options
|
2013-06-07 19:35:36 +00:00
|
|
|
m_Image.ReadOptions(parser, section, path.c_str());
|
2011-07-27 14:18:02 +00:00
|
|
|
|
2012-07-17 07:37:53 +00:00
|
|
|
if (m_Initialized && m_Measures.empty() && !m_DynamicVariables)
|
2011-07-27 14:18:02 +00:00
|
|
|
{
|
|
|
|
Initialize();
|
|
|
|
m_NeedsRedraw = true;
|
|
|
|
}
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Updates the value(s) from the measures.
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
bool MeterImage::Update()
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2013-05-31 14:18:52 +00:00
|
|
|
if (Meter::Update())
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2012-07-17 07:37:53 +00:00
|
|
|
if (!m_Measures.empty() || m_DynamicVariables)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2010-12-05 15:34:37 +00:00
|
|
|
// Store the current values so we know if the image needs to be updated
|
2013-06-17 12:05:31 +00:00
|
|
|
std::wstring oldResult = m_ImageNameResult;
|
2010-12-05 15:34:37 +00:00
|
|
|
|
2012-07-17 07:37:53 +00:00
|
|
|
if (!m_Measures.empty()) // read from the measures
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2010-12-05 15:34:37 +00:00
|
|
|
if (m_ImageName.empty())
|
2009-09-07 16:37:58 +00:00
|
|
|
{
|
2013-06-17 12:05:31 +00:00
|
|
|
m_ImageNameResult = m_Measures[0]->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, 0, false);
|
2009-09-07 16:37:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-17 12:05:31 +00:00
|
|
|
m_ImageNameResult = m_ImageName;
|
|
|
|
if (!ReplaceMeasures(m_ImageNameResult, AUTOSCALE_OFF))
|
2010-12-05 15:34:37 +00:00
|
|
|
{
|
|
|
|
// ImageName doesn't contain any measures, so use the result of MeasureName.
|
2013-06-17 12:05:31 +00:00
|
|
|
m_ImageNameResult = m_Measures[0]->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, 0, false);
|
2010-12-05 15:34:37 +00:00
|
|
|
}
|
2009-09-07 16:37:58 +00:00
|
|
|
}
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
2013-06-17 11:57:50 +00:00
|
|
|
else // read from the skin
|
|
|
|
{
|
2013-06-17 12:05:31 +00:00
|
|
|
m_ImageNameResult = m_ImageName;
|
2013-06-17 11:57:50 +00:00
|
|
|
}
|
2013-06-07 19:35:36 +00:00
|
|
|
|
2013-06-17 12:05:31 +00:00
|
|
|
LoadImage(m_ImageNameResult, (wcscmp(oldResult.c_str(), m_ImageNameResult.c_str()) != 0));
|
2009-09-07 16:37:58 +00:00
|
|
|
return true;
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
2011-07-27 14:18:02 +00:00
|
|
|
else if (m_NeedsRedraw)
|
|
|
|
{
|
|
|
|
m_NeedsRedraw = false;
|
|
|
|
return true;
|
|
|
|
}
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Draws the meter on the double buffer
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
bool MeterImage::Draw(Gfx::Canvas& canvas)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2013-05-31 14:18:52 +00:00
|
|
|
if (!Meter::Draw(canvas)) return false;
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2010-11-27 19:53:23 +00:00
|
|
|
if (m_Image.IsLoaded())
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
|
|
|
// Copy the image over the doublebuffer
|
2010-11-27 19:53:23 +00:00
|
|
|
Bitmap* drawBitmap = m_Image.GetImage();
|
|
|
|
|
2010-02-24 14:58:35 +00:00
|
|
|
int imageW = drawBitmap->GetWidth();
|
|
|
|
int imageH = drawBitmap->GetHeight();
|
2009-08-28 07:42:28 +00:00
|
|
|
|
2010-12-04 15:07:28 +00:00
|
|
|
if (imageW == 0 || imageH == 0 || m_W == 0 || m_H == 0) return true;
|
2009-08-28 07:42:28 +00:00
|
|
|
|
2013-07-20 16:07:51 +00:00
|
|
|
Gdiplus::Rect meterRect = GetMeterRectPadding();
|
2009-08-28 07:42:28 +00:00
|
|
|
|
2013-07-20 16:07:51 +00:00
|
|
|
int drawW = meterRect.Width;
|
|
|
|
int drawH = meterRect.Height;
|
2009-08-28 07:42:28 +00:00
|
|
|
|
2011-05-25 21:48:59 +00:00
|
|
|
if (drawW == imageW && drawH == imageH &&
|
2011-10-31 07:42:18 +00:00
|
|
|
m_ScaleMargins.left == 0 && m_ScaleMargins.top == 0 && m_ScaleMargins.right == 0 && m_ScaleMargins.bottom == 0)
|
2011-05-25 21:48:59 +00:00
|
|
|
{
|
2013-07-20 16:07:51 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, Rect(meterRect.X, meterRect.Y, drawW, drawH), Rect(0, 0, imageW, imageH));
|
2011-05-25 21:48:59 +00:00
|
|
|
}
|
2012-08-17 17:20:25 +00:00
|
|
|
else if (m_DrawMode == DRAWMODE_TILE)
|
2010-12-04 15:07:28 +00:00
|
|
|
{
|
2013-03-25 15:42:18 +00:00
|
|
|
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
|
|
|
|
2010-12-13 08:19:45 +00:00
|
|
|
ImageAttributes imgAttr;
|
2010-12-04 15:07:28 +00:00
|
|
|
imgAttr.SetWrapMode(WrapModeTile);
|
2010-12-13 08:19:45 +00:00
|
|
|
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X, meterRect.Y, drawW, drawH);
|
2010-12-13 08:19:45 +00:00
|
|
|
graphics.DrawImage(drawBitmap, r, 0, 0, drawW, drawH, UnitPixel, &imgAttr);
|
2013-03-25 15:42:18 +00:00
|
|
|
|
|
|
|
canvas.EndGdiplusContext();
|
2009-08-28 07:42:28 +00:00
|
|
|
}
|
2012-08-17 17:20:25 +00:00
|
|
|
else if (m_DrawMode == DRAWMODE_KEEPRATIO || m_DrawMode == DRAWMODE_KEEPRATIOANDCROP)
|
2009-08-28 07:42:28 +00:00
|
|
|
{
|
2012-08-17 17:20:25 +00:00
|
|
|
int cropX = 0;
|
|
|
|
int cropY = 0;
|
|
|
|
int cropW = imageW;
|
|
|
|
int cropH = imageH;
|
|
|
|
|
2011-11-01 04:56:46 +00:00
|
|
|
if (m_WDefined && m_HDefined)
|
2010-12-04 15:07:28 +00:00
|
|
|
{
|
|
|
|
REAL imageRatio = imageW / (REAL)imageH;
|
2013-07-20 16:07:51 +00:00
|
|
|
REAL meterRatio = meterRect.Width / (REAL)meterRect.Height;
|
2010-12-04 15:07:28 +00:00
|
|
|
|
2012-08-17 17:20:25 +00:00
|
|
|
if (imageRatio != meterRatio)
|
2010-12-04 15:07:28 +00:00
|
|
|
{
|
2012-08-17 17:20:25 +00:00
|
|
|
if (m_DrawMode == DRAWMODE_KEEPRATIO)
|
|
|
|
{
|
|
|
|
if (imageRatio > meterRatio)
|
|
|
|
{
|
2013-07-20 16:07:51 +00:00
|
|
|
drawH = meterRect.Width * imageH / imageW;
|
|
|
|
meterRect.Y += (meterRect.Height - drawH) / 2;
|
2012-08-17 17:20:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-20 16:07:51 +00:00
|
|
|
drawW = meterRect.Height * imageW / imageH;
|
|
|
|
meterRect.X += (meterRect.Width - drawW) / 2;
|
2012-08-17 17:20:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (imageRatio > meterRatio)
|
|
|
|
{
|
|
|
|
cropW = (int)(imageH * meterRatio);
|
|
|
|
cropX = (imageW - cropW) / 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cropH = (int)(imageW / meterRatio);
|
|
|
|
cropY = (imageH - cropH) / 2;
|
|
|
|
}
|
|
|
|
}
|
2010-12-04 15:07:28 +00:00
|
|
|
}
|
|
|
|
}
|
2010-12-13 08:19:45 +00:00
|
|
|
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X, meterRect.Y, drawW, drawH);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(cropX, cropY, cropW, cropH));
|
2009-08-28 07:42:28 +00:00
|
|
|
}
|
2010-12-13 08:19:45 +00:00
|
|
|
else
|
|
|
|
{
|
2013-03-25 15:42:18 +00:00
|
|
|
const RECT& m = m_ScaleMargins;
|
2010-12-13 08:19:45 +00:00
|
|
|
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.top > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.left > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
|
|
|
// Top-Left
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X, meterRect.Y, m.left, m.top);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(0, 0, m.left, m.top));
|
2010-12-13 08:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Top
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X + m.left, meterRect.Y, drawW - m.left - m.right, m.top);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(m.left, 0, imageW - m.left - m.right, m.top));
|
2010-12-13 08:19:45 +00:00
|
|
|
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.right > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
|
|
|
// Top-Right
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X + drawW - m.right, meterRect.Y, m.right, m.top);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(imageW - m.right, 0, m.right, m.top));
|
2010-12-13 08:19:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.left > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
|
|
|
// Left
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X, meterRect.Y + m.top, m.left, drawH - m.top - m.bottom);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(0, m.top, m.left, imageH - m.top - m.bottom));
|
2010-12-13 08:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Center
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X + m.left, meterRect.Y + m.top, drawW - m.left - m.right, drawH - m.top - m.bottom);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(m.left, m.top, imageW - m.left - m.right, imageH - m.top - m.bottom));
|
2010-12-13 08:19:45 +00:00
|
|
|
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.right > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
|
|
|
// Right
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X + drawW - m.right, meterRect.Y + m.top, m.right, drawH - m.top - m.bottom);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(imageW - m.right, m.top, m.right, imageH - m.top - m.bottom));
|
2010-12-13 08:19:45 +00:00
|
|
|
}
|
2011-03-29 19:21:57 +00:00
|
|
|
|
|
|
|
if (m.bottom > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.left > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
|
|
|
// Bottom-Left
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X, meterRect.Y + drawH - m.bottom, m.left, m.bottom);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(0, imageH - m.bottom, m.left, m.bottom));
|
2010-12-13 08:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bottom
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X + m.left, meterRect.Y + drawH - m.bottom, drawW - m.left - m.right, m.bottom);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(m.left, imageH - m.bottom, imageW - m.left - m.right, m.bottom));
|
2009-08-28 07:42:28 +00:00
|
|
|
|
2011-03-29 19:21:57 +00:00
|
|
|
if (m.right > 0)
|
2010-12-13 08:19:45 +00:00
|
|
|
{
|
|
|
|
// Bottom-Right
|
2013-07-20 16:07:51 +00:00
|
|
|
Rect r(meterRect.X + drawW - m.right, meterRect.Y + drawH - m.bottom, m.right, m.bottom);
|
2013-03-25 15:42:18 +00:00
|
|
|
canvas.DrawBitmap(drawBitmap, r, Rect(imageW - m.right, imageH - m.bottom, m.right, m.bottom));
|
2010-12-13 08:19:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Overridden method. The Image meters need not to be bound on anything
|
|
|
|
**
|
|
|
|
*/
|
2013-05-31 14:18:52 +00:00
|
|
|
void MeterImage::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2012-07-17 07:37:53 +00:00
|
|
|
if (BindPrimaryMeasure(parser, section, true))
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
2012-07-17 07:37:53 +00:00
|
|
|
BindSecondaryMeasures(parser, section);
|
2009-02-10 18:37:48 +00:00
|
|
|
}
|
|
|
|
}
|