summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-27 21:42:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-27 21:42:44 +0000
commit17501083ca15adc9e3f53757b47a961ed2e77e9c (patch)
treee6a88938fd555265d20bf4281765c84fb874bc18 /plugins/TabSRMM/src
parent18fb3c2f6c84e3242df27a8686da95658584f7a8 (diff)
warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15051 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp42
-rw-r--r--plugins/TabSRMM/src/container.cpp551
-rw-r--r--plugins/TabSRMM/src/controls.cpp6
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp30
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp52
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp22
-rw-r--r--plugins/TabSRMM/src/mim.cpp6
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp1088
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp5
-rw-r--r--plugins/TabSRMM/src/msglog.cpp14
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp17
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp20
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp46
-rw-r--r--plugins/TabSRMM/src/themeio.cpp5
-rw-r--r--plugins/TabSRMM/src/themes.cpp4
-rw-r--r--plugins/TabSRMM/src/utils.cpp362
16 files changed, 1120 insertions, 1150 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index e827e9ddfd..56cc362ab0 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1561,13 +1561,13 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case 20020: // add to highlight...
if (parentdat && ui) {
THighLightEdit the = { THighLightEdit::CMD_ADD, parentdat, ui };
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
- TranslateDialogDefault(hwnd);
+ HWND hwndDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
+ TranslateDialogDefault(hwndDlg);
- RECT rc, rcWnd;
+ RECT rc, rcWnd;
GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
- GetWindowRect(hwnd, &rc);
- SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ GetWindowRect(hwndDlg, &rc);
+ SetWindowPos(hwndDlg, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
break;
@@ -2178,9 +2178,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
x_offset = 2;
if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
+ HICON icon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, NULL, DI_NORMAL);
+ IcoLib_ReleaseIcon(icon);
x_offset += 18;
}
@@ -2202,9 +2202,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
+ HICON icon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, NULL, DI_NORMAL);
+ IcoLib_ReleaseIcon(icon);
x_offset += 18;
}
@@ -2308,7 +2308,7 @@ LABEL_SHOWWINDOW:
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERX)) {
GetClientRect(hwndDlg, &rc);
- POINT pt = { wParam, 0 };
+ pt.x = wParam, pt.y = 0;
ScreenToClient(hwndDlg, &pt);
si->iSplitterX = rc.right - pt.x + 1;
@@ -2322,7 +2322,7 @@ LABEL_SHOWWINDOW:
else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY) || lParam == -1) {
GetClientRect(hwndDlg, &rc);
rc.top += (dat->Panel->isActive() ? dat->Panel->getHeight() + 40 : 30);
- POINT pt = { 0, wParam };
+ pt.x = 0, pt.y = wParam;
ScreenToClient(hwndDlg, &pt);
si->iSplitterY = rc.bottom - pt.y + DPISCALEY_S(1);
@@ -2335,7 +2335,7 @@ LABEL_SHOWWINDOW:
SendMessage(dat->hwnd, WM_SIZE, 0, 0);
}
else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
- POINT pt = { 0, wParam };
+ pt.x = 0, pt.y = wParam;
ScreenToClient(hwndDlg, &pt);
GetClientRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rc);
if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30))
@@ -2442,7 +2442,6 @@ LABEL_SHOWWINDOW:
}
if (msg == WM_MOUSEMOVE) {
- POINT pt;
GetCursorPos(&pt);
DM_DismissTip(dat, pt);
dat->Panel->trackMouse(pt);
@@ -2506,7 +2505,7 @@ LABEL_SHOWWINDOW:
if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
CHARRANGE sel, all = { 0, -1 };
- POINT pt = { (short)LOWORD(((ENLINK*)lParam)->lParam), (short)HIWORD(((ENLINK*)lParam)->lParam) };
+ pt.x = LOWORD(((ENLINK*)lParam)->lParam), pt.y = HIWORD(((ENLINK*)lParam)->lParam);
ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
// fixing stuff for searches
@@ -3297,16 +3296,15 @@ LABEL_SHOWWINDOW:
dat->dwFlags &= ~MWF_NEEDCHECKSIZE;
if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
dat->dwFlags &= ~MWF_INITMODE;
- {
- RECT rcClient;
- SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
- MoveWindow(hwndDlg, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE);
- }
+
+ SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
+ MoveWindow(hwndDlg, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE);
+
if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
- POINT pt = { 0 };
+ pt.x = pt.y = 0;
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
if (PluginConfig.m_bAutoLocaleSupport) {
if (dat->hkl == 0)
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 01ce09a027..8eb2bcea84 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -119,157 +119,153 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (msg) {
case WM_NCPAINT: {
- PAINTSTRUCT ps;
- HDC hdcReal;
- RECT rcClient;
- LONG width, height;
- HDC hdc;
- CSkinItem *item = &SkinItems[0], *item_normal, *item_pressed, *item_hot;
- HICON hIcon;
- HFONT hOldFont = 0;
- TEXTMETRIC tm;
-
- if (!pContainer || !bSkinned)
- break;
+ PAINTSTRUCT ps;
+ HDC hdcReal;
+ LONG width, height;
+ HDC hdc;
+ CSkinItem *item = &SkinItems[0], *item_normal, *item_pressed, *item_hot;
+ HFONT hOldFont = 0;
+ TEXTMETRIC tm;
+
+ if (!pContainer || !bSkinned)
+ break;
- if (CSkin::m_frameSkins) {
- HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW |/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
- LONG clip_top, clip_left;
- RECT rcText;
- HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
- int i;
+ if (CSkin::m_frameSkins) {
+ HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW |/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
+ LONG clip_top, clip_left;
+ RECT rcText;
+ HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
- RECT rcWindow, rcClient;
- POINT pt, pt1;
- GetWindowRect(hwndDlg, &rcWindow);
- GetClientRect(hwndDlg, &rcClient);
- pt.y = 0;
- pt.x = 0;
- ClientToScreen(hwndDlg, &pt);
- pt1.x = rcClient.right;
- pt1.y = rcClient.bottom;
- ClientToScreen(hwndDlg, &pt1);
- clip_top = pt.y - rcWindow.top;
- clip_left = pt.x - rcWindow.left;
-
- rcWindow.right = rcWindow.right - rcWindow.left;
- rcWindow.bottom = rcWindow.bottom - rcWindow.top;
- rcWindow.left = rcWindow.top = 0;
-
- HBITMAP hbmMem = CreateCompatibleBitmap(dcFrame, rcWindow.right, rcWindow.bottom);
- HBITMAP hbmOld = (HBITMAP)SelectObject(dcMem, hbmMem);
-
- ExcludeClipRect(dcFrame, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
- ExcludeClipRect(dcMem, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
- CSkinItem *item = pContainer->ncActive ? &SkinItems[ID_EXTBKFRAME] : &SkinItems[ID_EXTBKFRAMEINACTIVE];
-
- CSkin::DrawItem(dcMem, &rcWindow, item);
-
- TCHAR szWindowText[512];
- GetWindowText(hwndDlg, szWindowText, _countof(szWindowText));
- szWindowText[511] = 0;
- hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
- GetTextMetrics(dcMem, &tm);
- SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
- SetBkMode(dcMem, TRANSPARENT);
- rcText.left = 20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
- rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
- rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
- rcText.bottom = rcText.top + tm.tmHeight;
- rcText.left += CSkin::m_captionPadding;
- DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
- SelectObject(dcMem, hOldFont);
-
- // icon
- hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
- DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
-
- // title buttons
- pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
- pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
-
- pContainer->rcClose.right = rcWindow.right - 10 - CSkin::m_titleBarRightOff;
- pContainer->rcClose.left = pContainer->rcClose.right - CSkin::m_titleBarButtonSize.cx;
-
- pContainer->rcMax.right = pContainer->rcClose.left - 2;
- pContainer->rcMax.left = pContainer->rcMax.right - CSkin::m_titleBarButtonSize.cx;
-
- pContainer->rcMin.right = pContainer->rcMax.left - 2;
- pContainer->rcMin.left = pContainer->rcMin.right - CSkin::m_titleBarButtonSize.cx;
-
- item_normal = &SkinItems[ID_EXTBKTITLEBUTTON];
- item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
- item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
-
- for (i = 0; i < 3; i++) {
- RECT *rc = 0;
- HICON hIcon = 0;
-
- switch (i) {
- case 0:
- rc = &pContainer->rcMin;
- hIcon = CSkin::m_minIcon;
- break;
- case 1:
- rc = &pContainer->rcMax;
- hIcon = CSkin::m_maxIcon;
- break;
- case 2:
- rc = &pContainer->rcClose;
- hIcon = CSkin::m_closeIcon;
- break;
- }
- if (rc) {
- item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
- CSkin::DrawItem(dcMem, rc, item);
- DrawIconEx(dcMem, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ RECT rcWindow, rcClient;
+ POINT pt, pt1;
+ GetWindowRect(hwndDlg, &rcWindow);
+ GetClientRect(hwndDlg, &rcClient);
+ pt.y = 0;
+ pt.x = 0;
+ ClientToScreen(hwndDlg, &pt);
+ pt1.x = rcClient.right;
+ pt1.y = rcClient.bottom;
+ ClientToScreen(hwndDlg, &pt1);
+ clip_top = pt.y - rcWindow.top;
+ clip_left = pt.x - rcWindow.left;
+
+ rcWindow.right = rcWindow.right - rcWindow.left;
+ rcWindow.bottom = rcWindow.bottom - rcWindow.top;
+ rcWindow.left = rcWindow.top = 0;
+
+ HBITMAP hbmMem = CreateCompatibleBitmap(dcFrame, rcWindow.right, rcWindow.bottom);
+ HBITMAP hbmOld = (HBITMAP)SelectObject(dcMem, hbmMem);
+
+ ExcludeClipRect(dcFrame, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
+ ExcludeClipRect(dcMem, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
+
+ CSkin::DrawItem(dcMem, &rcWindow, &SkinItems[pContainer->ncActive ? ID_EXTBKFRAME : ID_EXTBKFRAMEINACTIVE]);
+
+ TCHAR szWindowText[512];
+ GetWindowText(hwndDlg, szWindowText, _countof(szWindowText));
+ szWindowText[511] = 0;
+ hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
+ GetTextMetrics(dcMem, &tm);
+ SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
+ SetBkMode(dcMem, TRANSPARENT);
+ rcText.left = 20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
+ rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
+ rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
+ rcText.bottom = rcText.top + tm.tmHeight;
+ rcText.left += CSkin::m_captionPadding;
+ DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
+ SelectObject(dcMem, hOldFont);
+
+ // icon
+ HICON hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
+ DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+
+ // title buttons
+ pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
+ pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
+
+ pContainer->rcClose.right = rcWindow.right - 10 - CSkin::m_titleBarRightOff;
+ pContainer->rcClose.left = pContainer->rcClose.right - CSkin::m_titleBarButtonSize.cx;
+
+ pContainer->rcMax.right = pContainer->rcClose.left - 2;
+ pContainer->rcMax.left = pContainer->rcMax.right - CSkin::m_titleBarButtonSize.cx;
+
+ pContainer->rcMin.right = pContainer->rcMax.left - 2;
+ pContainer->rcMin.left = pContainer->rcMin.right - CSkin::m_titleBarButtonSize.cx;
+
+ item_normal = &SkinItems[ID_EXTBKTITLEBUTTON];
+ item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
+ item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
+
+ for (int i = 0; i < 3; i++) {
+ RECT *pRect = NULL;
+
+ switch (i) {
+ case 0:
+ pRect = &pContainer->rcMin;
+ hIcon = CSkin::m_minIcon;
+ break;
+ case 1:
+ pRect = &pContainer->rcMax;
+ hIcon = CSkin::m_maxIcon;
+ break;
+ case 2:
+ pRect = &pContainer->rcClose;
+ hIcon = CSkin::m_closeIcon;
+ break;
+ }
+ if (pRect) {
+ item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
+ CSkin::DrawItem(dcMem, pRect, item);
+ DrawIconEx(dcMem, pRect->left + ((pRect->right - pRect->left) / 2 - 8), pRect->top + ((pRect->bottom - pRect->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
}
+ SetBkMode(dcMem, TRANSPARENT);
+ BitBlt(dcFrame, 0, 0, rcWindow.right, rcWindow.bottom, dcMem, 0, 0, SRCCOPY);
+ SelectObject(dcMem, hbmOld);
+ DeleteObject(hbmMem);
+ DeleteDC(dcMem);
+ ReleaseDC(hwndDlg, dcFrame);
}
- SetBkMode(dcMem, TRANSPARENT);
- BitBlt(dcFrame, 0, 0, rcWindow.right, rcWindow.bottom, dcMem, 0, 0, SRCCOPY);
- SelectObject(dcMem, hbmOld);
- DeleteObject(hbmMem);
- DeleteDC(dcMem);
- ReleaseDC(hwndDlg, dcFrame);
- }
- else mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
+ else mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
- hdcReal = BeginPaint(hwndDlg, &ps);
+ hdcReal = BeginPaint(hwndDlg, &ps);
- GetClientRect(hwndDlg, &rcClient);
- width = rcClient.right - rcClient.left;
- height = rcClient.bottom - rcClient.top;
- if (width != pContainer->oldDCSize.cx || height != pContainer->oldDCSize.cy) {
- CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
- BOOL statusBarSkinnd = !(pContainer->dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
- LONG sbarDelta = statusBarSkinnd ? pContainer->statusBarHeight : 0;
-
- pContainer->oldDCSize.cx = width;
- pContainer->oldDCSize.cy = height;
-
- if (pContainer->cachedDC) {
- SelectObject(pContainer->cachedDC, pContainer->oldHBM);
- DeleteObject(pContainer->cachedHBM);
- DeleteDC(pContainer->cachedDC);
- }
- pContainer->cachedDC = CreateCompatibleDC(hdcReal);
- pContainer->cachedHBM = CreateCompatibleBitmap(hdcReal, width, height);
- pContainer->oldHBM = (HBITMAP)SelectObject(pContainer->cachedDC, pContainer->cachedHBM);
+ RECT rcClient;
+ GetClientRect(hwndDlg, &rcClient);
+ width = rcClient.right - rcClient.left;
+ height = rcClient.bottom - rcClient.top;
+ if (width != pContainer->oldDCSize.cx || height != pContainer->oldDCSize.cy) {
+ CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
+ BOOL statusBarSkinnd = !(pContainer->dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
+ LONG sbarDelta = statusBarSkinnd ? pContainer->statusBarHeight : 0;
+
+ pContainer->oldDCSize.cx = width;
+ pContainer->oldDCSize.cy = height;
+
+ if (pContainer->cachedDC) {
+ SelectObject(pContainer->cachedDC, pContainer->oldHBM);
+ DeleteObject(pContainer->cachedHBM);
+ DeleteDC(pContainer->cachedDC);
+ }
+ pContainer->cachedDC = CreateCompatibleDC(hdcReal);
+ pContainer->cachedHBM = CreateCompatibleBitmap(hdcReal, width, height);
+ pContainer->oldHBM = (HBITMAP)SelectObject(pContainer->cachedDC, pContainer->cachedHBM);
- hdc = pContainer->cachedDC;
+ hdc = pContainer->cachedDC;
- if (!CSkin::DrawItem(hdc, &rcClient, item))
- FillRect(hdc, &rcClient, GetSysColorBrush(COLOR_3DFACE));
+ if (!CSkin::DrawItem(hdc, &rcClient, item))
+ FillRect(hdc, &rcClient, GetSysColorBrush(COLOR_3DFACE));
- if (sbarDelta) {
- rcClient.top = rcClient.bottom - sbarDelta;
- CSkin::DrawItem(hdc, &rcClient, sbaritem);
+ if (sbarDelta) {
+ rcClient.top = rcClient.bottom - sbarDelta;
+ CSkin::DrawItem(hdc, &rcClient, sbaritem);
+ }
}
+ BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
+ EndPaint(hwndDlg, &ps);
+ return 0;
}
- BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
- EndPaint(hwndDlg, &ps);
- return 0;
- }
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
case WM_NCMOUSEHOVER:
@@ -409,42 +405,42 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case WM_NCHITTEST:
- {
- RECT r;
- POINT pt;
- int clip = CSkin::m_bClipBorder;
-
- if (!pContainer)
- break;
+ {
+ RECT r;
+ POINT pt;
+ int clip = CSkin::m_bClipBorder;
- if (!(pContainer->dwFlags & CNT_NOTITLE))
- break;
+ if (!pContainer)
+ break;
- GetWindowRect(hwndDlg, &r);
- GetCursorPos(&pt);
- if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTBOTTOM;
- if (pt.x < r.left + clip + 10)
- return HTBOTTOMLEFT;
- if (pt.x > r.right - clip - 10)
- return HTBOTTOMRIGHT;
+ if (!(pContainer->dwFlags & CNT_NOTITLE))
+ break;
+ GetWindowRect(hwndDlg, &r);
+ GetCursorPos(&pt);
+ if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTBOTTOM;
+ if (pt.x < r.left + clip + 10)
+ return HTBOTTOMLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTBOTTOMRIGHT;
+
+ }
+ else if (pt.y >= r.top && pt.y <= r.top + 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTTOP;
+ if (pt.x < r.left + clip + 10)
+ return HTTOPLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTTOPRIGHT;
+ }
+ else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
+ return HTLEFT;
+ else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
+ return HTRIGHT;
}
- else if (pt.y >= r.top && pt.y <= r.top + 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTTOP;
- if (pt.x < r.left + clip + 10)
- return HTTOPLEFT;
- if (pt.x > r.right - clip - 10)
- return HTTOPRIGHT;
- }
- else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
- return HTLEFT;
- else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
- return HTRIGHT;
- }
- return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
+ return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
case 0xae: // must be some undocumented message - seems it messes with the title bar...
if (CSkin::m_frameSkins)
@@ -460,9 +456,11 @@ static BOOL fHaveTipper = FALSE;
static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int iItem = 0;
- TCITEM item;
+ TCITEM tci;
RECT rc;
POINT pt;
+ MCONTACT hContact;
+ TWindowData *dat;
TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
BOOL bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
@@ -625,13 +623,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
else {
RECT rcClient, rcUnadjusted;
- TCITEM item = { 0 };
GetClientRect(hwndDlg, &rcClient);
pContainer->MenuBar->getClientRect();
if (pContainer->hwndStatus) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)dat);
RECT rcs;
@@ -675,19 +672,20 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
// just queues a resize request)
int nCount = TabCtrl_GetItemCount(hwndTab);
+ memset(&tci, 0, sizeof(tci));
for (int i = 0; i < nCount; i++) {
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item);
- if ((HWND)item.lParam == pContainer->hwndActive) {
- SetWindowPos((HWND)item.lParam, 0, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
+ tci.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, i, &tci);
+ if ((HWND)tci.lParam == pContainer->hwndActive) {
+ SetWindowPos((HWND)tci.lParam, 0, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
SWP_NOSENDCHANGING | SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
if (!pContainer->bSizingLoop && sizeChanged) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 1);
}
}
else if (sizeChanged)
- SendMessage((HWND)item.lParam, DM_CHECKSIZE, 0, 0);
+ SendMessage((HWND)tci.lParam, DM_CHECKSIZE, 0, 0);
}
pContainer->SideBar->scrollIntoView();
@@ -708,7 +706,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (CSkin::m_bRoundedCorner)
rgn = CreateRoundRectRgn(clip, clip, (rcWindow.right - rcWindow.left) - clip + 1,
- (rcWindow.bottom - rcWindow.top) - clip + 1, CSkin::m_bRoundedCorner + clip, CSkin::m_bRoundedCorner + clip);
+ (rcWindow.bottom - rcWindow.top) - clip + 1, CSkin::m_bRoundedCorner + clip, CSkin::m_bRoundedCorner + clip);
else
rgn = CreateRectRgn(clip, clip, (rcWindow.right - rcWindow.left) - clip, (rcWindow.bottom - rcWindow.top) - clip);
SetWindowRgn(hwndDlg, rgn, TRUE);
@@ -744,16 +742,16 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
return FALSE;
}
else nPanel = nm->dwItemSpec;
- panel_found:
+panel_found:
if (nPanel == 2) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
if (dat)
CheckStatusIconClick(dat, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
}
else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
GetCursorPos(&pt);
- MCONTACT hContact = 0;
+ hContact = 0;
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact) {
int iSel = 0;
@@ -771,41 +769,40 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (((LPNMHDR)lParam)->code) {
case TCN_SELCHANGE:
- memset(&item, 0, sizeof(item));
+ memset(&tci, 0, sizeof(tci));
iItem = TabCtrl_GetCurSel(hwndTab);
- item.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTab, iItem, &item)) {
- if ((HWND)item.lParam != pContainer->hwndActive)
+ tci.mask = TCIF_PARAM;
+ if (TabCtrl_GetItem(hwndTab, iItem, &tci)) {
+ if ((HWND)tci.lParam != pContainer->hwndActive)
if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
ShowWindow(pContainer->hwndActive, SW_HIDE);
- pContainer->hwndActive = (HWND)item.lParam;
- SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
- ShowWindow((HWND)item.lParam, SW_SHOW);
+ pContainer->hwndActive = (HWND)tci.lParam;
+ SendMessage((HWND)tci.lParam, DM_SAVESIZE, 0, 1);
+ ShowWindow((HWND)tci.lParam, SW_SHOW);
if (!IsIconic(hwndDlg))
SetFocus(pContainer->hwndActive);
}
SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
return 0;
- // tooltips
+ // tooltips
case NM_RCLICK:
- int iItem;
bool fFromSidebar = false;
- TCITEM item = { 0 };
- TWindowData *dat = 0;
+ memset(&tci, 0, sizeof(tci));
GetCursorPos(&pt);
HMENU subMenu = GetSubMenu(pContainer->hMenuContext, 0);
+ dat = 0;
if (((LPNMHDR)lParam)->idFrom == IDC_MSGTABS) {
if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
break;
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- if (item.lParam && IsWindow((HWND)item.lParam))
- dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ tci.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &tci);
+ if (tci.lParam && IsWindow((HWND)tci.lParam))
+ dat = (TWindowData*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
}
// sent from a sidebar button (RMB click) instead of the tab control
else if (((LPNMHDR)lParam)->idFrom == 5000) {
@@ -824,7 +821,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (iSelection - IDM_CONTAINERMENU >= 0) {
ptrT tszName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
if (tszName != NULL)
- SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, tszName);
+ SendMessage((HWND)tci.lParam, DM_CONTAINERSELECTED, 0, tszName);
}
return 1;
}
@@ -857,10 +854,10 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case ID_TABMENU_ATTACHTOCONTAINER:
if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
break;
- memset(&item, 0, sizeof(item));
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)item.lParam);
+ memset(&tci, 0, sizeof(tci));
+ tci.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &tci);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)tci.lParam);
break;
case ID_TABMENU_CONTAINEROPTIONS:
if (pContainer->hWndOptions == 0)
@@ -876,13 +873,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case WM_COMMAND:
- MCONTACT hContact;
{
bool fProcessContactMenu = pContainer->MenuBar->isContactMenu();
bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
pContainer->MenuBar->Cancel();
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DWORD dwOldFlags = pContainer->dwFlags;
if (dat) {
@@ -922,12 +918,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_SIDEBARDOWN:
case IDC_SIDEBARUP:
- {
- HWND hwnd = GetFocus();
- pContainer->SideBar->processScrollerButtons(LOWORD(wParam));
- SetFocus(hwnd);
- }
- break;
+ {
+ HWND hwnd = GetFocus();
+ pContainer->SideBar->processScrollerButtons(LOWORD(wParam));
+ SetFocus(hwnd);
+ }
+ break;
default:
Utils::CmdDispatcher(Utils::CMD_CONTAINER, hwndDlg, LOWORD(wParam), wParam, lParam, 0, pContainer);
@@ -952,18 +948,18 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_EXITSIZEMOVE:
GetClientRect(hwndTab, &rc);
if (!((rc.right - rc.left) == pContainer->oldSize.cx && (rc.bottom - rc.top) == pContainer->oldSize.cy)) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 0);
SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
}
pContainer->bSizingLoop = FALSE;
break;
- // determine minimum and maximum size limits
- // 1) for maximizing the window when the "vertical maximize" option is set
- // 2) to limit the minimum height when manually resizing the window
- // (this avoids overlapping of controls inside the window and ensures
- // that at least 2 lines of the message log are always visible).
+ // determine minimum and maximum size limits
+ // 1) for maximizing the window when the "vertical maximize" option is set
+ // 2) to limit the minimum height when manually resizing the window
+ // (this avoids overlapping of controls inside the window and ensures
+ // that at least 2 lines of the message log are always visible).
case WM_GETMINMAXINFO:
RECT rcWindow;
{
@@ -1022,47 +1018,45 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
return 0;
case DM_UPDATETITLE:
- {
- MCONTACT hContact = 0;
- TWindowData *dat = NULL;
-
- if (lParam) { // lParam != 0 means sent by a chat window
- TCHAR szText[512];
- dat = (TWindowData*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
- GetWindowText((HWND)wParam, szText, _countof(szText));
- szText[_countof(szText) - 1] = 0;
- SetWindowText(hwndDlg, szText);
- if (dat)
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
- return 0;
- }
- if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
- if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- else
- break;
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- }
- else {
- HWND hwnd = M.FindWindow(wParam);
- if (hwnd == 0) {
- SESSION_INFO *si = SM_FindSessionByHCONTACT(wParam);
- if (si) {
- SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
- return 0;
- }
+ hContact = 0;
+ dat = NULL;
+
+ if (lParam) { // lParam != 0 means sent by a chat window
+ TCHAR szText[512];
+ dat = (TWindowData*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
+ GetWindowText((HWND)wParam, szText, _countof(szText));
+ szText[_countof(szText) - 1] = 0;
+ SetWindowText(hwndDlg, szText);
+ if (dat)
+ SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
+ return 0;
+ }
+ if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
+ if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
+ SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ else
+ break;
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ }
+ else {
+ HWND hwnd = M.FindWindow(wParam);
+ if (hwnd == 0) {
+ SESSION_INFO *si = SM_FindSessionByHCONTACT(wParam);
+ if (si) {
+ SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
+ return 0;
}
- hContact = wParam;
- if (hwnd && hContact)
- dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
- if (dat) {
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabStatusIcon));
- TCHAR *szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
- if (szNewTitle) {
- SetWindowText(hwndDlg, szNewTitle);
- mir_free(szNewTitle);
- }
+ hContact = wParam;
+ if (hwnd && hContact)
+ dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ }
+ if (dat) {
+ SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabStatusIcon));
+ TCHAR *szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
+ if (szNewTitle) {
+ SetWindowText(hwndDlg, szNewTitle);
+ mir_free(szNewTitle);
}
}
return 0;
@@ -1077,7 +1071,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat && dat->bType == SESSIONTYPE_IM) {
if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
dat->Panel->Invalidate(TRUE);
@@ -1085,10 +1079,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
else if (dat)
SendMessage(dat->hwnd, GC_UPDATESTATUSBAR, 0, 0);
}
- else if (wParam == TIMERID_HOVER) {
- RECT rcWindow;
- GetWindowRect(hwndDlg, &rcWindow);
- }
break;
case WM_SYSCOMMAND:
@@ -1119,7 +1109,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
break;
case SC_MINIMIZE:
- TWindowData *dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
+ dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
if (dat) {
GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
@@ -1155,13 +1145,13 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
if (iNewTab != iCurrent) {
- memset(&item, 0, sizeof(item));
- item.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTab, iNewTab, &item)) {
+ memset(&tci, 0, sizeof(tci));
+ tci.mask = TCIF_PARAM;
+ if (TabCtrl_GetItem(hwndTab, iNewTab, &tci)) {
TabCtrl_SetCurSel(hwndTab, iNewTab);
ShowWindow(pContainer->hwndActive, SW_HIDE);
- pContainer->hwndActive = (HWND)item.lParam;
- ShowWindow((HWND)item.lParam, SW_SHOW);
+ pContainer->hwndActive = (HWND)tci.lParam;
+ ShowWindow((HWND)tci.lParam, SW_SHOW);
SetFocus(pContainer->hwndActive);
}
}
@@ -1233,9 +1223,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
}
if (pContainer->dwFlags & CNT_NEED_UPDATETITLE) {
- MCONTACT hContact = 0;
pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE;
if (pContainer->hwndActive) {
+ hContact = 0;
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact)
SendMessage(hwndDlg, DM_UPDATETITLE, hContact, 0);
@@ -1385,7 +1375,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
UINT sBarHeight;
{
HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
- MCONTACT hContact = 0;
DWORD wsold, ws = wsold = GetWindowLongPtr(hwndDlg, GWL_STYLE);
if (!CSkin::m_frameSkins) {
@@ -1427,7 +1416,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
if (pContainer->hwndActive != 0) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 0);
}
}
@@ -1505,7 +1494,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
return 0;
- // search tab with either next or most recent unread message and select it
+ // search tab with either next or most recent unread message and select it
case DM_QUERYPENDING:
RECENTINFO ri;
{
@@ -1527,7 +1516,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case DM_SETICON:
{
- TWindowData *dat = (TWindowData*)wParam;
+ dat = (TWindowData*)wParam;
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
HICON hIconBig = (dat && dat->cache) ? Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus(), true) : 0;
@@ -1597,7 +1586,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
if (dis->hwndItem == pContainer->hwndStatus && !(pContainer->dwFlags & CNT_NOSTATUSBAR)) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat)
DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
return TRUE;
@@ -1610,13 +1599,13 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case DM_QUERYCLIENTAREA:
{
- RECT *rc = (RECT *)lParam;
- if (rc) {
+ RECT *pRect = (RECT*)lParam;
+ if (pRect) {
if (!IsIconic(hwndDlg))
- GetClientRect(hwndDlg, rc);
+ GetClientRect(hwndDlg, pRect);
else
- CopyRect(rc, &pContainer->rcSaved);
- AdjustTabClientRect(pContainer, rc);
+ CopyRect(pRect, &pContainer->rcSaved);
+ AdjustTabClientRect(pContainer, pRect);
}
}
return 0;
@@ -1709,7 +1698,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item);
- MCONTACT hContact;
SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
db_set_b(hContact, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd == SW_SHOWMAXIMIZED) ? 1 : 0));
@@ -1746,7 +1734,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
for (int i = 0; i < TabCtrl_GetItemCount(hwndTab); i++) {
if (TabCtrl_GetItem(hwndTab, i, &item)) {
- MCONTACT hContact;
SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
char szCName[40];
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index b60336331a..dc6f9fc897 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -837,9 +837,9 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
TCHAR szText[1024]; szText[0] = 0;
LRESULT result = SendMessage(hWnd, SB_GETTEXT, i, (LPARAM)szText);
if (i == 2 && pContainer) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- if (dat)
- DrawStatusIcons(dat, hdcMem, itemRect, 2);
+ TWindowData *pDat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ if (pDat)
+ DrawStatusIcons(pDat, hdcMem, itemRect, 2);
}
else {
if (hIcon) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 36b9de0126..adcc0acbe8 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -215,31 +215,31 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer,
BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE);
BOOL isStrikeout = (cfOld.dwEffects & CFM_STRIKEOUT) && (cfOld.dwMask & CFM_STRIKEOUT);
- int cmd = LOWORD(wParam);
- if (cmd == IDC_FONTBOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTBOLD)))
+ int ctrlId = LOWORD(wParam);
+ if (ctrlId == IDC_FONTBOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTBOLD)))
break;
- if (cmd == IDC_FONTITALIC && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTITALIC)))
+ if (ctrlId == IDC_FONTITALIC && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTITALIC)))
break;
- if (cmd == IDC_FONTUNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTUNDERLINE)))
+ if (ctrlId == IDC_FONTUNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTUNDERLINE)))
break;
- if (cmd == IDC_FONTSTRIKEOUT && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTSTRIKEOUT)))
+ if (ctrlId == IDC_FONTSTRIKEOUT && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FONTSTRIKEOUT)))
break;
- if (cmd == IDC_FONTBOLD) {
+ if (ctrlId == IDC_FONTBOLD) {
cf.dwEffects = isBold ? 0 : CFE_BOLD;
cf.dwMask = CFM_BOLD;
CheckDlgButton(hwndDlg, IDC_FONTBOLD, !isBold ? BST_CHECKED : BST_UNCHECKED);
}
- else if (cmd == IDC_FONTITALIC) {
+ else if (ctrlId == IDC_FONTITALIC) {
cf.dwEffects = isItalic ? 0 : CFE_ITALIC;
cf.dwMask = CFM_ITALIC;
CheckDlgButton(hwndDlg, IDC_FONTITALIC, !isItalic ? BST_CHECKED : BST_UNCHECKED);
}
- else if (cmd == IDC_FONTUNDERLINE) {
+ else if (ctrlId == IDC_FONTUNDERLINE) {
cf.dwEffects = isUnderline ? 0 : CFE_UNDERLINE;
cf.dwMask = CFM_UNDERLINE;
CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, !isUnderline ? BST_CHECKED : BST_UNCHECKED);
}
- else if (cmd == IDC_FONTSTRIKEOUT) {
+ else if (ctrlId == IDC_FONTSTRIKEOUT) {
cf.dwEffects = isStrikeout ? 0 : CFM_STRIKEOUT;
cf.dwMask = CFM_STRIKEOUT;
CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, !isStrikeout ? BST_CHECKED : BST_UNCHECKED);
@@ -1184,19 +1184,19 @@ LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwda
else
GetWindowRect(GetDlgItem(hwndParent, uID), &rc);
if (PtInRect(&rc, pt)) {
- HWND hwnd = (mwdat->hwndIEView || mwdat->hwndHPP) ? mwdat->hwndIWebBrowserControl : GetDlgItem(hwndParent, uID);
+ HWND hwndLog = (mwdat->hwndIEView || mwdat->hwndHPP) ? mwdat->hwndIWebBrowserControl : GetDlgItem(hwndParent, uID);
short wDirection = (short)HIWORD(wParam);
- if (hwnd == 0)
- hwnd = WindowFromPoint(pt);
+ if (hwndLog == 0)
+ hwndLog = WindowFromPoint(pt);
if (LOWORD(wParam) & MK_SHIFT || M.GetByte("fastscroll", 0)) {
if (wDirection < 0)
- SendMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
+ SendMessage(hwndLog, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
else if (wDirection > 0)
- SendMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
+ SendMessage(hwndLog, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
}
- else SendMessage(hwnd, WM_MOUSEWHEEL, wParam, lParam);
+ else SendMessage(hwndLog, WM_MOUSEWHEEL, wParam, lParam);
return 0;
}
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 06b4c8a32e..2df19095ab 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -146,7 +146,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return 0;
}
- TContainerData *p;
+ TContainerData *pCont;
switch (msg) {
case WM_CREATE:
@@ -323,20 +323,20 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
nen_options.iNoAutoPopup ^= 1;
break;
case ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS:
- for (p = pFirstContainer; p; p = p->pNext)
- ShowWindow(p->hwnd, SW_HIDE);
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext)
+ ShowWindow(pCont->hwnd, SW_HIDE);
break;
case ID_TRAYCONTEXT_RESTOREALLMESSAGECONTAINERS:
- for (p = pFirstContainer; p; p = p->pNext)
- ShowWindow(p->hwnd, SW_SHOW);
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext)
+ ShowWindow(pCont->hwnd, SW_SHOW);
break;
case ID_TRAYCONTEXT_BE:
nen_options.iDisable = 1;
nen_options.iNoSounds = 1;
nen_options.iNoAutoPopup = 1;
- for (p = pFirstContainer; p; p = p->pNext)
- SendMessage(p->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 1);
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext)
+ SendMessage(pCont->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 1);
break;
}
}
@@ -458,18 +458,18 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
bool bNewAero = M.getAeroState(); // refresh dwm state
- for (p = pFirstContainer; p; p = p->pNext) {
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext) {
if (bNewAero)
- SetAeroMargins(p);
+ SetAeroMargins(pCont);
else {
MARGINS m = { 0 };
if (M.m_pfnDwmExtendFrameIntoClientArea)
- M.m_pfnDwmExtendFrameIntoClientArea(p->hwnd, &m);
+ M.m_pfnDwmExtendFrameIntoClientArea(pCont->hwnd, &m);
}
- if (p->SideBar)
- if (p->SideBar->isActive()) // the container for the sidebar buttons
- RedrawWindow(GetDlgItem(p->hwnd, 5000), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
- RedrawWindow(p->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ if (pCont->SideBar)
+ if (pCont->SideBar->isActive()) // the container for the sidebar buttons
+ RedrawWindow(GetDlgItem(pCont->hwnd, 5000), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(pCont->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
}
}
M.BroadcastMessage(WM_DWMCOMPOSITIONCHANGED, 0, 0);
@@ -496,9 +496,9 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
FreeTabConfig();
ReloadTabConfig();
- for (p = pFirstContainer; p; p = p->pNext) {
- SendDlgItemMessage(p->hwnd, IDC_MSGTABS, EM_THEMECHANGED, 0, 0);
- BroadCastContainer(p, EM_THEMECHANGED, 0, 0);
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext) {
+ SendDlgItemMessage(pCont->hwnd, IDC_MSGTABS, EM_THEMECHANGED, 0, 0);
+ BroadCastContainer(pCont, EM_THEMECHANGED, 0, 0);
}
break;
@@ -547,14 +547,14 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_POWERBROADCAST:
case WM_DISPLAYCHANGE:
- for (p = pFirstContainer; p; p = p->pNext)
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext)
if (CSkin::m_skinEnabled) { // invalidate cached background DCs for skinned containers
- p->oldDCSize.cx = p->oldDCSize.cy = 0;
- SelectObject(p->cachedDC, p->oldHBM);
- DeleteObject(p->cachedHBM);
- DeleteDC(p->cachedDC);
- p->cachedDC = 0;
- RedrawWindow(p->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
+ pCont->oldDCSize.cx = pCont->oldDCSize.cy = 0;
+ SelectObject(pCont->cachedDC, pCont->oldHBM);
+ DeleteObject(pCont->cachedHBM);
+ DeleteDC(pCont->cachedDC);
+ pCont->cachedDC = 0;
+ RedrawWindow(pCont->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
}
break;
@@ -570,8 +570,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (wParam == TIMERID_SENDLATER) {
// send heartbeat to each container, they use this to update
// dynamic content (i.e. local time in the info panel).
- for (p = pFirstContainer; p; p = p->pNext)
- SendMessage(p->hwnd, WM_TIMER, TIMERID_HEARTBEAT, 0);
+ for (pCont = pFirstContainer; pCont; pCont = pCont->pNext)
+ SendMessage(pCont->hwnd, WM_TIMER, TIMERID_HEARTBEAT, 0);
// process send later contacts and jobs, if enough time has elapsed
if (sendLater->isAvail() && !sendLater->isInteractive() && (time(0) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index fa76e98c0c..2cf7ed0abc 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -873,11 +873,11 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam)
return;
HWND hwndDlg = m_dat->hwnd;
-
- RECT rc;
- ::GetWindowRect(GetDlgItem(hwndDlg, ctrlId), &rc);
-
- ::SendMessage(m_dat->hwndTip, TTM_TRACKPOSITION, 0, (LPARAM)MAKELONG(rc.left, rc.bottom));
+ {
+ RECT rc;
+ ::GetWindowRect(GetDlgItem(hwndDlg, ctrlId), &rc);
+ ::SendMessage(m_dat->hwndTip, TTM_TRACKPOSITION, 0, (LPARAM)MAKELONG(rc.left, rc.bottom));
+ }
if (lParam)
m_dat->ti.lpszText = reinterpret_cast<TCHAR *>(lParam);
else {
@@ -1243,7 +1243,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
// @param pt : mouse coordinates (screen)
// @return : always 0
-int CInfoPanel::invokeConfigDialog(const POINT& pt)
+int CInfoPanel::invokeConfigDialog(const POINT &pt)
{
if (!m_active)
return 0;
@@ -1262,19 +1262,15 @@ int CInfoPanel::invokeConfigDialog(const POINT& pt)
m_hwndConfig = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_INFOPANEL), 0 /*m_dat->pContainer->hwnd */,
ConfigDlgProcStub, (LPARAM)this);
if (m_hwndConfig) {
- RECT rc, rcLog;
- POINT pt;
-
TranslateDialogDefault(m_hwndConfig);
::GetClientRect(m_hwndConfig, &rc);
+
+ RECT rcLog;
::GetWindowRect(GetDlgItem(m_dat->hwnd, m_isChat ? IDC_CHAT_LOG : IDC_LOG), &rcLog);
- pt.x = rcLog.left;
- pt.y = rcLog.top;
- //::ScreenToClient(m_dat->pContainer->hwnd, &pt);
m_fDialogCreated = true;
- ::SetWindowPos(m_hwndConfig, HWND_TOP, pt.x + 10, pt.y - (m_active ? 10 : 0), 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ ::SetWindowPos(m_hwndConfig, HWND_TOP, rcLog.left + 10, rcLog.top - (m_active ? 10 : 0), 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
return 1;
}
}
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 514e204532..9d71be195b 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -285,9 +285,9 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode)
fShow = true;
else {
if (PluginConfig.m_bHideOnClose) {
- TContainerData *pContainer = 0;
- SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer && pContainer->fHidden)
+ TContainerData *pCont = 0;
+ SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pCont);
+ if (pCont && pCont->fHidden)
fShow = true;
}
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index ab4d1c4b28..2684e40073 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -42,7 +42,8 @@ static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_R
static COLORREF rtfDefColors[] = { RGB(255, 0, 0), RGB(0, 0, 255), RGB(0, 255, 0), RGB(255, 0, 255), RGB(255, 255, 0), RGB(0, 255, 255), 0, RGB(255, 255, 255) };
-static struct {
+static struct
+{
int id;
const TCHAR* text;
}
@@ -103,7 +104,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt)
EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
}
- if (idFrom == IDC_LOG) {
+ if (idFrom == IDC_LOG) {
InsertMenuA(hSubMenu, 6, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED));
}
@@ -232,8 +233,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (wParam != VK_PRIOR && wParam != VK_NEXT && wParam != VK_DELETE &&
wParam != VK_MENU && wParam != VK_END && wParam != VK_HOME &&
wParam != VK_UP && wParam != VK_DOWN && wParam != VK_LEFT &&
- wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE)
- {
+ wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE) {
SetFocus(GetDlgItem(mwdat->hwnd, IDC_MESSAGE));
keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam, 0), KEYEVENTF_EXTENDEDKEY | 0, 0);
return 0;
@@ -892,28 +892,28 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
- {
- BYTE bSync = M.GetByte(CHAT_MODULE, "SyncSplitter", 0);
- DWORD dwOff_IM = 0, dwOff_CHAT = 0;
-
- dwOff_CHAT = -(2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0));
- dwOff_IM = 2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0);
-
- RECT rcWin;
- GetWindowRect(hwndParent, &rcWin);
-
- PluginConfig.lastSPlitterPos.pSrcDat = dat;
- PluginConfig.lastSPlitterPos.pSrcContainer = dat->pContainer;
- PluginConfig.lastSPlitterPos.lParam = rc.bottom;
- PluginConfig.lastSPlitterPos.pos = rcWin.bottom - HIWORD(messagePos);
- PluginConfig.lastSPlitterPos.pos_chat = rcWin.bottom - (short)HIWORD(messagePos) + rc.bottom / 2;
- PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
- PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
- PluginConfig.lastSPlitterPos.bSync = bSync;
- SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
- M.BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
- }
- break;
+ {
+ BYTE bSync = M.GetByte(CHAT_MODULE, "SyncSplitter", 0);
+ DWORD dwOff_IM = 0, dwOff_CHAT = 0;
+
+ dwOff_CHAT = -(2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0));
+ dwOff_IM = 2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0);
+
+ RECT rcWin;
+ GetWindowRect(hwndParent, &rcWin);
+
+ PluginConfig.lastSPlitterPos.pSrcDat = dat;
+ PluginConfig.lastSPlitterPos.pSrcContainer = dat->pContainer;
+ PluginConfig.lastSPlitterPos.lParam = rc.bottom;
+ PluginConfig.lastSPlitterPos.pos = rcWin.bottom - HIWORD(messagePos);
+ PluginConfig.lastSPlitterPos.pos_chat = rcWin.bottom - (short)HIWORD(messagePos) + rc.bottom / 2;
+ PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
+ PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
+ PluginConfig.lastSPlitterPos.bSync = bSync;
+ SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
+ M.BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
+ }
+ break;
default:
dat->splitterY = dat->savedSplitY;
@@ -1012,7 +1012,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *
if (dat->hwndContactPic) //if Panel control was created?
SetWindowPos(dat->hwndContactPic, HWND_TOP, 1, ((urc->rcItem.bottom - urc->rcItem.top) - (dat->pic.cy)) / 2 + 1, //resizes it
- dat->pic.cx - 2, dat->pic.cy - 2, SWP_SHOWWINDOW);
+ dat->pic.cx - 2, dat->pic.cy - 2, SWP_SHOWWINDOW);
return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
@@ -1122,7 +1122,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *
return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
}
-INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TContainerData *m_pContainer = 0;
TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -1132,7 +1132,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TNewWindowData *newData;
if (dat == 0) {
- if (msg == WM_ACTIVATE || msg == WM_SETFOCUS)
+ if (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)
return 0;
hwndContainer = NULL;
}
@@ -1141,7 +1141,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
hwndContainer = m_pContainer->hwnd;
}
- switch (msg) {
+ switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
newData = (TNewWindowData*)lParam;
@@ -1645,363 +1645,363 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case IDC_MESSAGE:
switch (((NMHDR*)lParam)->code) {
case EN_MSGFILTER:
- {
- DWORD msg = ((MSGFILTER *)lParam)->msg;
- WPARAM wp = ((MSGFILTER *)lParam)->wParam;
- LPARAM lp = ((MSGFILTER *)lParam)->lParam;
- CHARFORMAT2 cf2;
- BOOL isCtrl, isShift, isAlt;
- KbdState(dat, isShift, isCtrl, isAlt);
-
- MSG message;
- message.hwnd = hwndDlg;
- message.message = msg;
- message.lParam = lp;
- message.wParam = wp;
-
- if (msg == WM_SYSKEYUP) {
- if (wp == VK_MENU)
- if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
- m_pContainer->MenuBar->autoShow();
-
- return _dlgReturn(hwndDlg, 0);
- }
+ {
+ DWORD msg = ((MSGFILTER *)lParam)->msg;
+ WPARAM wp = ((MSGFILTER *)lParam)->wParam;
+ LPARAM lp = ((MSGFILTER *)lParam)->lParam;
+ CHARFORMAT2 cf2;
+ BOOL isCtrl, isShift, isAlt;
+ KbdState(dat, isShift, isCtrl, isAlt);
+
+ MSG message;
+ message.hwnd = hwndDlg;
+ message.message = msg;
+ message.lParam = lp;
+ message.wParam = wp;
+
+ if (msg == WM_SYSKEYUP) {
+ if (wp == VK_MENU)
+ if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
+ m_pContainer->MenuBar->autoShow();
+
+ return _dlgReturn(hwndDlg, 0);
+ }
- if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
- LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)TABSRMM_HK_SECTION_IM);
- if (mim_hotkey_check)
- dat->fkeyProcessed = true;
+ if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
+ LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)TABSRMM_HK_SECTION_IM);
+ if (mim_hotkey_check)
+ dat->fkeyProcessed = true;
- switch (mim_hotkey_check) {
- case TABSRMM_HK_SETUSERPREFS:
- CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_NUDGE:
- SendNudge(dat);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_SENDFILE:
- CallService(MS_FILE_SENDFILE, dat->hContact, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_QUOTEMSG:
- SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_USERMENU:
- SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOCOL, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_USERDETAILS:
- SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_EDITNOTES:
- PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_TOGGLESENDLATER:
- if (sendLater->isAvail()) {
- dat->sendMode ^= SMODE_SENDLATER;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER |
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS);
+ switch (mim_hotkey_check) {
+ case TABSRMM_HK_SETUSERPREFS:
+ CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_NUDGE:
+ SendNudge(dat);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_SENDFILE:
+ CallService(MS_FILE_SENDFILE, dat->hContact, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_QUOTEMSG:
+ SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_USERMENU:
+ SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOCOL, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_USERDETAILS:
+ SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_EDITNOTES:
+ PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_TOGGLESENDLATER:
+ if (sendLater->isAvail()) {
+ dat->sendMode ^= SMODE_SENDLATER;
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER |
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS);
+ RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ }
+ else
+ CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message sessions->Advanced tweaks\\b0. Changing this option requires a restart."));
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_TOGGLERTL:
+ dat->dwFlags ^= MWF_LOG_RTL;
+ {
+ DWORD dwGlobal = M.GetDword("mwflags", MWF_LOG_DEFAULT);
+ DWORD dwMask = M.GetDword(dat->hContact, "mwmask", 0);
+ DWORD dwFlags = M.GetDword(dat->hContact, "mwflags", 0);
+
+ if ((dwGlobal & MWF_LOG_RTL) != (dat->dwFlags & MWF_LOG_RTL)) {
+ dwMask |= MWF_LOG_RTL;
+ dwFlags |= (dat->dwFlags & MWF_LOG_RTL);
+ }
+ else {
+ dwMask &= ~MWF_LOG_RTL;
+ dwFlags &= ~MWF_LOG_RTL;
+ }
+ if (dwMask) {
+ db_set_dw(dat->hContact, SRMSGMOD_T, "mwmask", dwMask);
+ db_set_dw(dat->hContact, SRMSGMOD_T, "mwflags", dwFlags);
+ }
+ else {
+ db_unset(dat->hContact, SRMSGMOD_T, "mwmask");
+ db_unset(dat->hContact, SRMSGMOD_T, "mwflags");
+ }
+ SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
+ SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
+ }
+ return _dlgReturn(hwndDlg, 1);
+
+ case TABSRMM_HK_TOGGLEMULTISEND:
+ dat->sendMode ^= SMODE_MULTIPLE;
+ if (dat->sendMode & SMODE_MULTIPLE)
+ DM_CreateClist(dat);
+ else if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST)))
+ DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST));
+
+ HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
+ DM_ScrollToBottom(dat, 0, 0);
+ Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_CLIST, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ if (dat->sendMode & SMODE_MULTIPLE)
+ SetFocus(GetDlgItem(hwndDlg, IDC_CLIST));
+ else
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ return _dlgReturn(hwndDlg, 1);
}
- else
- CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message sessions->Advanced tweaks\\b0. Changing this option requires a restart."));
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_TOGGLERTL:
- dat->dwFlags ^= MWF_LOG_RTL;
- {
- DWORD dwGlobal = M.GetDword("mwflags", MWF_LOG_DEFAULT);
- DWORD dwMask = M.GetDword(dat->hContact, "mwmask", 0);
- DWORD dwFlags = M.GetDword(dat->hContact, "mwflags", 0);
+ if (DM_GenericHotkeysCheck(&message, dat)) {
+ dat->fkeyProcessed = true;
+ return _dlgReturn(hwndDlg, 1);
+ }
+ }
+ if (wp == VK_BROWSER_BACK || wp == VK_BROWSER_FORWARD)
+ return 1;
- if ((dwGlobal & MWF_LOG_RTL) != (dat->dwFlags & MWF_LOG_RTL)) {
- dwMask |= MWF_LOG_RTL;
- dwFlags |= (dat->dwFlags & MWF_LOG_RTL);
+ if (msg == WM_CHAR) {
+ if (isCtrl && !isShift && !isAlt) {
+ switch (wp) {
+ case 23: // ctrl - w
+ PostMessage(hwndDlg, WM_CLOSE, 1, 0);
+ break;
+ case 19:
+ PostMessage(hwndDlg, WM_COMMAND, IDC_SENDMENU, IDC_SENDMENU);
+ break;
+ case 16:
+ PostMessage(hwndDlg, WM_COMMAND, IDC_PROTOMENU, IDC_PROTOMENU);
+ break;
+ case 20:
+ PostMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 1);
+ break;
}
- else {
- dwMask &= ~MWF_LOG_RTL;
- dwFlags &= ~MWF_LOG_RTL;
+ return 1;
+ }
+ }
+ if (msg == WM_KEYDOWN) {
+ if ((wp == VK_INSERT && isShift && !isCtrl) || (wp == 'V' && isCtrl && !isShift && !isAlt)) {
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ _clrMsgFilter(lParam);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (isCtrl && isShift) {
+ if (wp == 0x9) { // ctrl-shift tab
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ _clrMsgFilter(lParam);
+ return _dlgReturn(hwndDlg, 1);
}
- if (dwMask) {
- db_set_dw(dat->hContact, SRMSGMOD_T, "mwmask", dwMask);
- db_set_dw(dat->hContact, SRMSGMOD_T, "mwflags", dwFlags);
+ }
+ if (isCtrl && !isShift && !isAlt) {
+ if (wp == VK_TAB) {
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ _clrMsgFilter(lParam);
+ return _dlgReturn(hwndDlg, 1);
}
- else {
- db_unset(dat->hContact, SRMSGMOD_T, "mwmask");
- db_unset(dat->hContact, SRMSGMOD_T, "mwflags");
+ if (wp == VK_F4) {
+ PostMessage(hwndDlg, WM_CLOSE, 1, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_PRIOR) {
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_NEXT) {
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ return _dlgReturn(hwndDlg, 1);
}
- SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
- }
- return _dlgReturn(hwndDlg, 1);
-
- case TABSRMM_HK_TOGGLEMULTISEND:
- dat->sendMode ^= SMODE_MULTIPLE;
- if (dat->sendMode & SMODE_MULTIPLE)
- DM_CreateClist(dat);
- else if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST)))
- DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST));
-
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
- SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
- DM_ScrollToBottom(dat, 0, 0);
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_CLIST, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- if (dat->sendMode & SMODE_MULTIPLE)
- SetFocus(GetDlgItem(hwndDlg, IDC_CLIST));
- else
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
- return _dlgReturn(hwndDlg, 1);
- }
- if (DM_GenericHotkeysCheck(&message, dat)) {
- dat->fkeyProcessed = true;
- return _dlgReturn(hwndDlg, 1);
- }
- }
- if (wp == VK_BROWSER_BACK || wp == VK_BROWSER_FORWARD)
- return 1;
-
- if (msg == WM_CHAR) {
- if (isCtrl && !isShift && !isAlt) {
- switch (wp) {
- case 23: // ctrl - w
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- break;
- case 19:
- PostMessage(hwndDlg, WM_COMMAND, IDC_SENDMENU, IDC_SENDMENU);
- break;
- case 16:
- PostMessage(hwndDlg, WM_COMMAND, IDC_PROTOMENU, IDC_PROTOMENU);
- break;
- case 20:
- PostMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 1);
- break;
}
- return 1;
}
- }
- if (msg == WM_KEYDOWN) {
- if ((wp == VK_INSERT && isShift && !isCtrl) || (wp == 'V' && isCtrl && !isShift && !isAlt)) {
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
- _clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
- }
- if (isCtrl && isShift) {
- if (wp == 0x9) { // ctrl-shift tab
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
- _clrMsgFilter(lParam);
+ if (msg == WM_SYSKEYDOWN && isAlt) {
+ if (wp == 0x52) {
+ SendMessage(hwndDlg, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
return _dlgReturn(hwndDlg, 1);
}
- }
- if (isCtrl && !isShift && !isAlt) {
- if (wp == VK_TAB) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- _clrMsgFilter(lParam);
+ if (wp == VK_MULTIPLY) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
return _dlgReturn(hwndDlg, 1);
}
- if (wp == VK_F4) {
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
+ if (wp == VK_DIVIDE) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
return _dlgReturn(hwndDlg, 1);
}
- if (wp == VK_PRIOR) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ if (wp == VK_ADD) {
+ SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_NEXT, 0);
return _dlgReturn(hwndDlg, 1);
}
- if (wp == VK_NEXT) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ if (wp == VK_SUBTRACT) {
+ SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_PREV, 0);
return _dlgReturn(hwndDlg, 1);
}
}
- }
- if (msg == WM_SYSKEYDOWN && isAlt) {
- if (wp == 0x52) {
- SendMessage(hwndDlg, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_MULTIPLY) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_DIVIDE) {
- SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_ADD) {
- SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_SUBTRACT) {
- SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- }
-
- if (msg == WM_KEYDOWN && wp == VK_F12) {
- if (isShift || isCtrl || isAlt)
- return _dlgReturn(hwndDlg, 1);
- if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
- SendMessage(hwndDlg, DM_REPLAYQUEUE, 0, 0);
- dat->dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, (dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
- else
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 1, 1);
- return _dlgReturn(hwndDlg, 1);
- }
- // tabulation mod
- if (msg == WM_KEYDOWN && wp == VK_TAB) {
- if (PluginConfig.m_bAllowTab) {
- if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE)
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)"\t");
- _clrMsgFilter(lParam);
- if (((NMHDR*)lParam)->idFrom != IDC_MESSAGE)
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ if (msg == WM_KEYDOWN && wp == VK_F12) {
+ if (isShift || isCtrl || isAlt)
+ return _dlgReturn(hwndDlg, 1);
+ if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
+ SendMessage(hwndDlg, DM_REPLAYQUEUE, 0, 0);
+ dat->dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, (dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE);
+ if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
+ else
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 1, 1);
return _dlgReturn(hwndDlg, 1);
}
- else {
- if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
- if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR))
- SetFocus(GetDlgItem(hwndDlg, IDOK));
- else
- SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
+
+ // tabulation mod
+ if (msg == WM_KEYDOWN && wp == VK_TAB) {
+ if (PluginConfig.m_bAllowTab) {
+ if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE)
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)"\t");
+ _clrMsgFilter(lParam);
+ if (((NMHDR*)lParam)->idFrom != IDC_MESSAGE)
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
return _dlgReturn(hwndDlg, 1);
}
- if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
+ else {
+ if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
+ if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR))
+ SetFocus(GetDlgItem(hwndDlg, IDOK));
+ else
+ SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ return _dlgReturn(hwndDlg, 1);
+ }
}
+ return _dlgReturn(hwndDlg, 0);
}
- return _dlgReturn(hwndDlg, 0);
- }
- if (msg == WM_MOUSEWHEEL && (((NMHDR*)lParam)->idFrom == IDC_LOG || ((NMHDR*)lParam)->idFrom == IDC_MESSAGE)) {
- GetCursorPos(&pt);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
- if (PtInRect(&rc, pt)) {
- short wDirection = (short)HIWORD(wp);
- if (LOWORD(wp) & MK_SHIFT) {
- if (wDirection < 0)
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
- else if (wDirection > 0)
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
+ if (msg == WM_MOUSEWHEEL && (((NMHDR*)lParam)->idFrom == IDC_LOG || ((NMHDR*)lParam)->idFrom == IDC_MESSAGE)) {
+ GetCursorPos(&pt);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
+ if (PtInRect(&rc, pt)) {
+ short wDirection = (short)HIWORD(wp);
+ if (LOWORD(wp) & MK_SHIFT) {
+ if (wDirection < 0)
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
+ else if (wDirection > 0)
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
+ return 0;
+ }
return 0;
}
- return 0;
+ return 1;
}
- return 1;
- }
- if (msg == WM_CHAR && wp == 'c') {
- if (isCtrl) {
- SendDlgItemMessage(hwndDlg, ((NMHDR*)lParam)->code, WM_COPY, 0, 0);
- break;
- }
- }
- if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && ((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
- int bBold = IsDlgButtonChecked(hwndDlg, IDC_FONTBOLD);
- int bItalic = IsDlgButtonChecked(hwndDlg, IDC_FONTITALIC);
- int bUnder = IsDlgButtonChecked(hwndDlg, IDC_FONTUNDERLINE);
- int bStrikeout = IsDlgButtonChecked(hwndDlg, IDC_FONTSTRIKEOUT);
-
- cf2.cbSize = sizeof(CHARFORMAT2);
- cf2.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_UNDERLINETYPE | CFM_STRIKEOUT;
- cf2.dwEffects = 0;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
- if (cf2.dwEffects & CFE_BOLD) {
- if (bBold == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_CHECKED);
+ if (msg == WM_CHAR && wp == 'c') {
+ if (isCtrl) {
+ SendDlgItemMessage(hwndDlg, ((NMHDR*)lParam)->code, WM_COPY, 0, 0);
+ break;
+ }
}
- else if (bBold == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
+ if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && ((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
+ int bBold = IsDlgButtonChecked(hwndDlg, IDC_FONTBOLD);
+ int bItalic = IsDlgButtonChecked(hwndDlg, IDC_FONTITALIC);
+ int bUnder = IsDlgButtonChecked(hwndDlg, IDC_FONTUNDERLINE);
+ int bStrikeout = IsDlgButtonChecked(hwndDlg, IDC_FONTSTRIKEOUT);
+
+ cf2.cbSize = sizeof(CHARFORMAT2);
+ cf2.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_UNDERLINETYPE | CFM_STRIKEOUT;
+ cf2.dwEffects = 0;
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+ if (cf2.dwEffects & CFE_BOLD) {
+ if (bBold == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_CHECKED);
+ }
+ else if (bBold == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
- if (cf2.dwEffects & CFE_ITALIC) {
- if (bItalic == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_CHECKED);
- }
- else if (bItalic == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
+ if (cf2.dwEffects & CFE_ITALIC) {
+ if (bItalic == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_CHECKED);
+ }
+ else if (bItalic == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
- if (cf2.dwEffects & CFE_UNDERLINE && (cf2.bUnderlineType & CFU_UNDERLINE || cf2.bUnderlineType & CFU_UNDERLINEWORD)) {
- if (bUnder == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_CHECKED);
- }
- else if (bUnder == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
+ if (cf2.dwEffects & CFE_UNDERLINE && (cf2.bUnderlineType & CFU_UNDERLINE || cf2.bUnderlineType & CFU_UNDERLINEWORD)) {
+ if (bUnder == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_CHECKED);
+ }
+ else if (bUnder == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
- if (cf2.dwEffects & CFE_STRIKEOUT) {
- if (bStrikeout == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_CHECKED);
- }
- else if (bStrikeout == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
- }
- switch (msg) {
- case WM_LBUTTONDOWN:
- {
- HCURSOR hCur = GetCursor();
- m_pContainer->MenuBar->Cancel();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
+ if (cf2.dwEffects & CFE_STRIKEOUT) {
+ if (bStrikeout == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_CHECKED);
}
+ else if (bStrikeout == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
}
- break;
-
- // auto-select-and-copy handling...
- // if enabled, releasing the lmb with an active selection automatically copies the selection
- // to the clipboard.
- // holding ctrl while releasing the button pastes the selection to the input area, using plain text
- // holding ctrl-alt does the same, but pastes formatted text
- case WM_LBUTTONUP:
- if (((NMHDR*)lParam)->idFrom == IDC_LOG && M.GetByte("autocopy", 1)) {
- CHARRANGE cr;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&cr);
- if (cr.cpMax == cr.cpMin)
- break;
- cr.cpMin = cr.cpMax;
- if (isCtrl) {
- SETTEXTEX stx = { ST_KEEPUNDO | ST_SELECTION, CP_UTF8 };
- char *streamOut = NULL;
- if (isAlt)
- streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION);
- else
- streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION);
- if (streamOut) {
- Utils::FilterEventMarkers(streamOut);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
- mir_free(streamOut);
+ switch (msg) {
+ case WM_LBUTTONDOWN:
+ {
+ HCURSOR hCur = GetCursor();
+ m_pContainer->MenuBar->Cancel();
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
+ || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
}
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
- else if (!isShift) {
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_COPY, 0, 0);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- if (m_pContainer->hwndStatus)
- SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)TranslateT("Selection copied to clipboard"));
+ break;
+
+ // auto-select-and-copy handling...
+ // if enabled, releasing the lmb with an active selection automatically copies the selection
+ // to the clipboard.
+ // holding ctrl while releasing the button pastes the selection to the input area, using plain text
+ // holding ctrl-alt does the same, but pastes formatted text
+ case WM_LBUTTONUP:
+ if (((NMHDR*)lParam)->idFrom == IDC_LOG && M.GetByte("autocopy", 1)) {
+ CHARRANGE cr;
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&cr);
+ if (cr.cpMax == cr.cpMin)
+ break;
+ cr.cpMin = cr.cpMax;
+ if (isCtrl) {
+ SETTEXTEX stx = { ST_KEEPUNDO | ST_SELECTION, CP_UTF8 };
+ char *streamOut = NULL;
+ if (isAlt)
+ streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION);
+ else
+ streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION);
+ if (streamOut) {
+ Utils::FilterEventMarkers(streamOut);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
+ mir_free(streamOut);
+ }
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ }
+ else if (!isShift) {
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_COPY, 0, 0);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ if (m_pContainer->hwndStatus)
+ SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)TranslateT("Selection copied to clipboard"));
+ }
}
- }
- break;
+ break;
- case WM_RBUTTONUP:
- return _dlgReturn(hwndDlg, 1);
+ case WM_RBUTTONUP:
+ return _dlgReturn(hwndDlg, 1);
- case WM_MOUSEMOVE:
- GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
+ case WM_MOUSEMOVE:
+ GetCursorPos(&pt);
+ DM_DismissTip(dat, pt);
+ dat->Panel->trackMouse(pt);
- HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
- SetCursor(LoadCursor(NULL, IDC_ARROW));
- break;
+ HCURSOR hCur = GetCursor();
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
+ break;
+ }
}
- }
- break;
+ break;
case EN_REQUESTRESIZE:
DM_HandleAutoSizeRequest(dat, (REQRESIZE *)lParam);
@@ -2054,16 +2054,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case DM_TYPING:
- {
- int preTyping = dat->nTypeSecs != 0;
- dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
+ {
+ int preTyping = dat->nTypeSecs != 0;
+ dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
- if (dat->nTypeSecs)
- dat->bShowTyping = 0;
+ if (dat->nTypeSecs)
+ dat->bShowTyping = 0;
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping);
- }
- return TRUE;
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping);
+ }
+ return TRUE;
case DM_UPDATEWINICON:
if (dat->hXStatusIcon) {
@@ -2202,7 +2202,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
DM_RecalcPictureSize(dat);
}
- else if (dat->splitterY > (rc.bottom - rc.top)) {
+ else if (dat->splitterY >(rc.bottom - rc.top)) {
dat->splitterY = oldSplitterY;
dat->dynaSplitter = oldDynaSplitter;
DM_RecalcPictureSize(dat);
@@ -2217,10 +2217,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
- POINT pt = { 0, wParam };
- ScreenToClient(hwndDlg, &pt);
- if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30))
- dat->Panel->setHeight(pt.y + 2, true);
+ POINT pnt = { 0, (int)wParam };
+ ScreenToClient(hwndDlg, &pnt);
+ if ((pnt.y + 2 >= MIN_PANELHEIGHT + 2) && (pnt.y + 2 < 100) && (pnt.y + 2 < rc.bottom - 30))
+ dat->Panel->setHeight(pnt.y + 2, true);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
if (M.isAero())
@@ -2418,9 +2418,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
return 0;
- // return timestamp (in ticks) of last recent message which has not been read yet.
- // 0 if there is none
- // lParam = pointer to a dword receiving the value.
+ // return timestamp (in ticks) of last recent message which has not been read yet.
+ // 0 if there is none
+ // lParam = pointer to a dword receiving the value.
case DM_QUERYLASTUNREAD:
{
DWORD *pdw = (DWORD *)lParam;
@@ -2701,113 +2701,113 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case IDC_QUOTE:
- {
- CHARRANGE sel;
- SETTEXTEX stx = { ST_SELECTION, 1200 };
+ {
+ CHARRANGE sel;
+ SETTEXTEX stx = { ST_SELECTION, 1200 };
- MEVENT hDBEvent = 0;
- if (dat->hwndIEView || dat->hwndHPP) { // IEView quoting support..
- TCHAR *selected = 0;
+ MEVENT hDBEvent = 0;
+ if (dat->hwndIEView || dat->hwndHPP) { // IEView quoting support..
+ TCHAR *selected = 0;
- IEVIEWEVENT event = { sizeof(event) };
- event.hContact = dat->hContact;
- event.dwFlags = 0;
- event.iType = IEE_GET_SELECTION;
+ IEVIEWEVENT event = { sizeof(event) };
+ event.hContact = dat->hContact;
+ event.dwFlags = 0;
+ event.iType = IEE_GET_SELECTION;
- if (dat->hwndIEView) {
- event.hwnd = dat->hwndIEView;
- selected = (TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
- }
- else {
- event.hwnd = dat->hwndHPP;
- selected = (TCHAR*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
- }
+ if (dat->hwndIEView) {
+ event.hwnd = dat->hwndIEView;
+ selected = (TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
+ }
+ else {
+ event.hwnd = dat->hwndHPP;
+ selected = (TCHAR*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
+ }
- if (selected != NULL) {
- ptrT szQuoted(QuoteText(selected));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- break;
- }
- else {
- hDBEvent = db_event_last(dat->hContact);
- goto quote_from_last;
+ if (selected != NULL) {
+ ptrT szQuoted(QuoteText(selected));
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ break;
+ }
+ else {
+ hDBEvent = db_event_last(dat->hContact);
+ goto quote_from_last;
+ }
}
- }
- hDBEvent = dat->hDbEventLast;
+ hDBEvent = dat->hDbEventLast;
- quote_from_last:
- if (hDBEvent == NULL)
- break;
+quote_from_last:
+ if (hDBEvent == NULL)
+ break;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax) {
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.cbBlob = db_event_getBlobSize(hDBEvent);
- TCHAR *szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
- dbei.pBlob = (BYTE*)szText;
- db_event_get(hDBEvent, &dbei);
- int iSize = int(mir_strlen((char*)dbei.pBlob)) + 1;
-
- bool bNeedsFree = false;
- TCHAR *szConverted;
- if (dbei.flags & DBEF_UTF) {
- szConverted = mir_utf8decodeW((char*)szText);
- bNeedsFree = true;
- }
- else {
- if (iSize != (int)dbei.cbBlob)
- szConverted = (TCHAR*)&dbei.pBlob[iSize];
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax) {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = db_event_getBlobSize(hDBEvent);
+ TCHAR *szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
+ dbei.pBlob = (BYTE*)szText;
+ db_event_get(hDBEvent, &dbei);
+ int iSize = int(mir_strlen((char*)dbei.pBlob)) + 1;
+
+ bool bNeedsFree = false;
+ TCHAR *szConverted;
+ if (dbei.flags & DBEF_UTF) {
+ szConverted = mir_utf8decodeW((char*)szText);
+ bNeedsFree = true;
+ }
else {
- szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * iSize);
+ if (iSize != (int)dbei.cbBlob)
+ szConverted = (TCHAR*)&dbei.pBlob[iSize];
+ else {
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * iSize);
+ bNeedsFree = true;
+ MultiByteToWideChar(CP_ACP, 0, (char*)dbei.pBlob, -1, szConverted, iSize);
+ }
+ }
+ if (dbei.eventType == EVENTTYPE_FILE) {
+ size_t iDescr = mir_strlen((char *)(szText + sizeof(DWORD)));
+ memmove(szText, szText + sizeof(DWORD), iDescr);
+ memmove(szText + iDescr + 2, szText + sizeof(DWORD) + iDescr, dbei.cbBlob - iDescr - sizeof(DWORD) - 1);
+ szText[iDescr] = '\r';
+ szText[iDescr + 1] = '\n';
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + mir_strlen((char *)szText)));
+ MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + (int)mir_strlen((char *)szText));
bNeedsFree = true;
- MultiByteToWideChar(CP_ACP, 0, (char*)dbei.pBlob, -1, szConverted, iSize);
}
+ if (szConverted != NULL) {
+ ptrT szQuoted(QuoteText(szConverted));
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ }
+ mir_free(szText);
+ if (bNeedsFree)
+ mir_free(szConverted);
}
- if (dbei.eventType == EVENTTYPE_FILE) {
- size_t iDescr = mir_strlen((char *)(szText + sizeof(DWORD)));
- memmove(szText, szText + sizeof(DWORD), iDescr);
- memmove(szText + iDescr + 2, szText + sizeof(DWORD) + iDescr, dbei.cbBlob - iDescr - sizeof(DWORD) - 1);
- szText[iDescr] = '\r';
- szText[iDescr + 1] = '\n';
- szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + mir_strlen((char *)szText)));
- MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + (int)mir_strlen((char *)szText));
- bNeedsFree = true;
- }
- if (szConverted != NULL) {
- ptrT szQuoted(QuoteText(szConverted));
+ else {
+ ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION));
+ ptrW converted(mir_utf8decodeW(szFromStream));
+ Utils::FilterEventMarkers(converted);
+ ptrT szQuoted(QuoteText(converted));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
}
- mir_free(szText);
- if (bNeedsFree)
- mir_free(szConverted);
- }
- else {
- ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION));
- ptrW converted(mir_utf8decodeW(szFromStream));
- Utils::FilterEventMarkers(converted);
- ptrT szQuoted(QuoteText(converted));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- }
- break;
+ break;
case IDC_ADD:
- {
- ADDCONTACTSTRUCT acs = { 0 };
- acs.hContact = dat->hContact;
- acs.handleType = HANDLE_CONTACT;
- acs.szProto = 0;
- CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- if (!db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
- dat->bNotOnList = FALSE;
- ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hContact = dat->hContact;
+ acs.handleType = HANDLE_CONTACT;
+ acs.szProto = 0;
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+ if (!db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
+ dat->bNotOnList = FALSE;
+ ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
+ if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ }
}
- }
- break;
+ break;
case IDC_CANCELADD:
dat->bNotOnList = FALSE;
@@ -2846,23 +2846,23 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case WM_CONTEXTMENU:
- {
- DWORD idFrom = GetDlgCtrlID((HWND)wParam);
- if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
- BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
- break;
+ {
+ DWORD idFrom = GetDlgCtrlID((HWND)wParam);
+ if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
+ BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
+ break;
+ }
}
- }
- break;
-
- // this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
- // it receives:
- // wParam = index of the sendjob in the queue in the low word, index of the found sendID in the high word
- // (normally 0, but if its a multisend job, then the sendjob may contain more than one hContact/hSendId pairs.)
- // lParam = the original ackdata
- //
- // the "per message window" ACK hook is gone, the global ack handler cares about all types of ack's (currently
- // *_MESSAGE and *_AVATAR and dispatches them to the owner windows).
+ break;
+
+ // this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
+ // it receives:
+ // wParam = index of the sendjob in the queue in the low word, index of the found sendID in the high word
+ // (normally 0, but if its a multisend job, then the sendjob may contain more than one hContact/hSendId pairs.)
+ // lParam = the original ackdata
+ //
+ // the "per message window" ACK hook is gone, the global ack handler cares about all types of ack's (currently
+ // *_MESSAGE and *_AVATAR and dispatches them to the owner windows).
case HM_EVENTSENT:
sendQueue->ackMessage(dat, wParam, lParam);
return 0;
@@ -2874,29 +2874,29 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// sent by the select container dialog box when a container was selected...
// lParam = (TCHAR*)selected name...
case DM_CONTAINERSELECTED:
- {
- TCHAR *szNewName = (TCHAR*)lParam;
- if (!mir_tstrcmp(szNewName, TranslateT("Default container")))
- szNewName = CGlobals::m_default_container_name;
-
- int iOldItems = TabCtrl_GetItemCount(hwndTab);
- if (!_tcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
- break;
+ {
+ TCHAR *szNewName = (TCHAR*)lParam;
+ if (!mir_tstrcmp(szNewName, TranslateT("Default container")))
+ szNewName = CGlobals::m_default_container_name;
- TContainerData *pNewContainer = FindContainerByName(szNewName);
- if (pNewContainer == NULL)
- if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
+ int iOldItems = TabCtrl_GetItemCount(hwndTab);
+ if (!_tcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
break;
- db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
- dat->fIsReattach = TRUE;
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, dat->hContact);
- if (iOldItems > 1) // there were more than 1 tab, container is still valid
- SendMessage(m_pContainer->hwndActive, WM_SIZE, 0, 0);
- SetForegroundWindow(pNewContainer->hwnd);
- SetActiveWindow(pNewContainer->hwnd);
- }
- break;
+ TContainerData *pNewContainer = FindContainerByName(szNewName);
+ if (pNewContainer == NULL)
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
+ break;
+
+ db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
+ dat->fIsReattach = TRUE;
+ PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, dat->hContact);
+ if (iOldItems > 1) // there were more than 1 tab, container is still valid
+ SendMessage(m_pContainer->hwndActive, WM_SIZE, 0, 0);
+ SetForegroundWindow(pNewContainer->hwnd);
+ SetActiveWindow(pNewContainer->hwnd);
+ }
+ break;
case DM_STATUSBARCHANGED:
UpdateStatusBar(dat);
@@ -2946,25 +2946,25 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case DM_MYAVATARCHANGED:
- {
- const char *szProto = dat->cache->getActiveProto();
- if (!mir_strcmp((char *)wParam, szProto) && mir_strlen(szProto) == mir_strlen((char *)wParam))
- LoadOwnAvatar(dat);
- }
- break;
+ {
+ const char *szProto = dat->cache->getActiveProto();
+ if (!mir_strcmp((char *)wParam, szProto) && mir_strlen(szProto) == mir_strlen((char *)wParam))
+ LoadOwnAvatar(dat);
+ }
+ break;
case DM_GETWINDOWSTATE:
- {
- UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(hwndDlg))
- state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == hwndContainer)
- state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(hwndContainer))
- state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
- }
- return TRUE;
+ {
+ UINT state = MSG_WINDOW_STATE_EXISTS;
+ if (IsWindowVisible(hwndDlg))
+ state |= MSG_WINDOW_STATE_VISIBLE;
+ if (GetForegroundWindow() == hwndContainer)
+ state |= MSG_WINDOW_STATE_FOCUS;
+ if (IsIconic(hwndContainer))
+ state |= MSG_WINDOW_STATE_ICONIC;
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
+ }
+ return TRUE;
case DM_CLIENTCHANGED:
GetClientIcon(dat);
@@ -3022,63 +3022,63 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return 0;
case WM_DROPFILES:
- {
- BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000;
- if (!not_sending) {
- const char *szProto = dat->cache->getActiveProto();
- if (szProto == NULL)
- break;
+ {
+ BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000;
+ if (!not_sending) {
+ const char *szProto = dat->cache->getActiveProto();
+ if (szProto == NULL)
+ break;
- int pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (!(pcaps & PF1_FILESEND))
- break;
- if (dat->wStatus == ID_STATUS_OFFLINE) {
- pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
- if (!(pcaps & PF4_OFFLINEFILES)) {
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
+ int pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (!(pcaps & PF1_FILESEND))
break;
+ if (dat->wStatus == ID_STATUS_OFFLINE) {
+ pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ if (!(pcaps & PF4_OFFLINEFILES)) {
+ SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
+ break;
+ }
}
}
- }
- if (dat->hContact != NULL) {
- TCHAR szFilename[MAX_PATH];
- HDROP hDrop = (HDROP)wParam;
- int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
- TCHAR** ppFiles = NULL;
- for (i = 0; i < fileCount; i++) {
- DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
- Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
- }
+ if (dat->hContact != NULL) {
+ TCHAR szFilename[MAX_PATH];
+ HDROP hDrop = (HDROP)wParam;
+ int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
+ TCHAR** ppFiles = NULL;
+ for (i = 0; i < fileCount; i++) {
+ DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
+ Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
+ }
- if (!not_sending)
- CallService(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
- else {
- if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
- for (int i = 0; i < totalCount; i++) {
- char* szFileName = mir_t2a(ppFiles[i]);
- CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
- mir_free(szFileName);
+ if (!not_sending)
+ CallService(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
+ else {
+ if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
+ for (i = 0; i < totalCount; i++) {
+ char* szFileName = mir_t2a(ppFiles[i]);
+ CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
+ mir_free(szFileName);
+ }
+ char *szHTTPText = "DEBUG";
+ SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
- char *szHTTPText = "DEBUG";
- SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
+ for (i = 0; ppFiles[i]; i++)
+ mir_free(ppFiles[i]);
+ mir_free(ppFiles);
}
- for (i = 0; ppFiles[i]; i++)
- mir_free(ppFiles[i]);
- mir_free(ppFiles);
}
- }
- return 0;
+ return 0;
case DM_CHECKQUEUEFORCLOSE:
- {
- int *uOpen = (int*)lParam;
- if (uOpen)
- *uOpen += dat->iOpenJobs;
- }
- return 0;
+ {
+ int *uOpen = (int*)lParam;
+ if (uOpen)
+ *uOpen += dat->iOpenJobs;
+ }
+ return 0;
case WM_CLOSE:
// esc handles error controls if we are in error state (error controls visible)
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 44671bf9c0..8bbf9a2ede 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -841,7 +841,7 @@ static TCHAR tszRtfBreaks[] = _T(" \\\n\r");
static void CreateColorMap(CMString &Text, int iCount, COLORREF *pSrc, int *pDst)
{
const TCHAR *pszText = Text;
- int iIndex = 1, i = 0;
+ int iIndex = 1;
static const TCHAR *lpszFmt = _T("\\red%[^ \x5b\\]\\green%[^ \x5b\\]\\blue%[^ \x5b;];");
TCHAR szRed[10], szGreen[10], szBlue[10];
@@ -854,7 +854,7 @@ static void CreateColorMap(CMString &Text, int iCount, COLORREF *pSrc, int *pDst
const TCHAR *p2 = _tcsstr(p1, _T("\\red"));
- for (i = 0; i < iCount; i++)
+ for (int i = 0; i < iCount; i++)
pDst[i] = -1;
while (p2 && p2 < pEnd) {
@@ -1172,7 +1172,6 @@ void TSAPI FindFirstEvent(TWindowData *dat)
DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;) {
- MEVENT hPrevEvent;
if (dat->hDbEventFirst == NULL)
hPrevEvent = db_event_last(dat->hContact);
else
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 4a081e9c6d..3bcf1b8a56 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -45,7 +45,7 @@ struct TCpTable cpTable[] = {
{ 1257, LPGENT("Baltic") },
{ 1258, LPGENT("Vietnamese") },
{ 1361, LPGENT("Korean (Johab)") },
- { -1, NULL }
+ { (UINT)-1, NULL }
};
wchar_t* weekDays[7] = { LPGENT("Sunday"), LPGENT("Monday"), LPGENT("Tuesday"), LPGENT("Wednesday"), LPGENT("Thursday"), LPGENT("Friday"), LPGENT("Saturday") };
@@ -1141,15 +1141,15 @@ static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppe
char szPattern[50];
mir_snprintf(szPattern, _countof(szPattern), "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
- FINDTEXTEXA fi;
- fi.lpstrText = szPattern;
- fi.chrg.cpMin = 0;
- fi.chrg.cpMax = -1;
- if (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) != 0) {
+ FINDTEXTEXA ft;
+ ft.lpstrText = szPattern;
+ ft.chrg.cpMin = 0;
+ ft.chrg.cpMax = -1;
+ if (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&ft) != 0) {
CHARRANGE sel;
sel.cpMin = 0;
sel.cpMax = 20;
- SendMessage(hwndrtf, EM_SETSEL, 0, fi.chrgText.cpMax + 1);
+ SendMessage(hwndrtf, EM_SETSEL, 0, ft.chrgText.cpMax + 1);
SendMessageA(hwndrtf, EM_REPLACESEL, TRUE, (LPARAM)"");
}
}
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index 78c115590d..bf6ef9a345 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -357,7 +357,7 @@ void CSideBarButton::invokeContextMenu()
}
CSideBar::CSideBar(TContainerData *pContainer) :
-m_buttonlist(1, PtrKeySortT)
+ m_buttonlist(1, PtrKeySortT)
{
m_pContainer = pContainer;
m_up = m_down = 0;
@@ -396,7 +396,7 @@ void CSideBar::Init()
if (m_pContainer->dwFlags & CNT_SIDEBAR) {
if (m_hwndScrollWnd == 0)
m_hwndScrollWnd = ::CreateWindowEx(0, _T("TS_SideBarClass"), _T(""), WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD,
- 0, 0, m_width, 40, m_pContainer->hwnd, reinterpret_cast<HMENU>(5000), g_hInst, this);
+ 0, 0, m_width, 40, m_pContainer->hwnd, reinterpret_cast<HMENU>(5000), g_hInst, this);
m_isActive = true;
m_isVisible = m_isActive ? m_isVisible : true;
@@ -754,7 +754,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible
if (!fOnlyCalc && NULL != hwnd) /* Wine fix. */
hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, -(m_firstVisibleOffset - m_totalItemHeight),
- m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
+ m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
spaceUsed += ((height + 1) - (m_firstVisibleOffset - m_totalItemHeight));
m_totalItemHeight += (height + 1);
}
@@ -969,8 +969,8 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT
if (CSkin::m_skinEnabled) {
TContainerData *pContainer = const_cast<TContainerData *>(item->m_sideBar->getContainer());
- int id = stateId == PBS_PRESSED || fIsActiveItem ? ID_EXTBKBUTTONSPRESSED : (stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSNPRESSED);
- CSkinItem *skinItem = &SkinItems[id];
+ int ctrlId = stateId == PBS_PRESSED || fIsActiveItem ? ID_EXTBKBUTTONSPRESSED : (stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSNPRESSED);
+ CSkinItem *skinItem = &SkinItems[ctrlId];
HWND hwnd = item->m_buttonControl->hwnd;
CSkin::SkinDrawBG(hwnd, pContainer->hwnd, pContainer, const_cast<RECT *>(rc), hdc);
@@ -985,10 +985,10 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT
if (stateId == PBS_HOT || stateId == PBS_PRESSED)
DrawAlpha(hdc, const_cast<RECT *>(rc), 0xf0f0f0, 70, 0x000000, 0, 9,
- 31, 4, 0);
+ 31, 4, 0);
else
DrawAlpha(hdc, const_cast<RECT *>(rc), 0xf0f0f0, 30, 0x707070, 0, 9,
- 31, 4, 0);
+ 31, 4, 0);
}
else {
if (PluginConfig.m_fillColor)
@@ -1152,10 +1152,9 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r
*/
const SIZE& __fastcall CSideBar::m_measureAdvancedVertical(CSideBarButton* item)
{
- const TWindowData* dat = item->getDat();
-
SIZE sz = { 0 };
+ const TWindowData *dat = item->getDat();
if (dat) {
SIZE szFirstLine, szSecondLine;
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 59cfa8ef4d..49e90e2020 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -598,7 +598,6 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
RECT rectUpDn = { 0, 0, 0, 0 };
int nCount = TabCtrl_GetItemCount(hwnd), i;
- TCITEM item = { 0 };
int iActive, hotItem;
POINT pt;
DWORD dwStyle = tabdat->dwStyle;
@@ -617,7 +616,8 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
InvalidateRect(hwnd, NULL, FALSE);
tabdat->iHoveredTabIndex = hotItem;
- item.mask = TCIF_PARAM;
+ TCITEM tci = { 0 };
+ tci.mask = TCIF_PARAM;
tabdat->fAeroTabs = (CSkin::m_fAeroSkinsValid && (isAero || PluginConfig.m_fillColor)) ? TRUE : FALSE;
tabdat->fCloseButton = (tabdat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON ? TRUE : FALSE);
@@ -843,13 +843,13 @@ page_done:
goto skip_tabs;
for (i = 0; i < nCount; i++) {
- TWindowData *dat = 0;
-
if (i == iActive)
continue;
- TabCtrl_GetItem(hwnd, i, &item);
- if (item.lParam)
- dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+
+ TabCtrl_GetItem(hwnd, i, &tci);
+ TWindowData *dat = 0;
+ if (tci.lParam)
+ dat = (TWindowData*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
TabCtrl_GetItemRect(hwnd, i, &rcItem);
if (!bClassicDraw && uiBottom) {
rcItem.top -= PluginConfig.tabConfig.m_bottomAdjust;
@@ -881,9 +881,9 @@ page_done:
int nHint = 0;
rcItem = rctActive;
- TabCtrl_GetItem(hwnd, iActive, &item);
- if (item.lParam)
- dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ TabCtrl_GetItem(hwnd, iActive, &tci);
+ if (tci.lParam)
+ dat = (TWindowData*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
if (!bClassicDraw && !(dwStyle & TCS_BUTTONS)) {
InflateRect(&rcItem, 2, 2);
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp
index 8d1c315fec..16eb8bcf4f 100644
--- a/plugins/TabSRMM/src/taskbar.cpp
+++ b/plugins/TabSRMM/src/taskbar.cpp
@@ -529,15 +529,14 @@ void CProxyWindow::updateTitle(const TCHAR *tszTitle) const
*/
LRESULT CALLBACK CProxyWindow::stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- CProxyWindow* pWnd = reinterpret_cast<CProxyWindow *>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
-
+ CProxyWindow *pWnd = reinterpret_cast<CProxyWindow *>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
if (pWnd)
- return(pWnd->wndProc(hWnd, msg, wParam, lParam));
+ return pWnd->wndProc(hWnd, msg, wParam, lParam);
switch (msg) {
case WM_NCCREATE:
CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
- CProxyWindow *pWnd = reinterpret_cast<CProxyWindow *>(cs->lpCreateParams);
+ pWnd = reinterpret_cast<CProxyWindow *>(cs->lpCreateParams);
::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pWnd));
return pWnd->wndProc(hWnd, msg, wParam, lParam);
}
@@ -550,29 +549,23 @@ LRESULT CALLBACK CProxyWindow::stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
-
-#if defined(__LOGDEBUG_)
- case WM_NCCREATE:
- _DebugTraceW(_T("create proxy WINDOW for: %s"), m_dat->cache->getNick());
- break;
-#endif
case WM_CLOSE:
- {
- TContainerData* pC = m_dat->pContainer;
-
- if (m_dat->hwnd != pC->hwndActive)
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
- else
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
- if (!IsIconic(pC->hwnd))
- SetForegroundWindow(pC->hwnd);
- }
- return 0;
+ {
+ TContainerData* pC = m_dat->pContainer;
+
+ if (m_dat->hwnd != pC->hwndActive)
+ SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
+ else
+ SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
+ if (!IsIconic(pC->hwnd))
+ SetForegroundWindow(pC->hwnd);
+ }
+ return 0;
- /*
- * proxy window was activated by clicking on the thumbnail. Send this
- * to the real message window.
- */
+ /*
+ * proxy window was activated by clicking on the thumbnail. Send this
+ * to the real message window.
+ */
case WM_ACTIVATE:
if (WA_ACTIVE == wParam) {
if (IsWindow(m_dat->hwnd))
@@ -583,9 +576,6 @@ LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
case WM_NCDESTROY:
::SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
-#if defined(__LOGDEBUG_)
- _DebugTraceW(_T("destroy proxy WINDOW for: %s"), m_dat->cache->getNick());
-#endif
break;
case WM_DWMSENDICONICTHUMBNAIL:
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp
index 7437a5fd77..62c9f2db30 100644
--- a/plugins/TabSRMM/src/themeio.cpp
+++ b/plugins/TabSRMM/src/themeio.cpp
@@ -253,15 +253,13 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
char *szIniFilename = mir_u2a(szIniFilenameT);
char szTemplateBuffer[TEMPLATE_LENGTH * 3 + 2];
char bSize = 0;
- HDC hdc;
int charset;
if ((version = GetPrivateProfileIntA("TabSRMM Theme", "Version", 0, szIniFilename)) == 0) // no version number.. assume 1
version = 1;
+ HDC hdc = GetDC(NULL);
if (dat == 0) {
- hdc = GetDC(NULL);
-
while (fontBlocks[n].szModule && (dwFlags & THEME_READ_FONTS)) {
char *szModule = fontBlocks[n].szModule;
int firstIndex = fontBlocks[n].iFirst;
@@ -342,7 +340,6 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
}
}
else {
- HDC hdc = GetDC(NULL);
int SY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
if (!noAdvanced) {
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index d5b5733024..5179006977 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -181,8 +181,8 @@ AeroEffect CSkin::m_aeroEffects[AERO_EFFECT_LAST] = {
1,
0,
0xc0c0c0,
- -1,
- -1,
+ DWORD(-1),
+ DWORD(-1),
AeroEffectCallback_Solid
}
};
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index e5f6ba8cd7..1892993c53 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -133,7 +133,7 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
}
tstring colorname = message.substr(beginmark + 7, 8);
- search_again:
+search_again:
bool clr_found = false;
for (int ii = 0; ii < rtf_ctable_size; ii++) {
if (!_tcsnicmp((TCHAR*)colorname.c_str(), rtf_ctable[ii].szName, mir_tstrlen(rtf_ctable[ii].szName))) {
@@ -173,7 +173,7 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
else goto invalid_code;
}
else {
- invalid_code:
+invalid_code:
if (endmark != message.npos)
message.erase(endmark, 8);
if (closing != message.npos && closing < (size_t)endmark)
@@ -205,11 +205,11 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
}
// search a corresponding endmarker which fulfills the criteria
- INT_PTR tempmark = beginmark + 1;
- while ((endmark = message.find(endmarker, tempmark)) != message.npos) {
+ INT_PTR mark = beginmark + 1;
+ while ((endmark = message.find(endmarker, mark)) != message.npos) {
if (_istpunct(message[endmark + 1]) || _istspace(message[endmark + 1]) || message[endmark + 1] == 0 || _tcschr(_T("*/_"), message[endmark + 1]) != NULL)
goto ok;
- tempmark = endmark + 1;
+ mark = endmark + 1;
}
break;
}
@@ -217,7 +217,7 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
if ((endmark = message.find(endmarker, beginmark + 1)) == message.npos)
break;
}
- ok:
+ok:
if ((endmark - beginmark) < 2) {
beginmark++;
continue;
@@ -287,118 +287,122 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
if (title[curpos] == 0)
break;
+ const TCHAR *p;
switch (title[curpos]) {
- case 'n': {
- const TCHAR *tszNick = dat->cache->getNick();
- if (tszNick[0])
- title.insert(tempmark + 2, tszNick);
+ case 'n':
+ p = dat->cache->getNick();
+ if (p[0])
+ title.insert(tempmark + 2, p);
title.erase(tempmark, 2);
- curpos = tempmark + mir_tstrlen(tszNick);
+ curpos = tempmark + mir_tstrlen(p);
break;
- }
case 'p':
- case 'a': {
- const TCHAR *szAcc = dat->cache->getRealAccount();
- if (szAcc)
- title.insert(tempmark + 2, szAcc);
+ case 'a':
+ p = dat->cache->getRealAccount();
+ if (p)
+ title.insert(tempmark + 2, p);
title.erase(tempmark, 2);
- curpos = tempmark + mir_tstrlen(szAcc);
+ curpos = tempmark + mir_tstrlen(p);
break;
- }
- case 's': {
+
+ case 's':
if (dat->szStatus[0])
title.insert(tempmark + 2, dat->szStatus);
title.erase(tempmark, 2);
curpos = tempmark + mir_tstrlen(dat->szStatus);
break;
- }
- case 'u': {
- const TCHAR *szUIN = dat->cache->getUIN();
- if (szUIN[0])
- title.insert(tempmark + 2, szUIN);
+
+ case 'u':
+ p = dat->cache->getUIN();
+ if (p[0])
+ title.insert(tempmark + 2, p);
title.erase(tempmark, 2);
- curpos = tempmark + mir_tstrlen(szUIN);
+ curpos = tempmark + mir_tstrlen(p);
break;
- }
- case 'c': {
- TCHAR *c = (!mir_tstrcmp(dat->pContainer->szName, _T("default")) ? TranslateT("Default container") : dat->pContainer->szName);
- title.insert(tempmark + 2, c);
+
+ case 'c':
+ p = (!mir_tstrcmp(dat->pContainer->szName, _T("default")) ? TranslateT("Default container") : dat->pContainer->szName);
+ title.insert(tempmark + 2, p);
title.erase(tempmark, 2);
- curpos = tempmark + mir_tstrlen(c);
+ curpos = tempmark + mir_tstrlen(p);
break;
- }
- case 'o': {
- const char *szProto = dat->cache->getActiveProto();
- if (szProto)
- title.insert(tempmark + 2, _A2T(szProto));
- title.erase(tempmark, 2);
- curpos = tempmark + (szProto ? mir_strlen(szProto) : 0);
+
+ case 'o':
+ {
+ const char *szProto = dat->cache->getActiveProto();
+ if (szProto)
+ title.insert(tempmark + 2, _A2T(szProto));
+ title.erase(tempmark, 2);
+ curpos = tempmark + (szProto ? mir_strlen(szProto) : 0);
+ }
break;
- }
- case 'x': {
- BYTE xStatus = dat->cache->getXStatusId();
-
- if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- DBVARIANT dbv = { 0 };
-
- if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
- _tcsncpy(szTemp, dbv.ptszVal, 500);
- szTemp[500] = 0;
- db_free(&dbv);
- title.insert(tempmark + 2, szTemp);
- curpos = tempmark + mir_tstrlen(szTemp);
- }
- else {
- title.insert(tempmark + 2, xStatusDescr[xStatus - 1]);
- curpos = tempmark + mir_tstrlen(xStatusDescr[xStatus - 1]);
+
+ case 'x':
+ {
+ BYTE xStatus = dat->cache->getXStatusId();
+
+ if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
+ DBVARIANT dbv = { 0 };
+ if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
+ _tcsncpy(szTemp, dbv.ptszVal, 500);
+ szTemp[500] = 0;
+ db_free(&dbv);
+ title.insert(tempmark + 2, szTemp);
+ curpos = tempmark + mir_tstrlen(szTemp);
+ }
+ else {
+ title.insert(tempmark + 2, xStatusDescr[xStatus - 1]);
+ curpos = tempmark + mir_tstrlen(xStatusDescr[xStatus - 1]);
+ }
}
+ title.erase(tempmark, 2);
}
- title.erase(tempmark, 2);
break;
- }
- case 'm': {
- TCHAR *szFinalStatus = NULL;
- BYTE xStatus = dat->cache->getXStatusId();
- if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- DBVARIANT dbv = { 0 };
-
- if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
- _tcsncpy(szTemp, dbv.ptszVal, 500);
- szTemp[500] = 0;
- db_free(&dbv);
- title.insert(tempmark + 2, szTemp);
+
+ case 'm':
+ p = NULL;
+ {
+ BYTE xStatus = dat->cache->getXStatusId();
+ if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
+ DBVARIANT dbv = { 0 };
+
+ if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
+ _tcsncpy(szTemp, dbv.ptszVal, 500);
+ szTemp[500] = 0;
+ db_free(&dbv);
+ title.insert(tempmark + 2, szTemp);
+ }
+ else p = xStatusDescr[xStatus - 1];
}
- else szFinalStatus = xStatusDescr[xStatus - 1];
- }
- else szFinalStatus = (TCHAR*)(dat->szStatus && dat->szStatus[0] ? dat->szStatus : _T("(undef)"));
+ else p = (TCHAR*)(dat->szStatus && dat->szStatus[0] ? dat->szStatus : _T("(undef)"));
- if (szFinalStatus) {
- title.insert(tempmark + 2, szFinalStatus);
- curpos = tempmark + mir_tstrlen(szFinalStatus);
- }
+ if (p) {
+ title.insert(tempmark + 2, p);
+ curpos = tempmark + mir_tstrlen(p);
+ }
- title.erase(tempmark, 2);
+ title.erase(tempmark, 2);
+ }
break;
- }
- // status message (%T will skip the "No status message" for empty messages)
+ // status message (%T will skip the "No status message" for empty messages)
case 't':
- case 'T': {
- TCHAR *tszStatusMsg = dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true);
- if (tszStatusMsg) {
- title.insert(tempmark + 2, tszStatusMsg);
- curpos = tempmark + mir_tstrlen(tszStatusMsg);
- }
- else if (title[curpos] == 't') {
- const TCHAR* tszStatusMsg = TranslateT("No status message");
- title.insert(tempmark + 2, tszStatusMsg);
- curpos = tempmark + mir_tstrlen(tszStatusMsg);
+ case 'T':
+ {
+ ptrT tszStatus(dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true));
+ if (tszStatus) {
+ title.insert(tempmark + 2, tszStatus);
+ curpos = tempmark + mir_tstrlen(tszStatus);
+ }
+ else if (title[curpos] == 't') {
+ p = TranslateT("No status message");
+ title.insert(tempmark + 2, p);
+ curpos = tempmark + mir_tstrlen(p);
+ }
}
title.erase(tempmark, 2);
- if (tszStatusMsg)
- mir_free(tszStatusMsg);
break;
- }
+
default:
title.erase(tempmark, 1);
break;
@@ -1104,8 +1108,8 @@ static wchar_t* warnings[] = {
};
CWarning::CWarning(const wchar_t *tszTitle, const wchar_t *tszText, const UINT uId, const DWORD dwFlags) :
-m_szTitle(mir_wstrdup(tszTitle)),
-m_szText(mir_wstrdup(tszText))
+ m_szTitle(mir_wstrdup(tszTitle)),
+ m_szText(mir_wstrdup(tszText))
{
m_uId = uId;
m_hFontCaption = 0;
@@ -1246,11 +1250,11 @@ INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
}
break;
-#if defined(__LOGDEBUG_)
+ #if defined(__LOGDEBUG_)
case WM_NCDESTROY:
_DebugTraceW(L"window destroyed");
break;
-#endif
+ #endif
}
return FALSE;
}
@@ -1262,101 +1266,101 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
switch (msg) {
case WM_INITDIALOG:
- {
- HICON hIcon = 0;
- UINT uResId = 0;
- TCHAR temp[1024];
- SETTEXTEX stx = { ST_SELECTION, CP_UTF8 };
- size_t pos = 0;
-
- m_hwnd = hwnd;
-
- ::SetWindowTextW(hwnd, TranslateT("TabSRMM warning message"));
- ::SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true)));
- ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA)));
- ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0);
- ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK);
-
- mir_sntprintf(temp, RTF_DEFAULT_HEADER, 0, 0, 0, 30 * 15);
- tstring *str = new tstring(temp);
-
- str->append(m_szText);
- str->append(L"}");
-
- TranslateDialogDefault(hwnd);
-
- /*
- * convert normal line breaks to rtf
- */
- while ((pos = str->find(L"\n")) != str->npos) {
- str->erase(pos, 1);
- str->insert(pos, L"\\line ");
- }
+ {
+ HICON hIcon = 0;
+ UINT uResId = 0;
+ TCHAR temp[1024];
+ SETTEXTEX stx = { ST_SELECTION, CP_UTF8 };
+ size_t pos = 0;
+
+ m_hwnd = hwnd;
+
+ ::SetWindowTextW(hwnd, TranslateT("TabSRMM warning message"));
+ ::SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true)));
+ ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA)));
+ ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0);
+ ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK);
+
+ mir_sntprintf(temp, RTF_DEFAULT_HEADER, 0, 0, 0, 30 * 15);
+ tstring *str = new tstring(temp);
+
+ str->append(m_szText);
+ str->append(L"}");
+
+ TranslateDialogDefault(hwnd);
+
+ /*
+ * convert normal line breaks to rtf
+ */
+ while ((pos = str->find(L"\n")) != str->npos) {
+ str->erase(pos, 1);
+ str->insert(pos, L"\\line ");
+ }
- ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETTEXTEX, (WPARAM)&stx, T2Utf(str->c_str()));
- delete str;
+ ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETTEXTEX, (WPARAM)&stx, T2Utf(str->c_str()));
+ delete str;
- ::SetDlgItemTextW(hwnd, IDC_CAPTION, m_szTitle);
+ ::SetDlgItemTextW(hwnd, IDC_CAPTION, m_szTitle);
- if (m_dwFlags & CWF_NOALLOWHIDE)
- Utils::showDlgControl(hwnd, IDC_DONTSHOWAGAIN, SW_HIDE);
- if (m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL) {
- Utils::showDlgControl(hwnd, IDOK, SW_HIDE);
- ::SetFocus(::GetDlgItem(hwnd, IDCANCEL));
- }
- else {
- Utils::showDlgControl(hwnd, IDCANCEL, SW_HIDE);
- Utils::showDlgControl(hwnd, IDYES, SW_HIDE);
- Utils::showDlgControl(hwnd, IDNO, SW_HIDE);
- ::SetFocus(::GetDlgItem(hwnd, IDOK));
- }
- if (m_dwFlags & MB_ICONERROR || m_dwFlags & MB_ICONHAND)
- uResId = 32513;
- else if (m_dwFlags & MB_ICONEXCLAMATION || m_dwFlags & MB_ICONWARNING)
- uResId = 32515;
- else if (m_dwFlags & MB_ICONASTERISK || m_dwFlags & MB_ICONINFORMATION)
- uResId = 32516;
- else if (m_dwFlags & MB_ICONQUESTION)
- uResId = 32514;
-
- if (uResId)
- hIcon = reinterpret_cast<HICON>(::LoadImage(0, MAKEINTRESOURCE(uResId), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
- else
- hIcon = ::Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
+ if (m_dwFlags & CWF_NOALLOWHIDE)
+ Utils::showDlgControl(hwnd, IDC_DONTSHOWAGAIN, SW_HIDE);
+ if (m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL) {
+ Utils::showDlgControl(hwnd, IDOK, SW_HIDE);
+ ::SetFocus(::GetDlgItem(hwnd, IDCANCEL));
+ }
+ else {
+ Utils::showDlgControl(hwnd, IDCANCEL, SW_HIDE);
+ Utils::showDlgControl(hwnd, IDYES, SW_HIDE);
+ Utils::showDlgControl(hwnd, IDNO, SW_HIDE);
+ ::SetFocus(::GetDlgItem(hwnd, IDOK));
+ }
+ if (m_dwFlags & MB_ICONERROR || m_dwFlags & MB_ICONHAND)
+ uResId = 32513;
+ else if (m_dwFlags & MB_ICONEXCLAMATION || m_dwFlags & MB_ICONWARNING)
+ uResId = 32515;
+ else if (m_dwFlags & MB_ICONASTERISK || m_dwFlags & MB_ICONINFORMATION)
+ uResId = 32516;
+ else if (m_dwFlags & MB_ICONQUESTION)
+ uResId = 32514;
+
+ if (uResId)
+ hIcon = reinterpret_cast<HICON>(::LoadImage(0, MAKEINTRESOURCE(uResId), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
+ else
+ hIcon = ::Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
- ::SendDlgItemMessageW(hwnd, IDC_WARNICON, STM_SETICON, reinterpret_cast<WPARAM>(hIcon), 0);
- if (!(m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL))
- ::ShowWindow(hwnd, SW_SHOWNORMAL);
+ ::SendDlgItemMessageW(hwnd, IDC_WARNICON, STM_SETICON, reinterpret_cast<WPARAM>(hIcon), 0);
+ if (!(m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL))
+ ::ShowWindow(hwnd, SW_SHOWNORMAL);
- WindowList_Add(hWindowList, hwnd, (UINT_PTR)hwnd);
- }
- return TRUE;
+ WindowList_Add(hWindowList, hwnd, (UINT_PTR)hwnd);
+ }
+ return TRUE;
case WM_CTLCOLORSTATIC:
- {
- HWND hwndChild = reinterpret_cast<HWND>(lParam);
- UINT id = ::GetDlgCtrlID(hwndChild);
- if (0 == m_hFontCaption) {
- HFONT hFont = reinterpret_cast<HFONT>(::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_GETFONT, 0, 0));
- LOGFONT lf = { 0 };
-
- ::GetObject(hFont, sizeof(lf), &lf);
- lf.lfHeight = (int)((double)lf.lfHeight * 1.7f);
- m_hFontCaption = ::CreateFontIndirect(&lf);
- ::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
- }
+ {
+ HWND hwndChild = reinterpret_cast<HWND>(lParam);
+ UINT id = ::GetDlgCtrlID(hwndChild);
+ if (0 == m_hFontCaption) {
+ HFONT hFont = reinterpret_cast<HFONT>(::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_GETFONT, 0, 0));
+ LOGFONT lf = { 0 };
+
+ ::GetObject(hFont, sizeof(lf), &lf);
+ lf.lfHeight = (int)((double)lf.lfHeight * 1.7f);
+ m_hFontCaption = ::CreateFontIndirect(&lf);
+ ::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
+ }
- if (IDC_CAPTION == id) {
- ::SetTextColor(reinterpret_cast<HDC>(wParam), ::GetSysColor(COLOR_HIGHLIGHT));
- ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
- }
+ if (IDC_CAPTION == id) {
+ ::SetTextColor(reinterpret_cast<HDC>(wParam), ::GetSysColor(COLOR_HIGHLIGHT));
+ ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
+ }
- if (IDC_WARNGROUP != id && IDC_DONTSHOWAGAIN != id) {
- ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
- return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
+ if (IDC_WARNGROUP != id && IDC_DONTSHOWAGAIN != id) {
+ ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
+ return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
+ }
}
- }
- break;
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {