summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp16
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp61
-rw-r--r--plugins/TabSRMM/src/utils.cpp6
-rw-r--r--plugins/TabSRMM/src/utils.h75
4 files changed, 73 insertions, 85 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index d1d2b7b050..91a6bf0b63 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -2498,7 +2498,7 @@ LABEL_SHOWWINDOW:
if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
dat->pContainer->MenuBar->autoShow();
- return(_dlgReturn(hwndDlg, 0));
+ return _dlgReturn(hwndDlg, 0);
}
if (msg == WM_MOUSEMOVE) {
@@ -2514,7 +2514,7 @@ LABEL_SHOWWINDOW:
((MSGFILTER*)lParam)->msg = WM_NULL;
((MSGFILTER*)lParam)->wParam = 0;
((MSGFILTER*)lParam)->lParam = 0;
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
}
@@ -2524,7 +2524,7 @@ LABEL_SHOWWINDOW:
if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
if (DM_GenericHotkeysCheck(&message, dat)) {
dat->fkeyProcessed = true;
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
@@ -2533,25 +2533,25 @@ LABEL_SHOWWINDOW:
switch(mim_hotkey_check) { // nothing (yet) FIXME
case TABSRMM_HK_CHANNELMGR:
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_FILTERTOGGLE:
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_LISTTOGGLE:
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_MUC_SHOWSERVER:
if (si->iType != GCW_SERVER)
pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
}
if (msg == WM_KEYDOWN && wp == VK_TAB) {
if (((NMHDR*)lParam)->idFrom == IDC_CHAT_LOG) {
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index ffcee6f554..36cce39ada 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1713,7 +1713,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
m_pContainer->MenuBar->autoShow();
- return(_dlgReturn(hwndDlg, 0));
+ return _dlgReturn(hwndDlg, 0);
}
if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
@@ -1724,25 +1724,25 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
switch (mim_hotkey_check) {
case TABSRMM_HK_SETUSERPREFS:
CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_NUDGE:
SendNudge(dat);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_SENDFILE:
CallService(MS_FILE_SENDFILE, dat->hContact, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_QUOTEMSG:
SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_USERMENU:
SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOCOL, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_USERDETAILS:
SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_EDITNOTES:
PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_TOGGLESENDLATER:
if (sendLater->isAvail()) {
dat->sendMode ^= SMODE_SENDLATER;
@@ -1752,7 +1752,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
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));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_TOGGLERTL:
{
DWORD dwGlobal = M.GetDword("mwflags", MWF_LOG_DEFAULT);
@@ -1779,7 +1779,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
}
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
case TABSRMM_HK_TOGGLEMULTISEND:
dat->sendMode ^= SMODE_MULTIPLE;
@@ -1800,11 +1800,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
else
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (DM_GenericHotkeysCheck(&message, dat)) {
dat->fkeyProcessed = true;
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
}
if (wp == VK_BROWSER_BACK || wp == VK_BROWSER_FORWARD)
@@ -1833,61 +1833,61 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
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));
+ 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));
+ return _dlgReturn(hwndDlg, 1);
}
}
if (isCtrl && !isShift && !isAlt) {
if (wp == VK_TAB) {
SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
_clrMsgFilter(lParam);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_F4) {
PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_PRIOR) {
SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_NEXT) {
SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
}
}
if (msg == WM_SYSKEYDOWN && isAlt) {
if (wp == 0x52) {
SendMessage(hwndDlg, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_MULTIPLY) {
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_DIVIDE) {
SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_ADD) {
SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (wp == VK_SUBTRACT) {
SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
}
if (msg == WM_KEYDOWN && wp == VK_F12) {
if (isShift || isCtrl || isAlt)
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
SendMessage(hwndDlg, DM_REPLAYQUEUE, 0, 0);
dat->dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
@@ -1898,7 +1898,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
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));
+ return _dlgReturn(hwndDlg, 1);
}
// tabulation mod
@@ -1909,7 +1909,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
_clrMsgFilter(lParam);
if (((NMHDR*)lParam)->idFrom != IDC_MESSAGE)
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
else {
if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
@@ -1917,14 +1917,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SetFocus(GetDlgItem(hwndDlg, IDOK));
else
SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return(_dlgReturn(hwndDlg, 1));
+ return _dlgReturn(hwndDlg, 1);
}
if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return(_dlgReturn(hwndDlg, 1));
+ 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)) {
@@ -2036,6 +2036,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
break;
+ case WM_RBUTTONUP:
+ return _dlgReturn(hwndDlg, 1);
+
case WM_MOUSEMOVE:
GetCursorPos(&pt);
DM_DismissTip(dat, pt);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index f90ae8aea0..62ab6d02e7 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -49,12 +49,6 @@ static TCHAR *formatting_strings_end[] = { _T("b0 "), _T("i0 "), _T("u0 "), _
#define NR_CODES 5
-LRESULT _dlgReturn(HWND hWnd, LRESULT result)
-{
- SetWindowLongPtr(hWnd, DWLP_MSGRESULT, result);
- return result;
-}
-
TCHAR* Utils::FilterEventMarkers(TCHAR *wszText)
{
tstring text(wszText);
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h
index 15cccca2c7..fd66f18cc5 100644
--- a/plugins/TabSRMM/src/utils.h
+++ b/plugins/TabSRMM/src/utils.h
@@ -113,13 +113,13 @@ public:
static void AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename);
- /**
- * safe strlen function - do not overflow the given buffer length
- * if the buffer does not contain a valid (zero-terminated) string, it
- * will return 0.
- *
- * careful: maxlen must be given in element counts!!
- */
+ //////////////////////////////////////////////////////////////////////////////////////
+ // safe strlen function - do not overflow the given buffer length
+ // if the buffer does not contain a valid (zero-terminated) string, it
+ // will return 0.
+ //
+ // careful: maxlen must be given in element counts!!
+
template<typename T> static size_t safe_strlen(const T* src, const size_t maxlen = 0)
{
size_t s = 0;
@@ -127,10 +127,7 @@ public:
while(s < maxlen && *(src++))
s++;
- if (s >= maxlen && *src != 0)
- return 0;
- else
- return(s);
+ return (s >= maxlen && *src != 0) ? 0 : s;
}
public:
@@ -138,14 +135,15 @@ public:
static int rtf_ctable_size;
};
-LRESULT _dlgReturn(HWND hWnd, LRESULT result);
-
-
+__forceinline LRESULT _dlgReturn(HWND hWnd, LRESULT result)
+{
+ SetWindowLongPtr(hWnd, DWLP_MSGRESULT, result);
+ return result;
+}
-/**
- * implement a warning dialog with a "do not show this again" check
- * box
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// implements a warning dialog with a "do not show this again" check
+// box
class CWarning {
@@ -168,39 +166,32 @@ public:
WARN_LAST = 11
};
- /*
- * the flags (low word is reserved for default windows flags like MB_OK etc.
- */
-
+ // the flags(low word is reserved for default windows flags like MB_OK etc.
enum {
- CWF_UNTRANSLATED = 0x00010000, // do not translate the msg (useful for some error messages)
- CWF_NOALLOWHIDE = 0x00020000 // critical message, hide the "do not show this again" check box
+ CWF_UNTRANSLATED = 0x00010000, // do not translate the msg (useful for some error messages)
+ CWF_NOALLOWHIDE = 0x00020000 // critical message, hide the "do not show this again" check box
};
CWarning(const wchar_t* tszTitle, const wchar_t* tszText, const UINT uId, const DWORD dwFlags);
~CWarning();
public:
- /*
- * static function to construct and show the dialog, returns the
- * user's choice
- */
- static LRESULT show (const int uId, DWORD dwFlags = 0, const wchar_t* tszTxt = 0);
- static void destroyAll ();
- LRESULT ShowDialog () const;
+ // static function to construct and show the dialog, returns the user's choice
+ static LRESULT show(const int uId, DWORD dwFlags = 0, const wchar_t* tszTxt = 0);
+ static void destroyAll();
+ LRESULT ShowDialog() const;
private:
- ptrT m_szTitle, m_szText;
- UINT m_uId;
- HFONT m_hFontCaption;
- DWORD m_dwFlags;
- HWND m_hwnd;
- bool m_fIsModal;
-
- INT_PTR CALLBACK dlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- //void resize () const;
- static INT_PTR CALLBACK stubDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static __int64 getMask (); // get bit mask for disabled message classes
+ ptrT m_szTitle, m_szText;
+ UINT m_uId;
+ HFONT m_hFontCaption;
+ DWORD m_dwFlags;
+ HWND m_hwnd;
+ bool m_fIsModal;
+
+ INT_PTR CALLBACK dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static __int64 getMask(); // get bit mask for disabled message classes
private:
static HANDLE hWindowList;