summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-08 12:53:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-08 12:53:35 +0300
commit1a6f8de0cfcff7500258b8b048b7216d5dc26dc9 (patch)
tree1d5ddb53464b80eff669603fb3e7171cb9e48a45 /plugins
parent69dbc8aac3c51e5ec4fdd16bb12f17071e0819df (diff)
massive code cleaning
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp2
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp243
-rw-r--r--plugins/TabSRMM/src/contactcache.h5
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp4
-rw-r--r--plugins/TabSRMM/src/globals.cpp11
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp12
-rw-r--r--plugins/TabSRMM/src/msgs.cpp5
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp37
8 files changed, 151 insertions, 168 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 0d725c26fa..066e83b176 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -173,7 +173,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg)
if (m_bIsAutosizingInput && m_iInputAreaHeight == -1) {
m_iInputAreaHeight = 0;
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
}
m_pPanel.dismissConfig();
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 7c0f5b003b..7d259557f4 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -53,10 +53,10 @@ CContactCache::CContactCache(MCONTACT hContact)
m_isValid = false;
}
-/**
- * 2nd part of the object initialization that must be callable during the
- * object's lifetime (not only on construction).
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// 2nd part of the object initialization that must be callable during the
+// object's lifetime (not only on construction).
+
void CContactCache::initPhaseTwo()
{
m_szAccount = 0;
@@ -80,10 +80,10 @@ void CContactCache::initPhaseTwo()
}
}
-/**
- * reset meta contact information. Used when meta contacts are disabled
- * on user's request.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// reset meta contact information.Used when meta contacts are disabled
+// on user's request.
+
void CContactCache::resetMeta()
{
m_isMeta = false;
@@ -92,21 +92,21 @@ void CContactCache::resetMeta()
initPhaseTwo();
}
-/**
- * if the contact has an open message window, close it.
- * window procedure will use setWindowData() to reset m_hwnd to 0.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// if the contact has an open message window, close it.
+// window procedure will use setWindowData() to reset m_hwnd to 0.
+
void CContactCache::closeWindow()
{
- if (m_hwnd)
- ::SendMessage(m_hwnd, WM_CLOSE, 1, 2);
+ if (m_dat)
+ ::SendMessage(m_dat->GetHwnd(), WM_CLOSE, 1, 2);
}
-/**
- * update private copy of the nick name. Use contact list name cache
- *
- * @return bool: true if nick has changed.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// update private copy of the nick name.Use contact list name cache
+//
+// @return bool: true if nick has changed.
+
bool CContactCache::updateNick()
{
bool fChanged = false;
@@ -119,11 +119,11 @@ bool CContactCache::updateNick()
return fChanged;
}
-/**
- * update meta (subcontact and -protocol) status. This runs when the
- * MC protocol fires one of its events OR when a relevant database value changes
- * in the master contact.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// update meta(subcontact and - protocol) status.This runs when the
+// MC protocol fires one of its events OR when a relevant database value changes
+// in the master contact.
+
void CContactCache::updateMeta()
{
if (m_isValid) {
@@ -148,10 +148,10 @@ void CContactCache::updateMeta()
}
}
-/**
- * obtain the UIN. This is only maintained for open message windows
- * it also run when the subcontact for a MC changes.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// obtain the UIN.This is only maintained for open message windows
+// it also run when the subcontact for a MC changes.
+
bool CContactCache::updateUIN()
{
m_szUIN[0] = 0;
@@ -201,56 +201,46 @@ void CContactCache::allocStats()
}
}
-/**
- * set the window data for this contact. The window procedure of the message
- * dialog will use this in WM_INITDIALOG and WM_DESTROY to tell the cache
- * that a message window is open for this contact.
- *
- * @param hwnd: window handle
- * @param dat: _MessageWindowData - window data structure
- */
-void CContactCache::setWindowData(const HWND hwnd, CSrmmWindow *dat)
+/////////////////////////////////////////////////////////////////////////////////////////
+//set the window data for this contact.The window procedure of the message
+// dialog will use this in WM_INITDIALOG and WM_DESTROY to tell the cache
+// that a message window is open for this contact.
+//
+// @param dat: CSrmmWindow* - window data structure
+
+void CContactCache::setWindowData(CSrmmWindow *dat)
{
- m_hwnd = hwnd;
m_dat = dat;
- if (hwnd && dat && m_history == 0)
- allocHistory();
- if (hwnd)
+
+ if (dat) {
+ if (m_history == nullptr)
+ allocHistory();
updateStatusMsg();
+ }
else {
- /* release memory - not needed when window isn't open */
- if (m_szStatusMsg) {
- mir_free(m_szStatusMsg);
- m_szStatusMsg = 0;
- }
- if (m_ListeningInfo) {
- mir_free(m_ListeningInfo);
- m_ListeningInfo = 0;
- }
- if (m_xStatusMsg) {
- mir_free(m_xStatusMsg);
- m_xStatusMsg = 0;
- }
+ // release memory - not needed when window isn't open
+ replaceStrW(m_szStatusMsg, nullptr);
+ replaceStrW(m_ListeningInfo, nullptr);
+ replaceStrW(m_xStatusMsg, nullptr);
}
}
-/**
- * saves message to the input history.
- * it's using streamout in UTF8 format - no unicode "issues" and all RTF formatting is saved to the history.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// saves message to the input history.
+// it's using streamout in UTF8 format - no unicode "issues" and all RTF formatting is saved to the history.
+
void CContactCache::saveHistory(WPARAM wParam, LPARAM)
{
- int oldTop = 0;
-
- if (m_hwnd == 0 || m_dat == 0)
+ if (m_dat == nullptr)
return;
+ int oldTop = 0;
if (wParam) {
oldTop = m_iHistoryTop;
m_iHistoryTop = (int)wParam;
}
- char *szFromStream = ::Message_GetFromStream(GetDlgItem(m_hwnd, IDC_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII);
+ char *szFromStream = ::Message_GetFromStream(GetDlgItem(m_dat->GetHwnd(), IDC_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII);
if (szFromStream != NULL) {
size_t iLength = 0, iStreamLength = 0;
iLength = iStreamLength = (mir_strlen(szFromStream) + 1);
@@ -290,17 +280,17 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM)
m_iHistoryTop = oldTop;
}
-/**
- * handle the input history scrolling for the message input area
- * @param wParam: VK_ keyboard code (VK_UP or VK_DOWN)
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// handle the input history scrolling for the message input area
+// @param wParam: VK_ keyboard code (VK_UP or VK_DOWN)
+
void CContactCache::inputHistoryEvent(WPARAM wParam)
{
- if (m_hwnd == 0 || m_dat == 0)
+ if (m_dat == nullptr)
return;
if (m_history != NULL && m_history[0].szText != NULL) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;)
- HWND hwndEdit = ::GetDlgItem(m_hwnd, IDC_MESSAGE);
+ HWND hwndEdit = ::GetDlgItem(m_dat->GetHwnd(), IDC_MESSAGE);
SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
if (m_dat->m_dwFlags & MWF_NEEDHISTORYSAVE) {
@@ -335,19 +325,19 @@ void CContactCache::inputHistoryEvent(WPARAM wParam)
}
else ::SetWindowText(hwndEdit, L"");
}
- ::SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(hwndEdit), EN_CHANGE), (LPARAM)hwndEdit);
+ ::SendMessage(m_dat->GetHwnd(), WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(hwndEdit), EN_CHANGE), (LPARAM)hwndEdit);
m_dat->m_dwFlags &= ~MWF_NEEDHISTORYSAVE;
}
}
-/**
- * allocate the input history (on-demand, when it is requested by
- * opening a message window for this contact).
- *
- * note: it allocs historysize + 1 elements, because the + 1 is used
- * for the temporary buffer which saves the current input line when
- * using input history scrolling.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// allocate the input history(on - demand, when it is requested by
+// opening a message window for this contact).
+//
+// note: it allocs historysize + 1 elements, because the + 1 is used
+// for the temporary buffer which saves the current input line when
+// using input history scrolling.
+
void CContactCache::allocHistory()
{
m_iHistorySize = M.GetByte("historysize", 15);
@@ -362,9 +352,9 @@ void CContactCache::allocHistory()
m_history[m_iHistorySize].lLen = HISTORY_INITIAL_ALLOCSIZE;
}
-/**
- * release additional memory resources
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// release additional memory resources
+
void CContactCache::releaseAlloced()
{
if (m_stats) {
@@ -384,37 +374,37 @@ void CContactCache::releaseAlloced()
m_szStatusMsg = NULL;
}
-/**
- * when a contact is deleted, mark it as invalid in the cache and release
- * all memory it has allocated.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// when a contact is deleted, mark it as invalid in the cache and release
+// all memory it has allocated.
+
void CContactCache::deletedHandler()
{
cc = &ccInvalid;
m_isValid = false;
- if (m_hwnd)
- ::SendMessage(m_hwnd, WM_CLOSE, 1, 2);
+ if (m_dat)
+ ::SendMessage(m_dat->GetHwnd(), WM_CLOSE, 1, 2);
releaseAlloced();
m_hContact = INVALID_CONTACT_ID;
}
-/**
- * udpate favorite or recent state. runs when user manually adds
- * or removes a user from that list or when database setting is
- * changed from elsewhere
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// udpate favorite or recent state.runs when user manually adds
+// or removes a user from that list or when database setting is
+// changed from elsewhere
+
void CContactCache::updateFavorite()
{
m_isFavorite = M.GetBool(m_hContact, "isFavorite", false);
m_isRecent = M.GetDword(m_hContact, "isRecent", 0) ? true : false;
}
-/**
- * update all or only the given status message information from the database
- *
- * @param szKey: char* database key name or 0 to reload all messages
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// update all or only the given status message information from the database
+//
+// @param szKey: char* database key name or 0 to reload all messages
+
void CContactCache::updateStatusMsg(const char *szKey)
{
if (!m_isValid)
@@ -449,14 +439,13 @@ void CContactCache::updateStatusMsg(const char *szKey)
m_xStatus = db_get_b(hContact, cc->szProto, "XStatusId", 0);
}
-/**
- * retrieve contact cache entry for the given contact. It _never_ returns zero, for a hContact
- * 0, it retrieves a dummy object.
- * Non-existing cache entries are created on demand.
- *
- * @param hContact: contact handle
- * @return CContactCache* pointer to the cache entry for this contact
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// retrieve contact cache entry for the given contact.It _never_ returns zero, for a hContact
+// 0, it retrieves a dummy object.
+// Non-existing cache entries are created on demand.
+//
+// @param hContact: contact handle
+// @return CContactCache* pointer to the cache entry for this contact
CContactCache* CContactCache::getContactCache(MCONTACT hContact)
{
@@ -468,13 +457,13 @@ CContactCache* CContactCache::getContactCache(MCONTACT hContact)
return cc;
}
-/**
- * when the state of the meta contacts protocol changes from enabled to disabled
- * (or vice versa), this updates the contact cache
- *
- * it is ONLY called from the DBSettingChanged() event handler when the relevant
- * database value is touched.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// when the state of the meta contacts protocol changes from enabled to disabled
+// (or vice versa), this updates the contact cache
+//
+// it is ONLY called from the DBSettingChanged() event handler when the relevant
+// database value is touched.
+
int CContactCache::cacheUpdateMetaChanged(WPARAM bMetaEnabled, LPARAM)
{
for (int i = 0; i < arContacts.getCount(); i++) {
@@ -495,12 +484,12 @@ int CContactCache::cacheUpdateMetaChanged(WPARAM bMetaEnabled, LPARAM)
return 0;
}
-/**
- * normalize the status message with proper cr/lf sequences.
- * @param src wchar_t*: original status message
- * @param fStripAll bool: strip all cr/lf sequences and replace them with spaces (use for title bar)
- * @return wchar_t*: converted status message. CALLER is responsible to mir_free it, MUST use mir_free()
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// normalize the status message with proper cr / lf sequences.
+// @param src wchar_t*: original status message
+// @param fStripAll bool: strip all cr/lf sequences and replace them with spaces (use for title bar)
+// @return wchar_t*: converted status message. CALLER is responsible to mir_free it, MUST use mir_free()
+
wchar_t* CContactCache::getNormalizedStatusMsg(const wchar_t *src, bool fStripAll)
{
if (src == 0 || mir_wstrlen(src) < 2)
@@ -525,12 +514,12 @@ wchar_t* CContactCache::getNormalizedStatusMsg(const wchar_t *src, bool fStripAl
return mir_wstrndup(dest, dest.GetLength());
}
-/**
- * retrieve the tab/title icon for the corresponding session.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// retrieve the tab / title icon for the corresponding session.
+
HICON CContactCache::getIcon(int &iSize) const
{
- if (!m_dat || !m_hwnd)
+ if (!m_dat)
return Skin_LoadProtoIcon(cc->szProto, getStatus());
if (m_dat->m_dwFlags & MWF_ERRORSTATE)
@@ -557,17 +546,17 @@ size_t CContactCache::getMaxMessageLength()
m_nMax = CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, hContact);
if (m_nMax) {
if (M.GetByte("autosplit", 0)) {
- if (m_hwnd)
- ::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
+ if (m_dat)
+ ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
}
else {
- if (m_hwnd)
- ::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, (LPARAM)m_nMax);
+ if (m_dat)
+ ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_MESSAGE, EM_EXLIMITTEXT, 0, (LPARAM)m_nMax);
}
}
else {
- if (m_hwnd)
- ::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
+ if (m_dat)
+ ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
m_nMax = 20000;
}
}
diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h
index d1f7e2ddb2..8dbe60e8d6 100644
--- a/plugins/TabSRMM/src/contactcache.h
+++ b/plugins/TabSRMM/src/contactcache.h
@@ -84,8 +84,6 @@ struct CContactCache : public MZeroedObject
__forceinline LPCWSTR getXStatusMsg() const { return m_xStatusMsg; }
__forceinline LPCWSTR getListeningInfo() const { return m_ListeningInfo; }
__forceinline BYTE getXStatusId() const { return m_xStatus; }
- __forceinline HWND getWindowData(CSrmmWindow* &dat) const { dat = m_dat; return m_hwnd; }
- __forceinline HWND getHwnd() const { return m_hwnd; }
__forceinline DWORD getSessionStart() const { return m_stats->started; }
__forceinline int getSessionMsgCount() const { return (int)m_stats->messageCount; }
@@ -107,7 +105,7 @@ struct CContactCache : public MZeroedObject
void updateMeta();
bool updateUIN();
void updateStatusMsg(const char *szKey = 0);
- void setWindowData(const HWND hwnd = 0, CSrmmWindow *dat = 0);
+ void setWindowData(CSrmmWindow *dat = 0);
void resetMeta();
void closeWindow();
void deletedHandler();
@@ -142,7 +140,6 @@ private:
bool m_isValid;
bool m_isFavorite;
bool m_isRecent;
- HWND m_hwnd;
int m_nMax;
int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 805a331c97..baadd99bf8 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -183,7 +183,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar
memset(&cfOld, 0, sizeof(CHARFORMAT2));
cfOld.cbSize = cf.cbSize = sizeof(CHARFORMAT2);
cfOld.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT;
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld);
+ m_message.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld);
BOOL isBold = (cfOld.dwEffects & CFE_BOLD) && (cfOld.dwMask & CFM_BOLD);
BOOL isItalic = (cfOld.dwEffects & CFE_ITALIC) && (cfOld.dwMask & CFM_ITALIC);
BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE);
@@ -218,7 +218,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar
cf.dwMask = CFM_STRIKEOUT;
CheckDlgButton(m_hwnd, IDC_FONTSTRIKEOUT, !isStrikeout ? BST_CHECKED : BST_UNCHECKED);
}
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
break;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 4260385af8..21c8880da1 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -415,7 +415,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam)
dat->m_nTypeSecs = 0;
dat->m_bShowTyping = 0;
dat->m_wszStatusBar[0] = 0;
- PostMessage(c->getHwnd(), DM_UPDATELASTMESSAGE, 0, 0);
+ PostMessage(dat->GetHwnd(), DM_UPDATELASTMESSAGE, 0, 0);
}
}
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_LOGSTATUSCHANGE, MAKELONG(c->getStatus(), c->getOldStatus()), (LPARAM)c);
@@ -447,10 +447,11 @@ int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM)
if (hContact) {
CContactCache *c = CContactCache::getContactCache(hContact);
c->updateMeta();
- if (c->getHwnd()) {
- ::PostMessage(c->getHwnd(), DM_UPDATETITLE, 0, 1);
- ::PostMessage(c->getHwnd(), DM_UPDATEPICLAYOUT, 0, 0);
- InvalidateRect(c->getHwnd(), 0, TRUE); // force redraw
+ CTabBaseDlg *pDlg = c->getDat();
+ if (pDlg) {
+ ::PostMessage(pDlg->GetHwnd(), DM_UPDATETITLE, 0, 1);
+ ::PostMessage(pDlg->GetHwnd(), DM_UPDATEPICLAYOUT, 0, 0);
+ InvalidateRect(pDlg->GetHwnd(), 0, TRUE); // force redraw
}
}
return 0;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 1fe9cb4fb5..2a6879c258 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -265,7 +265,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg)
if (m_bIsAutosizingInput && m_iInputAreaHeight == -1) {
m_iInputAreaHeight = 0;
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
}
if (m_pWnd)
@@ -434,7 +434,6 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
HWND hwndParent = GetParent(hwnd);
CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
bool isCtrl, isShift, isAlt;
- mwdat->KbdState(isShift, isCtrl, isAlt);
switch (msg) {
case WM_KILLFOCUS:
@@ -449,6 +448,7 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
break;
case WM_CHAR:
+ mwdat->KbdState(isShift, isCtrl, isAlt);
if (wParam == 0x03 && isCtrl) // Ctrl+C
return Utils::WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
if (wParam == 0x11 && isCtrl)
@@ -478,6 +478,7 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
break;
case WM_KEYDOWN:
+ mwdat->KbdState(isShift, isCtrl, isAlt);
if (wParam == VK_INSERT && isCtrl)
return Utils::WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
break;
@@ -922,11 +923,6 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
CSrmmWindow::CSrmmWindow()
: CTabBaseDlg(IDD_MSGSPLITNEW)
{
- m_pLog = &m_log;
- m_pEntry = &m_message;
- m_autoClose = 0;
-
- m_dwFlags = MWF_INITMODE;
m_bType = SESSIONTYPE_IM;
}
@@ -967,7 +963,7 @@ void CSrmmWindow::OnInitDialog()
m_cache = CContactCache::getContactCache(m_hContact);
m_cache->updateNick();
- m_cache->setWindowData(m_hwnd, this);
+ m_cache->setWindowData(this);
M.AddWindow(m_hwnd, m_hContact);
BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
CProxyWindow::add(this);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 20921cdf39..31bc0d300f 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -122,12 +122,13 @@ CTabBaseDlg::CTabBaseDlg(int iResource)
: CSrmmBaseDialog(g_hInst, iResource),
m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
- m_pPanel(this)
+ m_pPanel(this),
+ m_dwFlags(MWF_INITMODE)
{
m_pLog = &m_log;
m_pEntry = &m_message;
- m_autoClose = 0;
+ m_autoClose = CLOSE_ON_CANCEL;
m_forceResizable = true;
}
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index f42d2c4d6a..f9da0a08a4 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -592,25 +592,19 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
if (tabdat == NULL || tabdat->pContainer == NULL)
return;
- PAINTSTRUCT ps;
- HDC hdc;
- RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
- RECT rectUpDn = { 0, 0, 0, 0 };
- int nCount = TabCtrl_GetItemCount(hwnd), i;
- int iActive, hotItem;
- POINT pt;
- DWORD dwStyle = tabdat->dwStyle;
- UINT uiFlags = 1;
- UINT uiBottom = 0;
- bool isAero = M.isAero();
- HANDLE hpb = 0;
- BOOL bClassicDraw = !isAero && (tabdat->m_VisualStyles == FALSE || CSkin::m_skinEnabled);
-
if (GetUpdateRect(hwnd, NULL, TRUE) == 0)
return;
+ RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
+ RECT rectUpDn = { 0, 0, 0, 0 };
+ int nCount = TabCtrl_GetItemCount(hwnd), i;
+ DWORD dwStyle = tabdat->dwStyle;
+ bool isAero = M.isAero();
+ BOOL bClassicDraw = !isAero && (tabdat->m_VisualStyles == FALSE || CSkin::m_skinEnabled);
+
+ POINT pt;
GetCursorPos(&pt);
- hotItem = GetTabItemFromMouse(hwnd, &pt);
+ int hotItem = GetTabItemFromMouse(hwnd, &pt);
if (tabdat->iHoveredTabIndex != hotItem)
InvalidateRect(hwnd, NULL, FALSE);
tabdat->iHoveredTabIndex = hotItem;
@@ -634,6 +628,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
}
else tabdat->fAeroTabs = FALSE;
+ PAINTSTRUCT ps;
HDC hdcreal = BeginPaint(hwnd, &ps);
// switchbar is active, don't paint a single pixel, the tab control won't be visible at all
@@ -648,18 +643,21 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
GetClientRect(hwnd, &rctPage);
rctOrig = rctPage;
- iActive = TabCtrl_GetCurSel(hwnd);
+ int iActive = TabCtrl_GetCurSel(hwnd);
TabCtrl_GetItemRect(hwnd, iActive, &rctActive);
int cx = rctPage.right - rctPage.left;
int cy = rctPage.bottom - rctPage.top;
// draw everything to a memory dc to avoid flickering
+ HDC hdc;
+ HANDLE hpb;
HBITMAP bmpMem, bmpOld;
if (CMimAPI::m_haveBufferedPaint) {
hpb = tabdat->hbp = CSkin::InitiateBufferedPaint(hdcreal, rctPage, hdc);
bmpMem = bmpOld = 0;
}
else {
+ hpb = nullptr;
hdc = CreateCompatibleDC(hdcreal);
bmpMem = tabdat->fAeroTabs ? CSkin::CreateAeroCompatibleBitmap(rctPage, hdcreal) : CreateCompatibleBitmap(hdcreal, cx, cy);
bmpOld = (HBITMAP)SelectObject(hdc, bmpMem);
@@ -673,6 +671,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
else
CSkin::FillBack(hdc, &rctPage);
+ UINT uiBottom;
if (dwStyle & TCS_BUTTONS) {
RECT rc1;
TabCtrl_GetItemRect(hwnd, nCount - 1, &rc1);
@@ -710,7 +709,9 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
ExcludeClipRect(hdc, rctClip.left, rctClip.top, rctClip.right, rctClip.bottom);
else
memset(&rctClip, 0, sizeof(RECT));
+
if ((!bClassicDraw || PluginConfig.m_fillColor) && IntersectRect(&rectTemp, &rctPage, &ps.rcPaint) && !CSkin::m_skinEnabled) {
+ UINT uiFlags = 1;
RECT rcClient = rctPage;
if (dwStyle & TCS_BOTTOM) {
rcClient.bottom = rctPage.bottom;
@@ -835,8 +836,6 @@ page_done:
FillRect(hdc, &rcPage, CSkin::m_BrushBack);
}
- uiFlags = 0;
-
// figure out hottracked item (if any)
if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
@@ -857,7 +856,7 @@ page_done:
if (IntersectRect(&rectTemp, &rcItem, &ps.rcPaint) || bClassicDraw) {
int nHint = 0;
if (!bClassicDraw && !(dwStyle & TCS_BUTTONS)) {
- DrawThemesXpTabItem(hdc, &rcItem, uiFlags | uiBottom | (i == hotItem ? 4 : 0), tabdat, dat);
+ DrawThemesXpTabItem(hdc, &rcItem, uiBottom | (i == hotItem ? 4 : 0), tabdat, dat);
DrawItem(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), i, dat);
}
else {