summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/themes.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-09-01 15:18:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-09-01 15:18:56 +0000
commitc16bd3d58396036f078282ad0b7032562c0c0533 (patch)
tree28a330ad3bd8ba85a20cd2b9a18d5186a0861e66 /plugins/TabSRMM/src/themes.cpp
parent1b9f36054bddeef87d4f9c139877d28c4e6b1702 (diff)
- adaptation for the kernel strdel();
- buffer overrun removed (rare crashes); - old useless code removed; - removal of a blank line after comments was a bad idea git-svn-id: http://svn.miranda-ng.org/main/trunk@15136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/themes.cpp')
-rw-r--r--plugins/TabSRMM/src/themes.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index ba9625a4ab..6cefdcfa98 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -619,6 +619,7 @@ void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ub
// @param rc RECT *: client rectangle inside the target DC.
// @param fIgnoreGlyph: bool: will ignore any glyph item. Set it to true when
// using this function from _outside_ a skin
+
void __fastcall CImageItem::Render(const HDC hdc, const RECT *rc, bool fIgnoreGlyph) const
{
BYTE l = m_bLeft, r = m_bRight, t = m_bTop, b = m_bBottom;
@@ -793,6 +794,7 @@ void CImageItem::Create(const TCHAR *szImageFile)
//
// @return char*: full path and filename to the .png image which represents this image item.
// caller MUST delete it.
+
TCHAR* CImageItem::Read(const TCHAR *szFilename)
{
TCHAR buffer[501];
@@ -882,6 +884,7 @@ TCHAR* CImageItem::Read(const TCHAR *szFilename)
/////////////////////////////////////////////////////////////////////////////////////////
// Free all resources allocated by an image item
+
void CImageItem::Free()
{
if (m_hdc) {
@@ -903,6 +906,7 @@ void CImageItem::Free()
// @param hBitmap bitmap handle
// @param bAlpha new alpha value (0 -> fully transparent, 255 -> opaque)
// default value is 255
+
void CImageItem::SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha)
{
BITMAP bmp;
@@ -994,6 +998,7 @@ void CImageItem::Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha
/////////////////////////////////////////////////////////////////////////////////////////
// load PNG image using core service(advaimg)
+
HBITMAP TSAPI CImageItem::LoadPNG(const TCHAR *szFilename)
{
HBITMAP hBitmap = 0;
@@ -1006,6 +1011,7 @@ HBITMAP TSAPI CImageItem::LoadPNG(const TCHAR *szFilename)
// called on:
// ) init
// ) manual loading on user's request
+
void CSkin::setFileName()
{
DBVARIANT dbv;
@@ -1021,6 +1027,7 @@ void CSkin::setFileName()
/////////////////////////////////////////////////////////////////////////////////////////
// initialize the skin object
+
void CSkin::Init(bool fStartup)
{
m_ImageItems = 0;
@@ -1046,6 +1053,7 @@ void CSkin::Init(bool fStartup)
// throws a warning to close all message windows before a skin can
// be loaded. user can cancel it
// @return: bool: true if windows were closed (or none was open) -> skin can be loaded
+
bool CSkin::warnToClose() const
{
if (::pFirstContainer == NULL)
@@ -1064,6 +1072,7 @@ bool CSkin::warnToClose() const
// mir_free the aero tab bitmaps
// only called on exit, NOT when a skin is unloaded as these elements
// are always needed (even without a skin)
+
void CSkin::UnloadAeroTabs()
{
if (m_tabTop) {
@@ -1097,6 +1106,7 @@ void CSkin::UnloadAeroTabs()
// Called when:
// * user unloads the skin from the dialog box
// * a new skin is loaded by user's request.
+
void CSkin::Unload()
{
// do nothing when user decides to not close any window
@@ -1213,6 +1223,7 @@ void CSkin::LoadIcon(const TCHAR *szSection, const TCHAR *name, HICON &hIcon)
// @param id int: zero-based index into the table of predefined skin items
// @param szItem char *: the section name in the ini file which holds the definition for this
// item.
+
void CSkin::ReadItem(const int id, const TCHAR *szItem)
{
TCHAR buffer[512];
@@ -1279,6 +1290,7 @@ void CSkin::ReadItem(const int id, const TCHAR *szItem)
// The real work is done by the CImageItem::Read().
//
// @param itemname char *: image item name, also section name in the .tsk file
+
void CSkin::ReadImageItem(const TCHAR *itemname)
{
TCHAR buffer[512], szItemNr[30];
@@ -1340,6 +1352,7 @@ void CSkin::ReadImageItem(const TCHAR *itemname)
// It reads and initializes all static values for the skin. Afterwards
// it calls ReadItems() to read additional skin information like image items,
// buttons and icons.
+
void CSkin::Load(void)
{
if (warnToClose() == false)
@@ -1507,6 +1520,7 @@ void CSkin::Load(void)
/////////////////////////////////////////////////////////////////////////////////////////
// Load additional skin items (like image items, buttons, icons etc.)
// This is called AFTER ReadItems() has read the basic skin items
+
void CSkin::LoadItems()
{
TCHAR *szSections = NULL;
@@ -1574,6 +1588,7 @@ void CSkin::LoadItems()
// ) icons change (via ico lib service)
//
// @param fDeleteOnly: only delete GDI resources (this is ONLY used at plugin shutdown)
+
void CSkin::setupTabCloseBitmap(bool fDeleteOnly)
{
if (m_tabCloseHDC || fDeleteOnly) {
@@ -1642,6 +1657,7 @@ void CSkin::setupTabCloseBitmap(bool fDeleteOnly)
// ) dwm mode changes
// ) aero effect is changed by the user
// ) glow colorization is changed by user's request
+
void CSkin::setupAeroSkins()
{
M.getAeroState();
@@ -1812,6 +1828,7 @@ void CSkin::setupAeroSkins()
/////////////////////////////////////////////////////////////////////////////////////////
// Calculate window frame borders for a skin with the ability to paint the window frame.
// Uses system metrics to determine predefined window borders and caption bar size.
+
void CSkin::SkinCalcFrameWidth()
{
int xBorder = GetSystemMetrics(SM_CXSIZEFRAME);
@@ -1832,6 +1849,7 @@ void CSkin::SkinCalcFrameWidth()
// @param pContainer ContainerWindowData *: needed to access the cached DC of the container window
// @param rcClient RECT *: client rectangle (target area)
// @param hdcTarget HDC: device context of the target window
+
void CSkin::SkinDrawBG(HWND hwndClient, HWND hwnd, TContainerData *pContainer, RECT *rcClient, HDC hdcTarget)
{
RECT rcWindow;
@@ -1864,6 +1882,7 @@ void CSkin::SkinDrawBG(HWND hwndClient, HWND hwnd, TContainerData *pContainer, R
// @param pContainer ContainerWindowData *: needed to access the cached DC of the container window
// @param rcClient RECT *: client rectangle (target area)
// @param hdcTarget HDC: device context of the target window
+
void CSkin::SkinDrawBGFromDC(HWND hwndClient, HWND hwnd, RECT *rcClient, HDC hdcTarget)
{
RECT rcWindow;
@@ -1882,6 +1901,7 @@ void CSkin::SkinDrawBGFromDC(HWND hwndClient, HWND hwnd, RECT *rcClient, HDC hdc
/////////////////////////////////////////////////////////////////////////////////////////
// draw an icon "Dimmed" (small amount of transparency applied)
+
void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON hIcon, BYTE alpha)
{
HDC dcMem = ::CreateCompatibleDC(hdc);
@@ -1947,6 +1967,7 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID
/////////////////////////////////////////////////////////////////////////////////////////
// process WM_NCPAINT for the rich edit control. Draws a visual style border and avoid
// classic static edge / client edge may also draw a colorized border around the control
+
UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
{
// do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
@@ -2018,6 +2039,7 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID,
// "f3e355"
//
// @return COLORREF representation of the string value.
+
DWORD __fastcall CSkin::HexStringToLong(const TCHAR *szSource)
{
TCHAR *stopped;
@@ -2030,6 +2052,7 @@ DWORD __fastcall CSkin::HexStringToLong(const TCHAR *szSource)
/////////////////////////////////////////////////////////////////////////////////////////
// Render text to the given HDC. This function is aero aware and will use uxtheme DrawThemeTextEx() when needed.
// Paramaters are pretty much comparable to GDI DrawText() API
+
int CSkin::RenderText(HDC hdc, HANDLE hTheme, const TCHAR *szText, RECT *rc, DWORD dtFlags, const int iGlowSize, COLORREF clr, bool fForceAero)
{
if ((PluginConfig.m_bIsVista && !CSkin::m_skinEnabled && hTheme) || fForceAero) {
@@ -2063,6 +2086,7 @@ int CSkin::RenderText(HDC hdc, HANDLE hTheme, const TCHAR *szText, RECT *rc, DWO
//bitmap should be freed.
//
// @return HBTIAMP: handle to a bitmap with the desired size.
+
HBITMAP CSkin::ResizeBitmap(HBITMAP hBmpSrc, LONG width, LONG height, bool &mustFree)
{
BITMAP bm;
@@ -2096,6 +2120,7 @@ HBITMAP CSkin::ResizeBitmap(HBITMAP hBmpSrc, LONG width, LONG height, bool &must
//
// @return bool: true if the item has been painted, false if not
// (only reason: the ignore flag in the item is set).
+
bool __fastcall CSkin::DrawItem(const HDC hdc, const RECT *rc, const CSkinItem *item)
{
if (!item->IGNORED) {
@@ -2117,6 +2142,7 @@ bool __fastcall CSkin::DrawItem(const HDC hdc, const RECT *rc, const CSkinItem *
// @param dc The device context for which the bitmap should be created.
//
// @return HBITMAP: handle to the bitmap created.
+
HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc)
{
BITMAPINFO dib = { 0 };
@@ -2140,6 +2166,7 @@ HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc)
// @param rc RECT &: Rectangular area within the client area of hwndClient.
//
//It will receive the transformed coordinates, relative to the client area of hwndParent
+
void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc)
{
POINT pt;
@@ -2164,6 +2191,7 @@ void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc)
//
// @param hdc HDC: handle to the device context in which painting should occur.
// @param rcWindow RECT &: The window rectangle of the message dialog window
+
void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindow)
{
if (dat) {
@@ -2259,6 +2287,7 @@ void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindo
// @param hdcSrc The source device context (usually obtained by BeginPaint())
// @param rc RECT&: the target rectangle that receives the painting
// @param hdcOut HDC& (out) receives the buffered device context handle
+
HANDLE CSkin::InitiateBufferedPaint(const HDC hdcSrc, RECT& rc, HDC& hdcOut)
{
return CMimAPI::m_pfnBeginBufferedPaint(hdcSrc, &rc, BPBF_TOPDOWNDIB, NULL, &hdcOut);
@@ -2269,6 +2298,7 @@ HANDLE CSkin::InitiateBufferedPaint(const HDC hdcSrc, RECT& rc, HDC& hdcOut)
//
// @param hbp HANDLE: handle of the buffered paint context
// @param rc RECT*: target rectangly where alpha value should be applied
+
void CSkin::FinalizeBufferedPaint(HANDLE hbp, RECT *rc)
{
if (m_pCurrentAeroEffect && m_pCurrentAeroEffect->m_finalAlpha > 0)
@@ -2289,6 +2319,7 @@ void CSkin::FinalizeBufferedPaint(HANDLE hbp, RECT *rc)
// @param hbp HANDLE: handle to a buffered paint identifier.
// default is none, needed forsome special
// effects. default paramenter is 0
+
void CSkin::ApplyAeroEffect(const HDC hdc, const RECT *rc, int iEffectArea)
{
if (m_pCurrentAeroEffect == 0 || m_aeroEffect == AERO_EFFECT_NONE)
@@ -2300,6 +2331,7 @@ void CSkin::ApplyAeroEffect(const HDC hdc, const RECT *rc, int iEffectArea)
/////////////////////////////////////////////////////////////////////////////////////////
// aero effect callbacks
+
void CSkin::AeroEffectCallback_Milk(const HDC hdc, const RECT *rc, int iEffectArea)
{
if (iEffectArea < 0x1000) {
@@ -2402,6 +2434,7 @@ void CSkin::setAeroEffect(LRESULT effect)
// extract the aero skin images from the DLL and store them in
// the private data folder.
// runs at every startup
+
void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
{
TCHAR tszBasePath[MAX_PATH];
@@ -2420,6 +2453,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
/////////////////////////////////////////////////////////////////////////////////////////
// redraw the splitter area between the message input and message log area only
+
void CSkin::UpdateToolbarBG(TWindowData *dat)
{
if (dat == NULL)
@@ -2453,6 +2487,7 @@ void CSkin::UpdateToolbarBG(TWindowData *dat)
//
// @param hdc: device context
// @param rc: area to fill.
+
void CSkin::FillBack(const HDC hdc, RECT* rc)
{
if (0 == CSkin::m_BrushFill) {