summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-24 09:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-24 09:19:49 +0000
commit16b08498841634e581ef4e366d9a0bb533e6b513 (patch)
tree0b55d8d0b4b502948711b2ca2648d05f9a0d22ed /plugins/TabSRMM
parentc077f66c08ea8cc6ab78ebbdf1fff47eec37528c (diff)
fix for one very rare crash in TabSRMM
git-svn-id: http://svn.miranda-ng.org/main/trunk@4171 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp133
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp217
-rw-r--r--plugins/TabSRMM/src/taskbar.h171
3 files changed, 260 insertions, 261 deletions
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 386fccfb62..e312c166a7 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -784,12 +784,13 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
CHARFORMAT2A cf2;
ZeroMemory(&cf2, sizeof(CHARFORMAT2A));
+ cf2.cbSize = sizeof(cf2);
+
if (fIsChat) {
LOGFONTA lf;
LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, &inputcharcolor, FONTMODULE);
cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_ITALIC | CFM_BACKCOLOR;
- cf2.cbSize = sizeof(cf2);
cf2.crTextColor = inputcharcolor;
cf2.bCharSet = lf.lfCharSet;
cf2.crBackColor = dat->inputbg;
@@ -810,7 +811,6 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
inputcharcolor = RGB(GetRValue(inputcharcolor), GetGValue(inputcharcolor), GetBValue(inputcharcolor) == 0 ? GetBValue(inputcharcolor) + 1 : GetBValue(inputcharcolor) - 1);
cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
- cf2.cbSize = sizeof(cf2);
cf2.crTextColor = inputcharcolor;
cf2.bCharSet = lf.lfCharSet;
strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE);
@@ -862,7 +862,8 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
if (dat->dwFlags & MWF_LOG_RTL) {
SetWindowLongPtr(hwndEdit, GWL_EXSTYLE, GetWindowLongPtr(hwndEdit, GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
SetWindowLongPtr(hwndLog, GWL_EXSTYLE, GetWindowLongPtr(hwndLog, GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
- } else {
+ }
+ else {
SetWindowLongPtr(hwndEdit, GWL_EXSTYLE, GetWindowLongPtr(hwndEdit, GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
SetWindowLongPtr(hwndLog, GWL_EXSTYLE, GetWindowLongPtr(hwndLog, GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
}
@@ -881,52 +882,54 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
static void BTN_StockAction(ButtonItem *item, HWND hwndDlg, struct TWindowData *dat, HWND hwndBtn)
{
- if (item->dwStockFlags & SBI_HANDLEBYCLIENT && IsWindow(hwndDlg) && dat)
+ POINT pt;
+ int iSelection;
+
+ if (item->dwStockFlags & SBI_HANDLEBYCLIENT && IsWindow(hwndDlg) && dat) {
SendMessage(hwndDlg, WM_COMMAND, MAKELONG(item->uId, BN_CLICKED), (LPARAM)hwndBtn);
- else {
- switch (item->uId) {
- case IDC_SBAR_CANCEL:
- PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_SAVE, BN_CLICKED), (LPARAM)hwndBtn);
- break;
- case IDC_SBAR_SLIST:
- SendMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_LBUTTONUP);
- break;
- case IDC_SBAR_FAVORITES: {
- POINT pt;
- int iSelection;
- GetCursorPos(&pt);
- iSelection = TrackPopupMenu(PluginConfig.g_hMenuFavorites, TPM_RETURNCMD, pt.x, pt.y, 0, PluginConfig.g_hwndHotkeyHandler, NULL);
- HandleMenuEntryFromhContact(iSelection);
- break;
- }
- case IDC_SBAR_RECENT: {
- POINT pt;
- int iSelection;
- GetCursorPos(&pt);
- iSelection = TrackPopupMenu(PluginConfig.g_hMenuRecent, TPM_RETURNCMD, pt.x, pt.y, 0, PluginConfig.g_hwndHotkeyHandler, NULL);
- HandleMenuEntryFromhContact(iSelection);
- break;
- }
- case IDC_SBAR_USERPREFS: {
- HANDLE hContact = 0;
- SendMessage(hwndDlg, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- if (hContact != 0)
- CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)hContact, 0);
- break;
+ return;
+ }
+
+ switch (item->uId) {
+ case IDC_SBAR_CANCEL:
+ PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_SAVE, BN_CLICKED), (LPARAM)hwndBtn);
+ break;
+ case IDC_SBAR_SLIST:
+ SendMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_LBUTTONUP);
+ break;
+ case IDC_SBAR_FAVORITES:
+ GetCursorPos(&pt);
+ iSelection = TrackPopupMenu(PluginConfig.g_hMenuFavorites, TPM_RETURNCMD, pt.x, pt.y, 0, PluginConfig.g_hwndHotkeyHandler, NULL);
+ HandleMenuEntryFromhContact(iSelection);
+ break;
+
+ case IDC_SBAR_RECENT:
+ GetCursorPos(&pt);
+ iSelection = TrackPopupMenu(PluginConfig.g_hMenuRecent, TPM_RETURNCMD, pt.x, pt.y, 0, PluginConfig.g_hwndHotkeyHandler, NULL);
+ HandleMenuEntryFromhContact(iSelection);
+ break;
+
+ case IDC_SBAR_USERPREFS:
+ {
+ HANDLE hContact = 0;
+ SendMessage(hwndDlg, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ if (hContact != 0)
+ CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)hContact, 0);
+ }
+ break;
+
+ case IDC_SBAR_TOGGLEFORMAT:
+ if (dat) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_SBAR_TOGGLEFORMAT) == BST_UNCHECKED) {
+ dat->SendFormat = 0;
+ GetSendFormat(dat, 0);
}
- case IDC_SBAR_TOGGLEFORMAT: {
- if (dat) {
- if (IsDlgButtonChecked(hwndDlg, IDC_SBAR_TOGGLEFORMAT) == BST_UNCHECKED) {
- dat->SendFormat = 0;
- GetSendFormat(dat, 0);
- } else {
- dat->SendFormat = SENDFORMAT_BBCODE;
- GetSendFormat(dat, 0);
- }
- }
- break;
+ else {
+ dat->SendFormat = SENDFORMAT_BBCODE;
+ GetSendFormat(dat, 0);
}
}
+ break;
}
}
@@ -944,9 +947,7 @@ static struct SIDEBARITEM sbarItems[] = {
int TSAPI BTN_GetStockItem(ButtonItem *item, const TCHAR *szName)
{
- int i = 0;
-
- while (sbarItems[i].uId) {
+ for (int i=0; sbarItems[i].uId; i++) {
if (!_tcsicmp(sbarItems[i].szName, szName)) {
item->uId = sbarItems[i].uId;
//item->dwFlags |= BUTTON_ISSIDEBAR;
@@ -977,7 +978,6 @@ int TSAPI BTN_GetStockItem(ButtonItem *item, const TCHAR *szName)
}
return 1;
}
- i++;
}
return 0;
}
@@ -1132,19 +1132,15 @@ void TSAPI DM_LoadLocale(TWindowData *dat)
LRESULT TSAPI DM_RecalcPictureSize(TWindowData *dat)
{
- BITMAP bminfo;
- HBITMAP hbm;
-
if (dat) {
- hbm = ((dat->Panel->isActive()) && dat->pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
-
- if (hbm == 0) {
- dat->pic.cy = dat->pic.cx = 60;
- return 0;
+ HBITMAP hbm = ((dat->Panel->isActive()) && dat->pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
+ if (hbm) {
+ BITMAP bminfo;
+ GetObject(hbm, sizeof(bminfo), &bminfo);
+ CalcDynamicAvatarSize(dat, &bminfo);
+ SendMessage(dat->hwnd, WM_SIZE, 0, 0);
}
- GetObject(hbm, sizeof(bminfo), &bminfo);
- CalcDynamicAvatarSize(dat, &bminfo);
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ else dat->pic.cy = dat->pic.cx = 60;
}
return 0;
}
@@ -1247,21 +1243,18 @@ HWND TSAPI DM_CreateClist(TWindowData *dat)
dat->sendMode &= ~SMODE_MULTIPLE;
return 0;
}
- HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248,
- 184, 0, 30, 30, dat->hwnd, (HMENU)IDC_CLIST, g_hInst, NULL);
- //MAD: fix for little bug, when following code didn't work (another hack :))
- HANDLE hItem;
+ HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248,
+ 184, 0, 30, 30, dat->hwnd, (HMENU)IDC_CLIST, g_hInst, NULL);
SendMessage(hwndClist, WM_TIMER, 14, 0);
- //
- hItem = (HANDLE) SendMessage(hwndClist, CLM_FINDCONTACT, (WPARAM) dat->hContact, 0);
+ HANDLE hItem = (HANDLE) SendMessage(hwndClist, CLM_FINDCONTACT, (WPARAM) dat->hContact, 0);
SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) & ~CLS_EX_TRACKSELECT);
SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) | (CLS_EX_NOSMOOTHSCROLLING | CLS_EX_NOTRANSLUCENTSEL));
- //MAD: show offline contacts in multi-send
+
if (!PluginConfig.m_AllowOfflineMultisend)
SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) | CLS_HIDEOFFLINE);
- //
+
if (hItem)
SendMessage(hwndClist, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
@@ -1329,8 +1322,8 @@ LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, struct TWindowDat
SendMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
else if (wDirection > 0)
SendMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
- } else
- SendMessage(hwnd, WM_MOUSEWHEEL, wParam, lParam);
+ }
+ else SendMessage(hwnd, WM_MOUSEWHEEL, wParam, lParam);
return 0;
}
hwndTab = GetDlgItem(mwdat->pContainer->hwnd, IDC_MSGTABS);
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp
index 37b7b6a746..32ad9067e6 100644
--- a/plugins/TabSRMM/src/taskbar.cpp
+++ b/plugins/TabSRMM/src/taskbar.cpp
@@ -330,124 +330,125 @@ void CProxyWindow::sendThumb(LONG width, LONG height)
*/
void CProxyWindow::sendPreview()
{
- POINT pt = {0};
- RECT rcContainer;
- HDC hdc, dc;
- FORMATRANGE fr = {0};
- int twips = (int)(15.0f / PluginConfig.g_DPIscaleY);
- RECT rcTemp;
- RECT rcRich, rcLog;
- bool fIsChat = m_dat->bType == SESSIONTYPE_IM ? false : true;
- TWindowData* dat_active = reinterpret_cast<TWindowData *>(::GetWindowLongPtr(m_dat->pContainer->hwndActive, GWLP_USERDATA));
-
- if (m_thumb && dat_active) {
- HWND hwndRich = ::GetDlgItem(m_dat->hwnd, fIsChat ? IDC_CHAT_LOG : IDC_LOG);
- LONG cx, cy;
- POINT ptOrigin = {0}, ptBottom;
-
- if (m_dat->dwFlags & MWF_NEEDCHECKSIZE) {
- RECT rcClient;
-
- ::SendMessage(m_dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
- ::MoveWindow(m_dat->hwnd, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), FALSE);
- ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
- ::SendMessage(m_dat->hwnd, DM_FORCESCROLL, 0, 0);
- }
- /*
- * a minimized container has a null rect as client area, so do not use it
- * use the last known client area size instead.
- */
-
- if (!::IsIconic(m_dat->pContainer->hwnd)) {
- ::GetWindowRect(m_dat->pContainer->hwndActive, &rcLog);
- ::GetClientRect(m_dat->pContainer->hwnd, &rcContainer);
- pt.x = rcLog.left;
- pt.y = rcLog.top;
- ::ScreenToClient(m_dat->pContainer->hwnd, &pt);
- }
- else {
- rcLog = m_dat->pContainer->rcLogSaved;
- rcContainer = m_dat->pContainer->rcSaved;
- pt = m_dat->pContainer->ptLogSaved;
- }
+ if (m_dat->pContainer == NULL)
+ return;
+
+ TWindowData *dat_active = reinterpret_cast<TWindowData *>(::GetWindowLongPtr(m_dat->pContainer->hwndActive, GWLP_USERDATA));
+ if (!m_thumb || !dat_active)
+ return;
+
+ FORMATRANGE fr = {0};
+ POINT pt = {0};
+ RECT rcContainer, rcTemp, rcRich, rcLog;
+ HDC hdc, dc;
+ int twips = (int)(15.0f / PluginConfig.g_DPIscaleY);
+ bool fIsChat = m_dat->bType != SESSIONTYPE_IM;
+ HWND hwndRich = ::GetDlgItem(m_dat->hwnd, fIsChat ? IDC_CHAT_LOG : IDC_LOG);
+ LONG cx, cy;
+ POINT ptOrigin = {0}, ptBottom;
+
+ if (m_dat->dwFlags & MWF_NEEDCHECKSIZE) {
+ RECT rcClient;
+
+ ::SendMessage(m_dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
+ ::MoveWindow(m_dat->hwnd, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), FALSE);
+ ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
+ ::SendMessage(m_dat->hwnd, DM_FORCESCROLL, 0, 0);
+ }
+ /*
+ * a minimized container has a null rect as client area, so do not use it
+ * use the last known client area size instead.
+ */
+
+ if (!::IsIconic(m_dat->pContainer->hwnd)) {
+ ::GetWindowRect(m_dat->pContainer->hwndActive, &rcLog);
+ ::GetClientRect(m_dat->pContainer->hwnd, &rcContainer);
+ pt.x = rcLog.left;
+ pt.y = rcLog.top;
+ ::ScreenToClient(m_dat->pContainer->hwnd, &pt);
+ }
+ else {
+ rcLog = m_dat->pContainer->rcLogSaved;
+ rcContainer = m_dat->pContainer->rcSaved;
+ pt = m_dat->pContainer->ptLogSaved;
+ }
- ::GetWindowRect(::GetDlgItem(m_dat->pContainer->hwndActive, dat_active->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcTemp);
- ptBottom.x = rcTemp.left;
- ptBottom.y = rcTemp.bottom;
- ::ScreenToClient(m_dat->pContainer->hwnd, &ptBottom);
+ ::GetWindowRect(::GetDlgItem(m_dat->pContainer->hwndActive, dat_active->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcTemp);
+ ptBottom.x = rcTemp.left;
+ ptBottom.y = rcTemp.bottom;
+ ::ScreenToClient(m_dat->pContainer->hwnd, &ptBottom);
- cx = rcLog.right - rcLog.left;
- cy = rcLog.bottom - rcLog.top;
- rcRich.left = 0;
- rcRich.top = 0;
- rcRich.right = cx;
- rcRich.bottom = ptBottom.y - pt.y;
+ cx = rcLog.right - rcLog.left;
+ cy = rcLog.bottom - rcLog.top;
+ rcRich.left = 0;
+ rcRich.top = 0;
+ rcRich.right = cx;
+ rcRich.bottom = ptBottom.y - pt.y;
- dc = ::GetDC(m_dat->hwnd);
- hdc = ::CreateCompatibleDC(dc);
- HBITMAP hbm = CSkin::CreateAeroCompatibleBitmap(rcContainer, hdc);
- HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdc, hbm));
+ dc = ::GetDC(m_dat->hwnd);
+ hdc = ::CreateCompatibleDC(dc);
+ HBITMAP hbm = CSkin::CreateAeroCompatibleBitmap(rcContainer, hdc);
+ HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdc, hbm));
- HBRUSH brb = ::CreateSolidBrush(RGB(20, 20, 20));
- ::FillRect(hdc, &rcContainer, brb);
- ::DeleteObject(brb);
- CImageItem::SetBitmap32Alpha(hbm, 100);
+ HBRUSH brb = ::CreateSolidBrush(RGB(20, 20, 20));
+ ::FillRect(hdc, &rcContainer, brb);
+ ::DeleteObject(brb);
+ CImageItem::SetBitmap32Alpha(hbm, 100);
- LRESULT first = ::SendMessage(hwndRich, EM_CHARFROMPOS, 0, reinterpret_cast<LPARAM>(&ptOrigin));
+ LRESULT first = ::SendMessage(hwndRich, EM_CHARFROMPOS, 0, reinterpret_cast<LPARAM>(&ptOrigin));
- /*
- * paint the content of the message log control into a separate bitmap without
- * transparency
- */
- HDC hdcRich = ::CreateCompatibleDC(dc);
- HBITMAP hbmRich = CSkin::CreateAeroCompatibleBitmap(rcRich, hdcRich);
- HBITMAP hbmRichOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcRich, hbmRich));
-
- COLORREF clr = fIsChat ? M->GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR) : m_dat->pContainer->theme.inbg;
- HBRUSH br = ::CreateSolidBrush(clr);
- ::FillRect(hdcRich, &rcRich, br);
- ::DeleteObject(br);
-
- if (m_dat->hwndIEView)
- ::SendMessage(m_dat->hwndIEView, WM_PRINT, reinterpret_cast<WPARAM>(hdcRich), PRF_CLIENT | PRF_NONCLIENT);
- else if (m_dat->hwndHPP) {
- CSkin::RenderText(hdcRich, m_dat->hTheme, TranslateT("Previews not availble when using History++ plugin for message log display."),
- &rcRich, DT_VCENTER | DT_CENTER | DT_WORDBREAK, 10, m_dat->pContainer->theme.fontColors[MSGFONTID_MYMSG], false);
- }
- else {
- rcRich.right *= twips;
- rcRich.bottom *= twips;
+ /*
+ * paint the content of the message log control into a separate bitmap without
+ * transparency
+ */
+ HDC hdcRich = ::CreateCompatibleDC(dc);
+ HBITMAP hbmRich = CSkin::CreateAeroCompatibleBitmap(rcRich, hdcRich);
+ HBITMAP hbmRichOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcRich, hbmRich));
+
+ COLORREF clr = fIsChat ? M->GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR) : m_dat->pContainer->theme.inbg;
+ HBRUSH br = ::CreateSolidBrush(clr);
+ ::FillRect(hdcRich, &rcRich, br);
+ ::DeleteObject(br);
+
+ if (m_dat->hwndIEView)
+ ::SendMessage(m_dat->hwndIEView, WM_PRINT, reinterpret_cast<WPARAM>(hdcRich), PRF_CLIENT | PRF_NONCLIENT);
+ else if (m_dat->hwndHPP) {
+ CSkin::RenderText(hdcRich, m_dat->hTheme, TranslateT("Previews not availble when using History++ plugin for message log display."),
+ &rcRich, DT_VCENTER | DT_CENTER | DT_WORDBREAK, 10, m_dat->pContainer->theme.fontColors[MSGFONTID_MYMSG], false);
+ }
+ else {
+ rcRich.right *= twips;
+ rcRich.bottom *= twips;
- fr.hdc = hdcRich;
- fr.hdcTarget = hdcRich;
- fr.rc = rcRich;
- fr.rcPage = rcRich;
- fr.chrg.cpMax = -1;
- fr.chrg.cpMin = first;
+ fr.hdc = hdcRich;
+ fr.hdcTarget = hdcRich;
+ fr.rc = rcRich;
+ fr.rcPage = rcRich;
+ fr.chrg.cpMax = -1;
+ fr.chrg.cpMin = first;
- ::SendMessage(hwndRich, EM_FORMATRANGE, 1, reinterpret_cast<LPARAM>(&fr));
- }
+ ::SendMessage(hwndRich, EM_FORMATRANGE, 1, reinterpret_cast<LPARAM>(&fr));
+ }
- ::SelectObject(hdcRich, hbmRichOld);
- CImageItem::SetBitmap32Alpha(hbmRich, 255);
- ::SelectObject(hdcRich, hbmRich);
- ::BitBlt(hdc, pt.x, pt.y, cx, cy, hdcRich, 0, 0, SRCCOPY);
- ::SelectObject(hdcRich, hbmRichOld);
- ::DeleteObject(hbmRich);
- ::DeleteDC(hdcRich);
-
- ::SelectObject(hdc, hbmOld);
- ::DeleteDC(hdc);
- if (CSkin::m_skinEnabled && CSkin::m_frameSkins) {
- pt.x = CSkin::m_SkinnedFrame_left;
- pt.y = CSkin::m_SkinnedFrame_caption + CSkin::m_SkinnedFrame_bottom;
- }
- else
- pt.x = pt.y = 0;
- CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap(m_hwndProxy, hbm, &pt, m_dat->pContainer->dwFlags & CNT_CREATE_MINIMIZED ? 0 : DWM_SIT_DISPLAYFRAME);
- ::ReleaseDC(m_dat->hwnd, dc);
- ::DeleteObject(hbm);
+ ::SelectObject(hdcRich, hbmRichOld);
+ CImageItem::SetBitmap32Alpha(hbmRich, 255);
+ ::SelectObject(hdcRich, hbmRich);
+ ::BitBlt(hdc, pt.x, pt.y, cx, cy, hdcRich, 0, 0, SRCCOPY);
+ ::SelectObject(hdcRich, hbmRichOld);
+ ::DeleteObject(hbmRich);
+ ::DeleteDC(hdcRich);
+
+ ::SelectObject(hdc, hbmOld);
+ ::DeleteDC(hdc);
+ if (CSkin::m_skinEnabled && CSkin::m_frameSkins) {
+ pt.x = CSkin::m_SkinnedFrame_left;
+ pt.y = CSkin::m_SkinnedFrame_caption + CSkin::m_SkinnedFrame_bottom;
}
+ else pt.x = pt.y = 0;
+
+ CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap(m_hwndProxy, hbm, &pt, m_dat->pContainer->dwFlags & CNT_CREATE_MINIMIZED ? 0 : DWM_SIT_DISPLAYFRAME);
+ ::ReleaseDC(m_dat->hwnd, dc);
+ ::DeleteObject(hbm);
}
/**
diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h
index b2390bc827..0a7efc0537 100644
--- a/plugins/TabSRMM/src/taskbar.h
+++ b/plugins/TabSRMM/src/taskbar.h
@@ -43,56 +43,58 @@ class CProxyWindow;
class CThumbBase {
public:
- CThumbBase (const CProxyWindow* pWnd);
- virtual ~CThumbBase ();
+ CThumbBase(const CProxyWindow* pWnd);
+ virtual ~CThumbBase();
- const HBITMAP getHBM () const { return(m_hbmThumb); }
- const bool isValid () const { return(m_isValid); }
- virtual void setValid (const bool fNewValid) { m_isValid = fNewValid; }
- virtual void update () = 0;
+ __inline const HBITMAP getHBM() const { return m_hbmThumb; }
+ __inline const bool isValid() const { return m_isValid; }
+
+ virtual void setValid(const bool fNewValid) { m_isValid = fNewValid; }
+ virtual void update() = 0;
protected:
- HBITMAP m_hbmThumb, m_hbmOld;
- const TWindowData* m_dat;
- LONG m_width, m_height;
- HDC m_hdc;
- const CProxyWindow* m_pWnd;
- RECT m_rc, m_rcTop, m_rcBottom, m_rcIcon;
- DWORD m_dtFlags;
- SIZE m_sz;
- LONG m_cx, m_cy;
- HFONT m_hOldFont;
-
- virtual void renderBase ();
+ const TWindowData *m_dat;
+ const CProxyWindow *m_pWnd;
+
+ HBITMAP m_hbmThumb, m_hbmOld;
+ LONG m_width, m_height;
+ HDC m_hdc;
+ RECT m_rc, m_rcTop, m_rcBottom, m_rcIcon;
+ DWORD m_dtFlags;
+ SIZE m_sz;
+ LONG m_cx, m_cy;
+ HFONT m_hOldFont;
+
+ virtual void renderBase();
+ virtual void renderContent() = 0;
private:
- virtual void renderContent () = 0;
- void setupRect ();
+ void setupRect();
private:
- bool m_isValid;
+ bool m_isValid;
};
-class CThumbIM : public CThumbBase {
-
+class CThumbIM : public CThumbBase
+{
public:
- CThumbIM (const CProxyWindow* pWnd);
- virtual ~CThumbIM () {};
- void update ();
+ CThumbIM(const CProxyWindow* pWnd);
+ virtual ~CThumbIM() {};
+ void update();
private:
- void renderContent ();
+ void renderContent();
};
-class CThumbMUC : public CThumbBase {
-
+class CThumbMUC : public CThumbBase
+{
public:
- CThumbMUC (const CProxyWindow* pWnd);
- virtual ~CThumbMUC () {};
- void update ();
+ CThumbMUC(const CProxyWindow* pWnd);
+ virtual ~CThumbMUC() {};
+ void update();
private:
- void renderContent ();
+ void renderContent();
};
class CProxyWindow
@@ -101,34 +103,37 @@ public:
CProxyWindow(const TWindowData *dat);
~CProxyWindow();
- void updateIcon (const HICON hIcon) const;
- void updateTitle (const TCHAR *tszTitle) const;
- void setBigIcon (const HICON hIcon, bool fInvalidate = true);
- void setOverlayIcon (const HICON hIcon, bool fInvalidate = true);
- void activateTab () const;
- void Invalidate () const;
- const TWindowData* getDat () const { return(m_dat); }
- const LONG getWidth () const { return(m_width); }
- const LONG getHeight () const { return(m_height); }
- const HWND getHwnd () const { return(m_hwndProxy); }
- const HICON getBigIcon () const { return(m_hBigIcon); }
- const HICON getOverlayIcon () const { return(m_hOverlayIcon); }
- void verifyDwmState ();
-
- static LRESULT CALLBACK stubWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static void add (TWindowData *dat);
- static void verify (TWindowData *dat);
+ void updateIcon(const HICON hIcon) const;
+ void updateTitle(const TCHAR *tszTitle) const;
+ void setBigIcon(const HICON hIcon, bool fInvalidate = true);
+ void setOverlayIcon(const HICON hIcon, bool fInvalidate = true);
+ void activateTab() const;
+ void Invalidate() const;
+ void verifyDwmState();
+
+ __inline const TWindowData* getDat() const { return m_dat; }
+ __inline const LONG getWidth() const { return m_width; }
+ __inline const LONG getHeight() const { return m_height; }
+ __inline const HWND getHwnd() const { return m_hwndProxy; }
+ __inline const HICON getBigIcon() const { return m_hBigIcon; }
+ __inline const HICON getOverlayIcon() const { return m_hOverlayIcon; }
+
+ static LRESULT CALLBACK stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static void add(TWindowData *dat);
+ static void verify(TWindowData *dat);
private:
- const TWindowData* m_dat;
- HWND m_hwndProxy;
- LONG m_width, m_height;
- HICON m_hBigIcon, m_hOverlayIcon;
-
- LRESULT CALLBACK wndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- void sendThumb (LONG width, LONG height);
- void sendPreview ();
- CThumbBase* m_thumb;
+ const TWindowData *m_dat;
+
+ HWND m_hwndProxy;
+ LONG m_width, m_height;
+ HICON m_hBigIcon, m_hOverlayIcon;
+
+ LRESULT CALLBACK wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+ void sendThumb(LONG width, LONG height);
+ void sendPreview();
+ CThumbBase *m_thumb;
};
class CTaskbarInteract
@@ -148,15 +153,14 @@ public:
}
/*
- * register proxy window class
- */
- WNDCLASSEX wcex = {0};
- wcex.cbSize = sizeof(wcex);
- wcex.lpfnWndProc = CProxyWindow::stubWndProc;
- wcex.hInstance = g_hInst;
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wcex.lpszClassName = PROXYCLASSNAME;
+ * register proxy window class
+ */
+ WNDCLASSEX wcex = { sizeof(wcex) };
+ wcex.lpfnWndProc = CProxyWindow::stubWndProc;
+ wcex.hInstance = g_hInst;
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszClassName = PROXYCLASSNAME;
::RegisterClassEx(&wcex);
}
@@ -169,27 +173,28 @@ public:
}
::UnregisterClass(PROXYCLASSNAME, g_hInst);
}
- const LONG getIconSize () const { return(m_IconSize); }
- const bool haveAlwaysGroupingMode () const { return(m_fHaveAlwaysGrouping); }
+ const LONG getIconSize() const { return m_IconSize; }
+ const bool haveAlwaysGroupingMode() const { return m_fHaveAlwaysGrouping; }
- bool setOverlayIcon (HWND hwndDlg, LPARAM lParam) const;
- void clearOverlayIcon (HWND hwndDlg) const;
- bool haveLargeIcons ();
- LONG updateMetrics ();
- void registerTab (const HWND hwndTab, const HWND hwndContainer) const;
- void unRegisterTab (const HWND hwndTab) const;
- void SetTabActive (const HWND hwndTab, const HWND hwndGroup) const;
+ bool setOverlayIcon(HWND hwndDlg, LPARAM lParam) const;
+ void clearOverlayIcon(HWND hwndDlg) const;
+ bool haveLargeIcons();
+ LONG updateMetrics();
+ void registerTab(const HWND hwndTab, const HWND hwndContainer) const;
+ void unRegisterTab(const HWND hwndTab) const;
+ void SetTabActive(const HWND hwndTab, const HWND hwndGroup) const;
//const TCHAR* getFileNameFromWindow (const HWND hWnd);
private:
- bool m_isEnabled;
- ITaskbarList3* m_pTaskbarInterface;
- bool m_fHaveLargeicons;
- bool m_fHaveAlwaysGrouping;
- LONG m_IconSize;
+ ITaskbarList3 *m_pTaskbarInterface;
+
+ bool m_isEnabled;
+ bool m_fHaveLargeicons;
+ bool m_fHaveAlwaysGrouping;
+ LONG m_IconSize;
};
-extern CTaskbarInteract* Win7Taskbar;
+extern CTaskbarInteract *Win7Taskbar;
#endif /* __TASKBAR_H */