2009-02-10 18:37:48 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2001 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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __METERSTRING_H__
|
|
|
|
#define __METERSTRING_H__
|
|
|
|
|
|
|
|
#include "Meter.h"
|
2011-01-19 15:31:45 +00:00
|
|
|
#include "Measure.h"
|
2011-02-18 16:26:58 +00:00
|
|
|
#include <unordered_map>
|
2010-09-21 22:47:53 +00:00
|
|
|
|
2013-05-31 14:18:52 +00:00
|
|
|
class MeterString : public Meter
|
2009-02-10 18:37:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-05-31 14:18:52 +00:00
|
|
|
MeterString(MeterWindow* meterWindow, const WCHAR* name);
|
|
|
|
virtual ~MeterString();
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2013-05-31 14:18:52 +00:00
|
|
|
virtual UINT GetTypeID() { return TypeID<MeterString>(); }
|
2012-04-09 16:45:54 +00:00
|
|
|
|
2009-02-10 18:37:48 +00:00
|
|
|
virtual int GetX(bool abs = false);
|
2012-05-16 18:02:31 +00:00
|
|
|
virtual int GetY(bool abs = false);
|
2009-02-10 18:37:48 +00:00
|
|
|
|
|
|
|
virtual void Initialize();
|
|
|
|
virtual bool Update();
|
2010-12-12 17:08:36 +00:00
|
|
|
void SetText(const WCHAR* text) { m_Text = text; }
|
2013-03-25 15:42:18 +00:00
|
|
|
virtual bool Draw(Gfx::Canvas& canvas);
|
2010-12-12 17:08:36 +00:00
|
|
|
Gdiplus::RectF GetRect() { return m_Rect; }
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2010-03-20 19:40:30 +00:00
|
|
|
static void EnumerateInstalledFontFamilies();
|
2009-10-07 16:45:14 +00:00
|
|
|
|
2012-11-12 02:10:40 +00:00
|
|
|
static void InitializeStatic();
|
|
|
|
static void FinalizeStatic();
|
|
|
|
|
2011-11-26 02:49:52 +00:00
|
|
|
protected:
|
2013-05-31 14:18:52 +00:00
|
|
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
|
|
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
2011-11-26 02:49:52 +00:00
|
|
|
|
2012-08-04 23:15:56 +00:00
|
|
|
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
|
2012-08-03 23:18:12 +00:00
|
|
|
|
2009-02-10 18:37:48 +00:00
|
|
|
private:
|
|
|
|
enum TEXTSTYLE
|
|
|
|
{
|
|
|
|
NORMAL,
|
|
|
|
BOLD,
|
|
|
|
ITALIC,
|
|
|
|
BOLDITALIC
|
|
|
|
};
|
|
|
|
|
2009-07-29 12:54:05 +00:00
|
|
|
enum TEXTEFFECT
|
|
|
|
{
|
|
|
|
EFFECT_NONE,
|
|
|
|
EFFECT_SHADOW,
|
|
|
|
EFFECT_BORDER
|
|
|
|
};
|
|
|
|
|
2010-03-18 19:48:14 +00:00
|
|
|
enum TEXTCASE
|
|
|
|
{
|
|
|
|
TEXTCASE_NONE,
|
|
|
|
TEXTCASE_UPPER,
|
|
|
|
TEXTCASE_LOWER,
|
2011-01-24 10:15:05 +00:00
|
|
|
TEXTCASE_PROPER
|
2010-03-18 19:48:14 +00:00
|
|
|
};
|
|
|
|
|
2013-01-23 18:57:01 +00:00
|
|
|
enum CLIPTYPE
|
|
|
|
{
|
|
|
|
CLIP_OFF,
|
|
|
|
CLIP_ON,
|
|
|
|
CLIP_AUTO
|
|
|
|
};
|
|
|
|
|
2013-03-25 15:42:18 +00:00
|
|
|
bool DrawString(Gfx::Canvas& canvas, Gdiplus::RectF* rect);
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2012-05-20 17:57:12 +00:00
|
|
|
Gdiplus::Color m_Color;
|
|
|
|
Gdiplus::Color m_EffectColor;
|
2012-07-03 13:57:46 +00:00
|
|
|
std::wstring m_Postfix;
|
|
|
|
std::wstring m_Prefix;
|
2012-05-20 17:57:12 +00:00
|
|
|
std::wstring m_Text;
|
|
|
|
std::wstring m_FontFace;
|
|
|
|
AUTOSCALE m_AutoScale;
|
|
|
|
TEXTSTYLE m_Style;
|
|
|
|
TEXTEFFECT m_Effect;
|
|
|
|
TEXTCASE m_Case;
|
|
|
|
int m_FontSize;
|
|
|
|
double m_Scale;
|
|
|
|
bool m_NoDecimals;
|
|
|
|
bool m_Percentual;
|
2013-01-23 18:57:01 +00:00
|
|
|
CLIPTYPE m_ClipType;
|
|
|
|
bool m_NeedsClipping;
|
|
|
|
int m_ClipStringW;
|
|
|
|
int m_ClipStringH;
|
2013-03-25 15:42:18 +00:00
|
|
|
Gfx::TextFormat* m_TextFormat;
|
2012-05-20 17:57:12 +00:00
|
|
|
int m_NumOfDecimals;
|
2009-02-10 18:37:48 +00:00
|
|
|
Gdiplus::REAL m_Angle;
|
2010-12-12 17:08:36 +00:00
|
|
|
Gdiplus::RectF m_Rect;
|
2009-02-10 18:37:48 +00:00
|
|
|
|
|
|
|
std::wstring m_String;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|