From bb22e7b2a0af67cc65ce5179917b20e5977ed4ef Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Wed, 11 Jul 2012 17:09:09 +0000 Subject: MyDetails reverted to older version that doesn't use Skins plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@905 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Skins/SkinLib/FontState.cpp | 186 ------------------------------------ 1 file changed, 186 deletions(-) delete mode 100644 plugins/Skins/SkinLib/FontState.cpp (limited to 'plugins/Skins/SkinLib/FontState.cpp') diff --git a/plugins/Skins/SkinLib/FontState.cpp b/plugins/Skins/SkinLib/FontState.cpp deleted file mode 100644 index da9b4153d5..0000000000 --- a/plugins/Skins/SkinLib/FontState.cpp +++ /dev/null @@ -1,186 +0,0 @@ -#include "globals.h" -#include "FontState.h" - - -FontState::FontState(HFONT hFont, COLORREF aColor) : hFont(NULL), externalFont(false), color(aColor) -{ - setHFONT(hFont); -} - -FontState::~FontState() -{ - releaseHFONT(); -} - -void FontState::rebuildHFONT() -{ - releaseHFONT(); - buildHFONT(); -} - -void FontState::buildAttribs() -{ - LOGFONT lf = {0}; - if (hFont == NULL || GetObject(hFont, sizeof(lf), &lf) == 0) - { - face = _T("Tahoma"); - size = 9; - italic = false; - bold = false; - underline = false; - strikeout = false; - - rebuildHFONT(); - - return; - } - - face = lf.lfFaceName; - italic = (lf.lfItalic != 0); - bold = (lf.lfWeight > FW_NORMAL); - underline = (lf.lfUnderline != 0); - strikeout = (lf.lfStrikeOut != 0); - - HDC hdc = GetDC(NULL); - size = -MulDiv(lf.lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); - ReleaseDC(NULL, hdc); -} - -void FontState::buildHFONT() -{ - if (hFont != NULL) - return; - - LOGFONT lf; - - _tcscpy(lf.lfFaceName, getFace()); - - lf.lfWidth = lf.lfEscapement = lf.lfOrientation = 0; - lf.lfWeight = isBold() ? FW_BOLD : FW_NORMAL; - lf.lfItalic = isItalic() ? 1 : 0; - lf.lfUnderline = isUnderline() ? 1 : 0; - lf.lfStrikeOut = isStrikeOut() ? 1 : 0; - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfOutPrecision = OUT_DEFAULT_PRECIS; - lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; - lf.lfQuality = DEFAULT_QUALITY; - lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - - HDC hdc = GetDC(NULL); - lf.lfHeight = -MulDiv(getSize(), GetDeviceCaps(hdc, LOGPIXELSY), 72); - ReleaseDC(NULL, hdc); - - hFont = CreateFontIndirect(&lf); - externalFont = false; -} - -void FontState::releaseHFONT() -{ - if (hFont == NULL) - return; - - if (!externalFont) - DeleteObject(hFont); - - hFont = NULL; -} - - -HFONT FontState::getHFONT() const -{ - return hFont; -} - - -HFONT FontState::createHFONT() const -{ - LOGFONT lf; - if (hFont == NULL || GetObject(hFont, sizeof(lf), &lf) == 0) - return NULL; - else - return CreateFontIndirect(&lf); -} - -void FontState::setHFONT(HFONT hFont) -{ - releaseHFONT(); - this->hFont = hFont; - externalFont = true; - buildAttribs(); -} - -const TCHAR * FontState::getFace() const -{ - return face.c_str(); -} - -void FontState::setFace(const TCHAR * face) -{ - this->face = face; - rebuildHFONT(); -} - -int FontState::getSize() const -{ - return size; -} - -void FontState::setSize(int size) -{ - this->size = size; - rebuildHFONT(); -} - -COLORREF FontState::getColor() const -{ - return color; -} - -void FontState::setColor(COLORREF color) -{ - this->color = color; -} - -bool FontState::isItalic() const -{ - return italic; -} - -void FontState::setItalic(bool italic) -{ - this->italic = italic; - rebuildHFONT(); -} - -bool FontState::isBold() const -{ - return bold; -} - -void FontState::setBold(bool bold) -{ - this->bold = bold; - rebuildHFONT(); -} - -bool FontState::isUnderline() const -{ - return underline; -} - -void FontState::setUnderline(bool underline) -{ - this->underline = underline; - rebuildHFONT(); -} - -bool FontState::isStrikeOut() const -{ - return strikeout; -} - -void FontState::setStrikeOut(bool strikeout) -{ - this->strikeout = strikeout; - rebuildHFONT(); -} -- cgit v1.2.3