summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp6
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp12
-rw-r--r--plugins/PluginUpdater/src/Events.cpp13
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp8
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp10
-rw-r--r--plugins/PluginUpdater/src/stdafx.h2
-rw-r--r--plugins/SkypeStatusChange/src/options.cpp2
-rw-r--r--plugins/SmileyAdd/SmileyAdd.vcxproj6
-rw-r--r--plugins/SmileyAdd/src/general.cpp6
-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
-rw-r--r--plugins/TabSRMM/tabsrmm.vcxproj5
-rw-r--r--plugins/WhenWasIt/src/services.cpp14
-rw-r--r--plugins/YAMN/src/browser/mailbrowser.cpp612
-rw-r--r--plugins/mTextControl/src/textcontrol.cpp12
29 files changed, 1427 insertions, 1551 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index d144b5cd35..60f3d2a623 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -53,10 +53,10 @@ static void ApplyDownloads(void *param)
//create needed folders after escalating priviledges. Folders creates when we actually install updates
TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot);
+ mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), g_tszRoot);
SafeCreateDirectory(tszFileTemp);
VARST tszMirandaPath(_T("%miranda_path%"));
@@ -355,7 +355,7 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const TCHAR* t
tp = _tcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
_tcslwr(tp);
- mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, tszFileName);
+ mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), g_tszRoot, tszFileName);
mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, tszRelFileName);
for (tp = _tcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = _tcschr(tp, '\\'))
*tp++ = '/';
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 6030a73d4c..8b77616451 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -59,9 +59,9 @@ static void ApplyUpdates(void *param)
HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot);
+ mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), g_tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -377,10 +377,10 @@ static void DlgUpdateSilent(void *param)
//create needed folders after escalating priviledges. Folders creates when we actually install updates
TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot);
+ mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), g_tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -589,7 +589,7 @@ static bool isValidExtension(const TCHAR *ptszFileName)
static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const TCHAR *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles)
{
// skip updater's own folder
- if (!_tcsicmp(tszFolder, tszRoot))
+ if (!_tcsicmp(tszFolder, g_tszRoot))
return 0;
// skip profile folder
@@ -709,7 +709,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const
p = (p) ? p + 1 : tszBuf;
_tcslwr(p);
- mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, p);
+ mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), g_tszRoot, p);
mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, tszBuf);
for (p = _tcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = _tcschr(p, '\\'))
*p++ = '/';
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp
index ee9d124113..41e730b449 100644
--- a/plugins/PluginUpdater/src/Events.cpp
+++ b/plugins/PluginUpdater/src/Events.cpp
@@ -23,10 +23,10 @@ HANDLE hPluginUpdaterFolder;
int OnFoldersChanged(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hPluginUpdaterFolder, tszRoot, MAX_PATH, _T(""));
- size_t len = _tcslen(tszRoot);
- if (tszRoot[len-1] == '\\' || tszRoot[len-1] == '/')
- tszRoot[len-1] = 0;
+ FoldersGetCustomPathT(hPluginUpdaterFolder, g_tszRoot, MAX_PATH, _T(""));
+ size_t len = _tcslen(g_tszRoot);
+ if (g_tszRoot[len-1] == '\\' || g_tszRoot[len-1] == '/')
+ g_tszRoot[len-1] = 0;
return 0;
}
@@ -35,7 +35,7 @@ void EmptyFolder()
SHFILEOPSTRUCT file_op = {
NULL,
FO_DELETE,
- tszRoot,
+ g_tszRoot,
_T(""),
FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION,
false,
@@ -50,8 +50,7 @@ int ModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
OnFoldersChanged(0, 0);
}
- else
- lstrcpyn(tszRoot, VARST( _T("%miranda_path%\\" DEFAULT_UPDATES_FOLDER)), _countof(tszRoot));
+ else lstrcpyn(g_tszRoot, VARST( _T("%miranda_path%\\" DEFAULT_UPDATES_FOLDER)), _countof(g_tszRoot));
#if MIRANDA_VER >= 0x0A00
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index a360721322..b32b7be729 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
HINSTANCE hInst = NULL;
-TCHAR tszRoot[MAX_PATH] = {0}, tszTempPath[MAX_PATH];
+TCHAR g_tszRoot[MAX_PATH] = {0}, g_tszTempPath[MAX_PATH];
int hLangpack;
DWORD g_mirandaVersion;
@@ -73,9 +73,9 @@ extern "C" __declspec(dllexport) int Load(void)
db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0);
- DWORD dwLen = GetTempPath( _countof(tszTempPath), tszTempPath);
- if (tszTempPath[dwLen-1] == '\\')
- tszTempPath[dwLen-1] = 0;
+ DWORD dwLen = GetTempPath(_countof(g_tszTempPath), g_tszTempPath);
+ if (g_tszTempPath[dwLen-1] == '\\')
+ g_tszTempPath[dwLen-1] = 0;
LoadOptions();
InitPopupList();
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 33db2655d8..8b983b49da 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -152,7 +152,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
// Download version info
FILEURL pFileUrl;
mir_sntprintf(pFileUrl.tszDownloadURL, _countof(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), baseUrl);
- mir_sntprintf(pFileUrl.tszDiskPath, _countof(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), tszTempPath);
+ mir_sntprintf(pFileUrl.tszDiskPath, _countof(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), g_tszTempPath);
pFileUrl.CRCsum = 0;
HANDLE nlc;
@@ -166,7 +166,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
return false;
}
- if(!unzip(pFileUrl.tszDiskPath, tszTempPath, NULL,true)) {
+ if(!unzip(pFileUrl.tszDiskPath, g_tszTempPath, NULL,true)) {
Netlib_LogfT(hNetlibUser,_T("Unzipping list of available updates from %s failed"),baseUrl);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
SkinPlaySound("updatefailed");
@@ -176,10 +176,10 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
DeleteFile(pFileUrl.tszDiskPath);
TCHAR tszTmpIni[MAX_PATH] = {0};
- mir_sntprintf(tszTmpIni, _countof(tszTmpIni), _T("%s\\hashes.txt"), tszTempPath);
+ mir_sntprintf(tszTmpIni, _countof(tszTmpIni), _T("%s\\hashes.txt"), g_tszTempPath);
FILE *fp = _tfopen(tszTmpIni, _T("r"));
if (!fp) {
- Netlib_LogfT(hNetlibUser,_T("Opening %s failed"), tszTempPath);
+ Netlib_LogfT(hNetlibUser,_T("Opening %s failed"), g_tszTempPath);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
return false;
}
@@ -284,7 +284,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc)
else {
// try to write it via PU stub
TCHAR tszTempFile[MAX_PATH];
- mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\pulocal.tmp"), tszTempPath);
+ mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\pulocal.tmp"), g_tszTempPath);
hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwBytes;
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index 98b4db6c47..146c1ac49c 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -146,7 +146,7 @@ using namespace std;
extern HINSTANCE hInst;
extern DWORD g_mirandaVersion;
-extern TCHAR tszRoot[MAX_PATH], tszTempPath[MAX_PATH];
+extern TCHAR g_tszRoot[MAX_PATH], g_tszTempPath[MAX_PATH];
extern aPopups PopupsList[POPUPS];
extern HANDLE hPipe, hNetlibUser;
#if MIRANDA_VER >= 0x0A00
diff --git a/plugins/SkypeStatusChange/src/options.cpp b/plugins/SkypeStatusChange/src/options.cpp
index 2949c5913d..56571b3e55 100644
--- a/plugins/SkypeStatusChange/src/options.cpp
+++ b/plugins/SkypeStatusChange/src/options.cpp
@@ -87,7 +87,7 @@ void InitProtocolTree(HWND hwndTreeCtrl)
pItemData->m_nType = CTreeItemData::Status;
pItemData->m_pszModule = pAccount->szModuleName;
pItemData->m_nStatus = m2s.m_nMirandaStatus;
- bool bStatusExcluded = g_Options.IsProtocolStatusExcluded(pAccount->szModuleName,pItemData->m_nStatus);
+ bStatusExcluded = g_Options.IsProtocolStatusExcluded(pAccount->szModuleName,pItemData->m_nStatus);
if (bProtocolExcluded) {
if (bStatusExcluded)
nState = TCBS_DISABLE_CHECKED;
diff --git a/plugins/SmileyAdd/SmileyAdd.vcxproj b/plugins/SmileyAdd/SmileyAdd.vcxproj
index a89d90ad10..eafa17dde1 100644
--- a/plugins/SmileyAdd/SmileyAdd.vcxproj
+++ b/plugins/SmileyAdd/SmileyAdd.vcxproj
@@ -25,9 +25,13 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <DisableSpecificWarnings>4458;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\regexp\*.cpp">
- <DisableSpecificWarnings>4458;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
</ClCompile>
</ItemGroup>
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp
index 1416db2f6b..7b0dff73fd 100644
--- a/plugins/SmileyAdd/src/general.cpp
+++ b/plugins/SmileyAdd/src/general.cpp
@@ -217,18 +217,18 @@ MCONTACT DecodeMetaContact(MCONTACT hContact)
return NULL;
MCONTACT hReal = db_mc_getMostOnline(hContact);
- if (hReal == NULL || hReal == (MCONTACT)CALLSERVICE_NOTFOUND)
+ if (hReal == NULL || (INT_PTR)hReal == CALLSERVICE_NOTFOUND)
hReal = hContact;
return hReal;
}
-bool IsSmileyProto(char* proto)
+bool IsSmileyProto(char *proto)
{
return proto && mir_strcmp(proto, META_PROTO) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & (PF1_IM | PF1_CHAT));
}
-void ReportError(const TCHAR* errmsg)
+void ReportError(const TCHAR *errmsg)
{
static const TCHAR title[] = _T("Miranda SmileyAdd");
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)) {
diff --git a/plugins/TabSRMM/tabsrmm.vcxproj b/plugins/TabSRMM/tabsrmm.vcxproj
index 16f0e48110..de20ecf765 100644
--- a/plugins/TabSRMM/tabsrmm.vcxproj
+++ b/plugins/TabSRMM/tabsrmm.vcxproj
@@ -25,6 +25,11 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ </ClCompile>
+ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\chat\*.cpp">
<PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index ecfe1bbfbe..9b58a1bfd4 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -176,12 +176,12 @@ INT_PTR AddBirthdayService(WPARAM hContact, LPARAM)
return ShowWindow(hWnd, SW_SHOW);
}
-void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon)
+void ShowPopupMessage(const TCHAR *title, const TCHAR *message, HANDLE icon)
{
POPUPDATAT pd = { 0 };
pd.lchIcon = IcoLib_GetIconByHandle(icon);
- _tcsncpy(pd.lptzContactName, title, MAX_CONTACTNAME - 1);
- _tcsncpy(pd.lptzText, message, MAX_SECONDLINE - 1);
+ _tcsncpy_s(pd.lptzContactName, title, _TRUNCATE);
+ _tcsncpy_s(pd.lptzText, message, _TRUNCATE);
pd.colorText = commonData.foreground;
pd.colorBack = commonData.background;
PUAddPopupT(&pd);
@@ -191,11 +191,10 @@ void __cdecl RefreshUserDetailsWorkerThread(void*)
{
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hRefreshUserDetails);
int delay = db_get_w(NULL, ModuleName, "UpdateDelay", REFRESH_DETAILS_DELAY);
- int res;
MCONTACT hContact = db_find_first();
while (hContact != NULL) {
- res = CallContactService(hContact, PSS_GETINFO, 0, 0);
+ int res = CallContactService(hContact, PSS_GETINFO, 0, 0);
hContact = db_find_next(hContact);
if (hContact)
Sleep(delay); //sleep for a few seconds between requests
@@ -298,9 +297,8 @@ int DoImport(TCHAR *fileName)
SaveBirthday(hContact, year, month, day, mode);
}
else {
- TCHAR tmp[2048];
- mir_sntprintf(tmp, _countof(tmp), TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
- ShowPopupMessage(TranslateT("Warning"), tmp, hImportBirthdays);
+ CMString msg(FORMAT, TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
+ ShowPopupMessage(TranslateT("Warning"), msg, hImportBirthdays);
}
}
}
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp
index 8de3bac10b..c32601f70b 100644
--- a/plugins/YAMN/src/browser/mailbrowser.cpp
+++ b/plugins/YAMN/src/browser/mailbrowser.cpp
@@ -3,12 +3,12 @@
*
* (c) majvan 2002-2004
*/
-/* There can be problems when compiling this file, because in this file
- * we are using both unicode and no-unicode functions and compiler does not
- * like it in one file
- * When you got errors, try to comment the #define <stdio.h> and compile, then
- * put it back to uncommented and compile again :)
- */
+ /* There can be problems when compiling this file, because in this file
+ * we are using both unicode and no-unicode functions and compiler does not
+ * like it in one file
+ * When you got errors, try to comment the #define <stdio.h> and compile, then
+ * put it back to uncommented and compile again :)
+ */
#include "../stdafx.h"
@@ -16,8 +16,8 @@
#define MAILBROWSER_MINXSIZE 200 //min size of mail browser window
#define MAILBROWSER_MINYSIZE 130
-//--------------------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------------------
char* s_MonthNames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
bool bDate = false, bSub = false, bSize = false, bFrom = false;
int PosX = 0, PosY = 0, SizeX = 460, SizeY = 100;
@@ -312,7 +312,7 @@ void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN)
int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags)
{
- #define MAILBROWSERTITLE LPGEN("%s - %d new mail messages, %d total")
+#define MAILBROWSERTITLE LPGEN("%s - %d new mail messages, %d total")
struct CMailWinUserInfo *mwui;
struct CMailNumbers MN;
@@ -323,37 +323,37 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags)
mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER);
//now we ensure read access for account and write access for its mails
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountSO-read wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountSO-read wait failed\n");
- #endif
+ #endif
PostMessage(hDlg, WM_DESTROY, 0, 0);
return UPDATE_FAIL;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountSO-read enter\n");
- #endif
+#endif
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountMsgsSO-write wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0 != WaitToWriteFcn(ActualAccount->MessagesAccessSO)) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountMsgsSO-write wait failed\n");
DebugLog(SynchroFile, "UpdateMails:ActualAccountSO-read done\n");
- #endif
+ #endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
PostMessage(hDlg, WM_DESTROY, 0, 0);
return UPDATE_FAIL;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountMsgsSO-write enter\n");
- #endif
+#endif
memset(&MN, 0, sizeof(MN));
@@ -384,9 +384,9 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags)
((nflags & YAMN_ACC_MSGP) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC))
)
) || //if mail window was displayed before and flag YAMN_ACC_MSGP is set
- ((nnflags & YAMN_ACC_MSG) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || //if needed to run mailbrowser when no unseen and no unseen mail found
- ((nflags & YAMN_ACC_MSG) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || //if unseen mails found, we sure run mailbrowser
- ((nflags & YAMN_ACC_ICO) && (MN.Real.SysTrayUC + MN.Virtual.SysTrayUC))
+ ((nnflags & YAMN_ACC_MSG) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || //if needed to run mailbrowser when no unseen and no unseen mail found
+ ((nflags & YAMN_ACC_MSG) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || //if unseen mails found, we sure run mailbrowser
+ ((nflags & YAMN_ACC_ICO) && (MN.Real.SysTrayUC + MN.Virtual.SysTrayUC))
) //if needed to run systray
RunMailBrowser = TRUE;
else
@@ -414,15 +414,15 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags)
delete[] TitleStrW;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:Do mail actions\n");
- #endif
+#endif
DoMailActions(hDlg, ActualAccount, &MN, nflags, nnflags);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:Do mail actions done\n");
- #endif
+#endif
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_NEW, 0, YAMN_MSG_NEW, YAMN_FLAG_REMOVE); //rempve the new flag
if (!RunMailBrowser)
@@ -432,10 +432,10 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags)
mwui->UpdateMailsMessagesAccess = FALSE;
mwui->RunFirstTime = FALSE;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "UpdateMails:ActualAccountMsgsSO-write done\n");
DebugLog(SynchroFile, "UpdateMails:ActualAccountSO-read done\n");
- #endif
+#endif
WriteDoneFcn(ActualAccount->MessagesAccessSO);
ReadDoneFcn(ActualAccount->AccountAccessSO);
@@ -518,24 +518,21 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags)
if (hListView != NULL) {
fi.lParam = (LPARAM)msgq;
- if (-1 != (foundi = ListView_FindItem(hListView, -1, &fi))) //if mail is already in window
- {
+ if (-1 != (foundi = ListView_FindItem(hListView, -1, &fi))) { // if mail is already in window
lfoundi = foundi;
- continue; //do not insert any item
+ continue; // do not insert any item
}
- item.iItem = lfoundi; //insert after last found item
+ item.iItem = lfoundi; // insert after last found item
item.lParam = (LPARAM)msgq;
}
- if (!LoadedMailData(msgq)) //check if mail is already in memory
- {
+ if (!LoadedMailData(msgq)) { // check if mail is already in memory
Loaded = false;
if (NULL == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it
continue;
}
- else
- Loaded = true;
+ else Loaded = true;
if (((hListView != NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) ||
((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW))) {
@@ -829,13 +826,13 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
Account = (HACCOUNT)hContact; //????
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read wait\n");
- #endif
+ #endif
if (WAIT_OBJECT_0 == WaitToReadFcn(Account->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read enter\n");
- #endif
+ #endif
switch (msg) {
case WM_COMMAND:
{
@@ -847,15 +844,15 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
}
break;
}
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read done\n");
- #endif
+ #endif
ReadDoneFcn(Account->AccountAccessSO);
}
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
else
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read enter failed\n");
- #endif
+ #endif
}
if ((Account->NewMailN.Flags & YAMN_ACC_CONT) && !(Account->NewMailN.Flags & YAMN_ACC_CONTNOEVENT)) {
CallService(MS_CLIST_REMOVEEVENT, hContact, hContact);
@@ -923,13 +920,13 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
else
ActualAccount = (HACCOUNT)hContact;
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read wait\n");
- #endif
+ #endif
if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read enter\n");
- #endif
+ #endif
switch (msg) {
case WM_COMMAND:
{
@@ -945,15 +942,15 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
}
break;
}
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read done\n");
- #endif
+ #endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
else
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read enter failed\n");
- #endif
+ #endif
SendMessageW(hWnd, UM_DESTROYPOPUP, 0, 0);
}
break;
@@ -1472,9 +1469,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break;
if ((HACCOUNT)wParam != MailParam->account)
break;
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ShowMessage:STOPACCOUNT:sending destroy msg\n");
- #endif
+ #endif
DestroyWindow(hDlg);
}
return 1;
@@ -1608,9 +1605,9 @@ void __cdecl ShowEmailThread(void *Param)
struct MailShowMsgWinParam MyParam;
MyParam = *(struct MailShowMsgWinParam *)Param;
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ShowMessage:Incrementing \"using threads\" %x (account %x)\n", MyParam.account->UsingThreads, MyParam.account);
- #endif
+#endif
SCIncFcn(MyParam.account->UsingThreads);
SetEvent(MyParam.ThreadRunningEV);
if (MyParam.mail->MsgWindow) {
@@ -1627,7 +1624,7 @@ void __cdecl ShowEmailThread(void *Param)
}
}
else {
- CREADTEVIEWMESSAGEWINDOW:
+CREADTEVIEWMESSAGEWINDOW:
MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), NULL, DlgProcYAMNShowMessage, (LPARAM)&MyParam);
WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow, NULL);
MSG msg;
@@ -1640,19 +1637,21 @@ void __cdecl ShowEmailThread(void *Param)
WindowList_Remove(YAMNVar.MessageWnds, MyParam.mail->MsgWindow);
MyParam.mail->MsgWindow = NULL;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ShowMessage:Decrementing \"using threads\" %x (account %x)\n", MyParam.account->UsingThreads, MyParam.account);
- #endif
+#endif
SCDecFcn(MyParam.account->UsingThreads);
delete Param;
}
INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ HACCOUNT ActualAccount;
+ int Items;
+
switch (msg) {
case WM_INITDIALOG:
{
- HACCOUNT ActualAccount;
struct MailBrowserWinParam *MyParam = (struct MailBrowserWinParam *)lParam;
struct CMailWinUserInfo *mwui;
@@ -1668,19 +1667,10 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
mwui->RunFirstTime = TRUE;
SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)mwui);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:INIT:ActualAccountSO-read wait\n");
- #endif
if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:INIT:ActualAccountSO-read enter failed\n");
- #endif
DestroyWindow(hDlg);
return FALSE;
}
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:INIT:ActualAccountSO-read enter\n");
- #endif
SetDlgItemTextW(hDlg, IDC_BTNAPP, TranslateW(L"Run application"));
SetDlgItemTextW(hDlg, IDC_BTNDEL, TranslateW(L"Delete selected"));
@@ -1700,9 +1690,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), TRUE);
else
EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), FALSE);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:INIT:ActualAccountSO-read done\n");
- #endif
+
ReadDoneFcn(ActualAccount->AccountAccessSO);
WindowList_Add(YAMNVar.MessageWnds, hDlg, NULL);
@@ -1724,7 +1712,6 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case WM_DESTROY:
{
- HACCOUNT ActualAccount;
RECT coord;
LVCOLUMNW ColInfo;
NOTIFYICONDATA nid;
@@ -1744,9 +1731,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
if (ListView_GetColumn(GetDlgItem(hDlg, IDC_LISTMAILS), 3, &ColInfo))
SizeDate = ColInfo.cx;
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:DESTROY:save window position\n");
- #endif
+ #endif
if (!YAMNVar.Shutdown && GetWindowRect(hDlg, &coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
{
PosX = coord.left;
@@ -1760,24 +1747,24 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
}
KillTimer(hDlg, TIMER_FLASHING);
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:DESTROY:remove window from list\n");
- #endif
+ #endif
WindowList_Remove(YAMNVar.NewMailAccountWnd, hDlg);
WindowList_Remove(YAMNVar.MessageWnds, hDlg);
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:DESTROY:ActualAccountMsgsSO-write wait\n");
- #endif
+ #endif
if (WAIT_OBJECT_0 != WaitToWriteFcn(ActualAccount->MessagesAccessSO)) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:DESTROY:ActualAccountMsgsSO-write wait failed\n");
- #endif
+ #endif
break;
}
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:DESTROY:ActualAccountMsgsSO-write enter\n");
- #endif
+ #endif
//delete mails from queue, which are deleted from server (spam level 3 mails e.g.)
for (Parser = (HYAMNMAIL)ActualAccount->Mails; Parser != NULL; Parser = Parser->Next) {
if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags, YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it
@@ -1790,9 +1777,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
//mark mails as read (remove "new" and "unseen" flags)
if (mwui->Seen)
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY, 0, YAMN_MSG_NEW | YAMN_MSG_UNSEEN, 0);
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:DESTROY:ActualAccountMsgsSO-write done\n");
- #endif
+ #endif
WriteDoneFcn(ActualAccount->MessagesAccessSO);
memset(&nid, 0, sizeof(NOTIFYICONDATA));
@@ -1816,19 +1803,17 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
mwui->Seen = TRUE;
}
case WM_YAMN_CHANGESTATUS:
- {
- HACCOUNT ActualAccount;
- if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
- break;
+ if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
+ break;
- if ((HACCOUNT)wParam != ActualAccount)
- break;
+ if ((HACCOUNT)wParam != ActualAccount)
+ break;
- TCHAR accstatus[512];
- GetStatusFcn(ActualAccount, accstatus);
- SetDlgItemText(hDlg, IDC_STSTATUS, accstatus);
- }
+ TCHAR accstatus[512];
+ GetStatusFcn(ActualAccount, accstatus);
+ SetDlgItemText(hDlg, IDC_STSTATUS, accstatus);
return 1;
+
case WM_YAMN_CHANGECONTENT:
{
struct CUpdateMails UpdateParams;
@@ -1841,9 +1826,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
UpdateParams.Flags = (struct CChangeContent *)lParam;
UpdateParams.Waiting = !ThisThreadWindow;
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:CHANGECONTENT:posting UPDATEMAILS\n");
- #endif
+ #endif
if (ThisThreadWindow) {
if (!UpdateMails(hDlg, (HACCOUNT)wParam, UpdateParams.Flags->nflags, UpdateParams.Flags->nnflags))
DestroyWindow(hDlg);
@@ -1851,13 +1836,13 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
else if (PostMessage(hDlg, WM_YAMN_UPDATEMAILS, wParam, (LPARAM)&UpdateParams)) //this ensures UpdateMails will execute the thread who created the browser window
{
if (!ThisThreadWindow) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:CHANGECONTENT:waiting for event\n");
- #endif
+ #endif
WaitForSingleObject(UpdateParams.Copied, INFINITE);
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:CHANGECONTENT:event signaled\n");
- #endif
+ #endif
}
}
@@ -1866,14 +1851,12 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
return 1;
case WM_YAMN_UPDATEMAILS:
{
- HACCOUNT ActualAccount;
-
struct CUpdateMails *um = (struct CUpdateMails *)lParam;
DWORD nflags, nnflags;
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:UPDATEMAILS\n");
- #endif
+ #endif
if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
return 0;
@@ -1891,58 +1874,48 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
}
return 1;
case WM_YAMN_STOPACCOUNT:
- {
- HACCOUNT ActualAccount;
-
- if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
- break;
- if ((HACCOUNT)wParam != ActualAccount)
- break;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:STOPACCOUNT:sending destroy msg\n");
- #endif
- PostQuitMessage(0);
- }
+ if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
+ break;
+ if ((HACCOUNT)wParam != ActualAccount)
+ break;
+ PostQuitMessage(0);
return 1;
+
case WM_YAMN_NOTIFYICON:
- {
- HACCOUNT ActualAccount;
- if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
- break;
+ if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
+ break;
- switch (lParam) {
- case WM_LBUTTONDBLCLK:
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read wait\n");
- #endif
- if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read wait failed\n");
- #endif
- return 0;
- }
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read enter\n");
- #endif
- if (ActualAccount->AbilityFlags & YAMN_ACC_BROWSE) {
- ShowWindow(hDlg, SW_SHOWNORMAL);
- SetForegroundWindow(hDlg);
- }
- else
- DestroyWindow(hDlg);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->AccountAccessSO);
- break;
+ switch (lParam) {
+ case WM_LBUTTONDBLCLK:
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read wait\n");
+ #endif
+ if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read wait failed\n");
+ #endif
+ return 0;
}
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read enter\n");
+ #endif
+ if (ActualAccount->AbilityFlags & YAMN_ACC_BROWSE) {
+ ShowWindow(hDlg, SW_SHOWNORMAL);
+ SetForegroundWindow(hDlg);
+ }
+ else
+ DestroyWindow(hDlg);
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "MailBrowser:DBLCLICKICON:ActualAccountSO-read done\n");
+ #endif
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
break;
}
+ break;
+
case WM_YAMN_SHOWSELECTED:
{
- int iSelect;
- iSelect = SendDlgItemMessage(hDlg, IDC_LISTMAILS, LVM_GETNEXTITEM, -1, MAKELPARAM((UINT)LVNI_FOCUSED, 0)); // return item selected
-
+ int iSelect = SendDlgItemMessage(hDlg, IDC_LISTMAILS, LVM_GETNEXTITEM, -1, MAKELPARAM((UINT)LVNI_FOCUSED, 0)); // return item selected
if (iSelect != -1) {
LV_ITEMW item;
HYAMNMAIL ActualMail;
@@ -1969,184 +1942,149 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
//delete MailParam;
}
}
- } break;
+ }
+ break;
+
case WM_SYSCOMMAND:
- {
- HACCOUNT ActualAccount;
-
- if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
- break;
- switch (wParam) {
- case SC_CLOSE:
- DestroyWindow(hDlg);
- break;
- }
+ if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
+ break;
+ switch (wParam) {
+ case SC_CLOSE:
+ DestroyWindow(hDlg);
+ break;
}
break;
case WM_COMMAND:
- {
- HACCOUNT ActualAccount;
- int Items;
-
- if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
- break;
-
- switch (LOWORD(wParam)) {
- case IDC_BTNCHECKALL:
- ListView_SetItemState(GetDlgItem(hDlg, IDC_LISTMAILS), -1, 0, LVIS_SELECTED); // deselect all items
- ListView_SetItemState(GetDlgItem(hDlg, IDC_LISTMAILS), -1, LVIS_SELECTED, LVIS_SELECTED);
- Items = ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTMAILS));
- ListView_RedrawItems(GetDlgItem(hDlg, IDC_LISTMAILS), 0, Items);
- UpdateWindow(GetDlgItem(hDlg, IDC_LISTMAILS));
- SetFocus(GetDlgItem(hDlg, IDC_LISTMAILS));
- break;
-
- case IDC_BTNOK:
- DestroyWindow(hDlg);
- break;
+ if (NULL == (ActualAccount = GetWindowAccount(hDlg)))
+ break;
- case IDC_BTNAPP:
- {
- PROCESS_INFORMATION pi;
- STARTUPINFOW si;
+ switch (LOWORD(wParam)) {
+ case IDC_BTNCHECKALL:
+ ListView_SetItemState(GetDlgItem(hDlg, IDC_LISTMAILS), -1, 0, LVIS_SELECTED); // deselect all items
+ ListView_SetItemState(GetDlgItem(hDlg, IDC_LISTMAILS), -1, LVIS_SELECTED, LVIS_SELECTED);
+ Items = ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTMAILS));
+ ListView_RedrawItems(GetDlgItem(hDlg, IDC_LISTMAILS), 0, Items);
+ UpdateWindow(GetDlgItem(hDlg, IDC_LISTMAILS));
+ SetFocus(GetDlgItem(hDlg, IDC_LISTMAILS));
+ break;
- memset(&si, 0, sizeof(si));
- si.cb = sizeof(si);
+ case IDC_BTNOK:
+ DestroyWindow(hDlg);
+ break;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNAPP:ActualAccountSO-read wait\n");
- #endif
- if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNAPP:ActualAccountSO-read enter\n");
- #endif
- if (ActualAccount->NewMailN.App != NULL) {
- WCHAR *Command;
+ case IDC_BTNAPP:
+ {
+ PROCESS_INFORMATION pi;
+ STARTUPINFOW si;
+
+ memset(&si, 0, sizeof(si));
+ si.cb = sizeof(si);
+
+ if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) {
+ if (ActualAccount->NewMailN.App != NULL) {
+ WCHAR *Command;
+ if (ActualAccount->NewMailN.AppParam != NULL)
+ Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6];
+ else
+ Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6];
+
+ if (Command != NULL) {
+ mir_wstrcpy(Command, L"\"");
+ mir_wstrcat(Command, ActualAccount->NewMailN.App);
+ mir_wstrcat(Command, L"\" ");
if (ActualAccount->NewMailN.AppParam != NULL)
- Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6];
- else
- Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6];
-
- if (Command != NULL) {
- mir_wstrcpy(Command, L"\"");
- mir_wstrcat(Command, ActualAccount->NewMailN.App);
- mir_wstrcat(Command, L"\" ");
- if (ActualAccount->NewMailN.AppParam != NULL)
- mir_wstrcat(Command, ActualAccount->NewMailN.AppParam);
- CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
- delete[] Command;
- }
+ mir_wstrcat(Command, ActualAccount->NewMailN.AppParam);
+ CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+ delete[] Command;
}
-
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNAPP:ActualAccountSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->AccountAccessSO);
}
- #ifdef DEBUG_SYNCHRO
- else
- DebugLog(SynchroFile, "MailBrowser:BTNAPP:ActualAccountSO-read enter failed\n");
- #endif
- if (!(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000))
- DestroyWindow(hDlg);
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
}
- break;
- case IDC_BTNDEL:
- {
- LVITEMW item;
- HYAMNMAIL ActualMail;
- HANDLE ThreadRunningEV;
- DWORD Total = 0;
- // we use event to signal, that running thread has all needed stack parameters copied
- if (NULL == (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
- break;
- int Items = ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTMAILS));
+ if (!(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000))
+ DestroyWindow(hDlg);
+ }
+ break;
- item.stateMask = 0xFFFFFFFF;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNDEL:ActualAccountMsgsSO-write wait\n");
- #endif
- if (WAIT_OBJECT_0 == WaitToWriteFcn(ActualAccount->MessagesAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
- #endif
- for (int i = 0; i < Items; i++) {
- item.iItem = i;
- item.iSubItem = 0;
- item.mask = LVIF_PARAM | LVIF_STATE;
- item.stateMask = 0xFFFFFFFF;
- ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item);
- ActualMail = (HYAMNMAIL)item.lParam;
- if (NULL == ActualMail)
- break;
- if (item.state & LVIS_SELECTED) {
- ActualMail->Flags |= YAMN_MSG_USERDELETE; //set to mail we are going to delete it
- Total++;
- }
+ case IDC_BTNDEL:
+ {
+ LVITEMW item;
+ HYAMNMAIL ActualMail;
+ HANDLE ThreadRunningEV;
+ DWORD Total = 0;
+
+ // we use event to signal, that running thread has all needed stack parameters copied
+ if (NULL == (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
+ break;
+
+ Items = ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTMAILS));
+
+ item.stateMask = 0xFFFFFFFF;
+
+ if (WAIT_OBJECT_0 == WaitToWriteFcn(ActualAccount->MessagesAccessSO)) {
+ for (int i = 0; i < Items; i++) {
+ item.iItem = i;
+ item.iSubItem = 0;
+ item.mask = LVIF_PARAM | LVIF_STATE;
+ item.stateMask = 0xFFFFFFFF;
+ ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item);
+ ActualMail = (HYAMNMAIL)item.lParam;
+ if (NULL == ActualMail)
+ break;
+ if (item.state & LVIS_SELECTED) {
+ ActualMail->Flags |= YAMN_MSG_USERDELETE; //set to mail we are going to delete it
+ Total++;
}
+ }
- // Enable write-access to mails
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNDEL:ActualAccountMsgsSO-write done\n");
- #endif
- WriteDoneFcn(ActualAccount->MessagesAccessSO);
-
- if (Total) {
- TCHAR DeleteMsg[1024];
-
- mir_sntprintf(DeleteMsg, _countof(DeleteMsg), TranslateT("Do you really want to delete %d selected mails?"), Total);
- if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING)) {
- struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, NULL };
-
- // Find if there's mail marked to delete, which was deleted before
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNDEL:ActualAccountMsgsSO-write wait\n");
- #endif
- if (WAIT_OBJECT_0 == WaitToWriteFcn(ActualAccount->MessagesAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
- #endif
- for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != NULL; ActualMail = ActualMail->Next) {
- if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
- {
- DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, ActualMail, 1);
- CallService(MS_YAMN_DELETEACCOUNTMAIL, (WPARAM)ActualAccount->Plugin, (LPARAM)ActualMail); //delete it from memory
- continue;
- }
- }
- // Set flag to marked mails that they can be deleted
- SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_DELETEOK, 1);
- // Create new thread which deletes marked mails.
- HANDLE NewThread;
-
- if (NULL != (NewThread = mir_forkthread(ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr, (void*)&ParamToDeleteMails))) {
- WaitForSingleObject(ThreadRunningEV, INFINITE);
- CloseHandle(NewThread);
+ // Enable write-access to mails
+ WriteDoneFcn(ActualAccount->MessagesAccessSO);
+
+ if (Total) {
+ TCHAR DeleteMsg[1024];
+
+ mir_sntprintf(DeleteMsg, _countof(DeleteMsg), TranslateT("Do you really want to delete %d selected mails?"), Total);
+ if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING)) {
+ struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, NULL };
+
+ // Find if there's mail marked to delete, which was deleted before
+ if (WAIT_OBJECT_0 == WaitToWriteFcn(ActualAccount->MessagesAccessSO)) {
+ for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != NULL; ActualMail = ActualMail->Next) {
+ if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
+ {
+ DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, ActualMail, 1);
+ CallService(MS_YAMN_DELETEACCOUNTMAIL, (WPARAM)ActualAccount->Plugin, (LPARAM)ActualMail); //delete it from memory
+ continue;
}
- // Enable write-access to mails
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNDEL:ActualAccountMsgsSO-write done\n");
- #endif
- WriteDoneFcn(ActualAccount->MessagesAccessSO);
}
+ // Set flag to marked mails that they can be deleted
+ SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_DELETEOK, 1);
+ // Create new thread which deletes marked mails.
+ HANDLE NewThread;
+
+ if (NULL != (NewThread = mir_forkthread(ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr, (void*)&ParamToDeleteMails))) {
+ WaitForSingleObject(ThreadRunningEV, INFINITE);
+ CloseHandle(NewThread);
+ }
+
+ // Enable write-access to mails
+ WriteDoneFcn(ActualAccount->MessagesAccessSO);
}
- else
- //else mark messages that they are not to be deleted
- SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_USERDELETE, 0);
}
+ else //else mark messages that they are not to be deleted
+ SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_USERDELETE, 0);
}
- CloseHandle(ThreadRunningEV);
- if (db_get_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0))
- DestroyWindow(hDlg);
-
}
- break;
+ CloseHandle(ThreadRunningEV);
+ if (db_get_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0))
+ DestroyWindow(hDlg);
}
+ break;
}
break;
+
case WM_SIZE:
if (wParam == SIZE_RESTORED) {
LONG x = LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
@@ -2158,12 +2096,13 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
MoveWindow(GetDlgItem(hDlg, IDC_LISTMAILS), 5, 5, x - 10, y - 55, TRUE); //where to put list mail window while resizing
MoveWindow(GetDlgItem(hDlg, IDC_STSTATUS), 5, y - 5 - 45, x - 10, 15, TRUE); //where to put account status text while resizing
}
- // break;
return 0;
+
case WM_GETMINMAXINFO:
((LPMINMAXINFO)lParam)->ptMinTrackSize.x = MAILBROWSER_MINXSIZE;
((LPMINMAXINFO)lParam)->ptMinTrackSize.y = MAILBROWSER_MINYSIZE;
return 0;
+
case WM_TIMER:
{
NOTIFYICONDATA nid;
@@ -2191,14 +2130,14 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case NM_DBLCLK:
SendMessage(hDlg, WM_YAMN_SHOWSELECTED, 0, 0);
break;
+
case LVN_COLUMNCLICK:
- HACCOUNT ActualAccount;
if (NULL != (ActualAccount = GetWindowAccount(hDlg))) {
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;
if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
+ #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "MailBrowser:COLUMNCLICK:ActualAccountSO-read enter\n");
- #endif
+ #endif
switch ((int)pNMListView->iSubItem) {
case 0:
bFrom = !bFrom;
@@ -2216,9 +2155,6 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break;
}
ListView_SortItems(pNMListView->hdr.hwndFrom, ListViewCompareProc, pNMListView->iSubItem);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:BTNAPP:ActualAccountSO-read done\n");
- #endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
}
@@ -2226,7 +2162,6 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case NM_CUSTOMDRAW:
{
- HACCOUNT ActualAccount;
LPNMLVCUSTOMDRAW cd = (LPNMLVCUSTOMDRAW)lParam;
LONG_PTR PaintCode;
@@ -2242,11 +2177,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
{
- // COLORREF crText, crBkgnd;
- // crText= RGB(128,128,255);
HYAMNMAIL ActualMail;
BOOL umma;
-
{
struct CMailWinUserInfo *mwui;
mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER);
@@ -2255,19 +2187,11 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
ActualMail = (HYAMNMAIL)cd->nmcd.lItemlParam;
if (!ActualMail)
ActualMail = (HYAMNMAIL)readItemLParam(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait\n");
- #endif
+
if (!umma)
- if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->MessagesAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait failed\n");
- #endif
+ if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->MessagesAccessSO))
return 0;
- }
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DRAWITEM:ActualAccountMsgsSO-read enter\n");
- #endif
+
switch (ActualMail->Flags & YAMN_MSG_SPAMMASK) {
case YAMN_MSG_SPAML1:
case YAMN_MSG_SPAML2:
@@ -2288,13 +2212,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
cd->clrTextBk = RGB(220, 235, 250);
PaintCode = CDRF_DODEFAULT;
- if (!umma) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:DRAWITEM:ActualAccountMsgsSO-read done\n");
- #endif
+ if (!umma)
ReadDoneFcn(ActualAccount->MessagesAccessSO);
- }
-
break;
}
}
@@ -2372,11 +2291,11 @@ LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
&& lpmsg->wParam == VK_RETURN)
return DLGC_WANTALLKEYS;
}
- break;
}
+ break;
+
case WM_KEYDOWN:
{
-
BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
BOOL isShift = GetKeyState(VK_SHIFT) & 0x8000;
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
@@ -2393,10 +2312,8 @@ LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
SendMessage(hwndParent, WM_COMMAND, IDC_BTNDEL, 0);
break;
}
-
- break;
-
}
+ break;
}
return mir_callNextSubclass(hDlg, ListViewSubclassProc, msg, wParam, lParam);
}
@@ -2412,36 +2329,23 @@ void __cdecl MailBrowser(void *Param)
MyParam = *(struct MailBrowserWinParam *)Param;
ActualAccount = MyParam.account;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:Incrementing \"using threads\" %x (account %x)\n", ActualAccount->UsingThreads, ActualAccount);
- #endif
SCIncFcn(ActualAccount->UsingThreads);
// we will not use params in stack anymore
SetEvent(MyParam.ThreadRunningEV);
__try {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:ActualAccountSO-read wait\n");
- #endif
if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:ActualAccountSO-read wait failed\n");
- #endif
return;
}
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:ActualAccountSO-read enter\n");
- #endif
+
if (!(ActualAccount->AbilityFlags & YAMN_ACC_BROWSE)) {
MyParam.nflags = MyParam.nflags & ~YAMN_ACC_MSG;
MyParam.nnflags = MyParam.nnflags & ~YAMN_ACC_MSG;
}
if (!(ActualAccount->AbilityFlags & YAMN_ACC_POPUP))
MyParam.nflags = MyParam.nflags & ~YAMN_ACC_POP;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:ActualAccountSO-read done\n");
- #endif
+
ReadDoneFcn(ActualAccount->AccountAccessSO);
if (NULL != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount)))
@@ -2461,8 +2365,7 @@ void __cdecl MailBrowser(void *Param)
else
UpdateMails(NULL, ActualAccount, MyParam.nflags, MyParam.nnflags); //update mails without displaying or refreshing any window
- if ((hMailBrowser != NULL) && !WndFound) //we process message loop only for thread that created window
- {
+ if ((hMailBrowser != NULL) && !WndFound) { //we process message loop only for thread that created window
while (GetMessage(&msg, NULL, 0, 0)) {
if (hMailBrowser == NULL || !IsDialogMessage(hMailBrowser, &msg)) { /* Wine fix. */
TranslateMessage(&msg);
@@ -2475,9 +2378,6 @@ void __cdecl MailBrowser(void *Param)
ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr();
}
__finally {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile, "MailBrowser:Decrementing \"using threads\" %x (account %x)\n", ActualAccount->UsingThreads, ActualAccount);
- #endif
SCDecFcn(ActualAccount->UsingThreads);
}
}
diff --git a/plugins/mTextControl/src/textcontrol.cpp b/plugins/mTextControl/src/textcontrol.cpp
index e8d25fffea..daf7b6ad71 100644
--- a/plugins/mTextControl/src/textcontrol.cpp
+++ b/plugins/mTextControl/src/textcontrol.cpp
@@ -106,13 +106,13 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
/// Paint ////////////////////////////////////
LRESULT MTextControl_OnPaint(HWND hwnd, WPARAM, LPARAM)
{
- HDC hdc;
PAINTSTRUCT ps;
- hdc = BeginPaint(hwnd, &ps);
-
- RECT rc;
- GetClientRect(hwnd, &rc);
- FrameRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
+ HDC hdc = BeginPaint(hwnd, &ps);
+ {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ FrameRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
+ }
SetTextColor(hdc, RGB(0, 0, 0));
SetBkMode(hdc, TRANSPARENT);