summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-06 13:51:43 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-06 13:51:43 +0300
commit2baf1b9fc764b59f963f94faf01cbed28622717a (patch)
tree819beadce3ab775e584430f3fd12f4e6722a02c0 /plugins/TabSRMM
parentac92ec1a55354e57b8cc6d4fd77aa2e75a896242 (diff)
TNewWindowData - unneeded structure removed
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/res/msgwindow.rc2
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp4
-rw-r--r--plugins/TabSRMM/src/chat/chat.h2
-rw-r--r--plugins/TabSRMM/src/chat/chat_resource.h2
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp156
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp15
-rw-r--r--plugins/TabSRMM/src/container.cpp16
-rw-r--r--plugins/TabSRMM/src/functions.h3
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp2
-rw-r--r--plugins/TabSRMM/src/mim.cpp8
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp61
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp8
-rw-r--r--plugins/TabSRMM/src/msgs.cpp65
-rw-r--r--plugins/TabSRMM/src/msgs.h28
-rw-r--r--plugins/TabSRMM/src/resource.h3
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp2
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp2
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp4
20 files changed, 163 insertions, 224 deletions
diff --git a/plugins/TabSRMM/res/msgwindow.rc b/plugins/TabSRMM/res/msgwindow.rc
index 92d7e9850e..c5ce2018e5 100644
--- a/plugins/TabSRMM/res/msgwindow.rc
+++ b/plugins/TabSRMM/res/msgwindow.rc
@@ -34,7 +34,7 @@ IDD_MSGSPLITNEW DIALOGEX 0, 0, 188, 79
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_SPLITTER,"Static",SS_ENHMETAFILE,0,46,187,1
+ CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,46,187,1
CONTROL "",IDC_MESSAGE,"RichEdit50W",ES_MULTILINE |
ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN |
WS_VSCROLL | WS_TABSTOP,0,48,144,31,WS_EX_ACCEPTFILES |
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index ac82009a2f..8aaf17a9b3 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -145,7 +145,7 @@ void CTabBaseDlg::BB_InitDlgButtons()
BYTE gap = DPISCALEX_S(db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1));
RECT rcSplitter;
- GetWindowRect(GetDlgItem(m_hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter);
+ GetWindowRect(GetDlgItem(m_hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTERY : IDC_SPLITTERY), &rcSplitter);
POINT ptSplitter = { 0, rcSplitter.top };
ScreenToClient(m_hwnd, &ptSplitter);
@@ -220,7 +220,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos()
HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount() + 1);
RECT rcSplitter;
- GetWindowRect(GetDlgItem(hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter);
+ GetWindowRect(GetDlgItem(hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTERY : IDC_SPLITTERY), &rcSplitter);
POINT ptSplitter = { 0, rcSplitter.top };
ScreenToClient(hwnd, &ptSplitter);
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index de0f4cc330..9551527c54 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -114,8 +114,6 @@ HICON LoadIconEx(char *pszIcoLibName);
// services.c
void ShowRoom(SESSION_INFO *si);
-HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup);
-
// manager.c
SESSION_INFO* SM_FindSessionByHWND(HWND h);
SESSION_INFO* SM_FindSessionByHCONTACT(MCONTACT h);
diff --git a/plugins/TabSRMM/src/chat/chat_resource.h b/plugins/TabSRMM/src/chat/chat_resource.h
index 564aa61fe7..277097f308 100644
--- a/plugins/TabSRMM/src/chat/chat_resource.h
+++ b/plugins/TabSRMM/src/chat/chat_resource.h
@@ -12,7 +12,6 @@
#define IDD_OPTIONS4 408
#define IDD_ADDHIGHLIGHT 409
#define IDC_SMILEY 1007
-#define IDC_SPLITTERY 1008
#define IDC_FILTER 1013
#define IDC_CHANMGR 1014
#define IDC_SHOWNICKLIST 1015
@@ -34,7 +33,6 @@
#define IDC_LIMIT 1050
#define IDC_LOGTIMESTAMP 1051
#define IDC_GROUP 1057
-#define IDC_SPLITTERX 1058
#define IDC_RADIO2 1062
#define IDC_RADIO3 1063
#define IDC_TEXT 1064
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index bf7853e93f..82be123c55 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -28,26 +28,46 @@
#include "../stdafx.h"
-HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup)
+void ShowRoom(SESSION_INFO *si)
{
+ if (si == nullptr)
+ return;
+
+ if (si->hWnd != nullptr) {
+ ActivateExistingTab(si->dat->m_pContainer, si->hWnd);
+ return;
+ }
+
+ wchar_t szName[CONTAINER_NAMELEN + 2]; szName[0] = 0;
+ TContainerData *pContainer = nullptr;
+ if (si->dat != nullptr)
+ pContainer = si->dat->m_pContainer;
+ if (pContainer == nullptr) {
+ GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
+ if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default"))
+ wcsncpy(szName, L"Chat Rooms", CONTAINER_NAMELEN);
+ szName[CONTAINER_NAMELEN] = 0;
+ pContainer = FindContainerByName(szName);
+ }
+ if (pContainer == nullptr)
+ pContainer = CreateContainer(szName, FALSE, si->hContact);
+ if (pContainer == nullptr)
+ return; // smth went wrong, nothing to do here
+
MCONTACT hContact = si->hContact;
if (M.FindWindow(hContact) != 0)
- return 0;
+ return;
if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) {
if ((pContainer = FindMatchingContainer(L"default")) == NULL) {
wchar_t szName[CONTAINER_NAMELEN + 1];
mir_snwprintf(szName, L"default");
if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL)
- return 0;
+ return;
}
}
- TNewWindowData newData = { 0 };
- newData.hContact = hContact;
- memset(&newData.item, 0, sizeof(newData.item));
-
- wchar_t *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0);
+ wchar_t *contactName = pcli->pfnGetContactDisplayName(hContact, 0);
// cut nickname if larger than x chars...
wchar_t newcontactname[128];
@@ -59,14 +79,10 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
}
else wcsncpy_s(newcontactname, L"_U_", _TRUNCATE);
- newData.item.pszText = newcontactname;
- newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
- newData.item.iImage = 0;
-
HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
// hide the active tab
- if (pContainer->hwndActive && bActivateTab)
+ if (pContainer->hwndActive)
ShowWindow(pContainer->hwndActive, SW_HIDE);
int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100);
@@ -74,7 +90,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
pContainer->iTabIndex = iCount;
if (iCount > 0) {
- TCITEM item = { 0 };
+ TCITEM item = {};
for (int i = iCount - 1; i >= 0; i--) {
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &item);
@@ -88,97 +104,55 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
}
}
- int newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item);
+ TCITEM item = {};
+ item.pszText = newcontactname;
+ item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
+ int iTabId = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &item);
+
SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0);
- if (bActivateTab)
- TabCtrl_SetCurSel(hwndTab, newItem);
- newData.iTabID = newItem;
- newData.iTabImage = newData.item.iImage;
- newData.pContainer = pContainer;
- newData.iActivate = bActivateTab;
+ TabCtrl_SetCurSel(hwndTab, iTabId);
pContainer->iChilds++;
- newData.bWantPopup = bWantPopup;
- newData.si = si;
- CChatRoomDlg *pDlg = new CChatRoomDlg(&newData);
- pDlg->SetParent(GetDlgItem(pContainer->hwnd, IDC_MSGTABS));
+ CChatRoomDlg *pDlg = new CChatRoomDlg(si);
+ pDlg->m_iTabID = iTabId;
+ pDlg->m_pContainer = pContainer;
+ pDlg->SetParent(hwndTab);
pDlg->Create();
HWND hwndNew = pDlg->GetHwnd();
- if (pContainer->dwFlags & CNT_SIDEBAR) {
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndNew, GWLP_USERDATA);
- if (dat)
- pContainer->SideBar->addSession(dat, pContainer->iTabIndex);
- }
+
+ if (pContainer->dwFlags & CNT_SIDEBAR)
+ pContainer->SideBar->addSession(pDlg, pContainer->iTabIndex);
+
SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
// if the container is minimized, then pop it up...
if (IsIconic(pContainer->hwnd)) {
- if (bPopupContainer) {
- SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
- SetFocus(pContainer->hwndActive);
- }
- else {
- if (pContainer->dwFlags & CNT_NOFLASH)
- SendMessage(pContainer->hwnd, DM_SETICON, 0, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
- else
- FlashContainer(pContainer, 1, 0);
- }
+ SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ SetFocus(pContainer->hwndActive);
}
- if (bActivateTab) {
- if (PluginConfig.m_bHideOnClose && !IsWindowVisible(pContainer->hwnd)) {
- WINDOWPLACEMENT wp = { 0 };
- wp.length = sizeof(wp);
- GetWindowPlacement(pContainer->hwnd, &wp);
-
- BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation
- if (wp.showCmd == SW_SHOWMAXIMIZED)
- ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
- else {
- if (bPopupContainer)
- ShowWindow(pContainer->hwnd, SW_SHOWNORMAL);
- else
- ShowWindow(pContainer->hwnd, SW_SHOWMINNOACTIVE);
- }
- SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
- SetFocus(hwndNew);
- }
+
+ if (PluginConfig.m_bHideOnClose && !IsWindowVisible(pContainer->hwnd)) {
+ WINDOWPLACEMENT wp = { 0 };
+ wp.length = sizeof(wp);
+ GetWindowPlacement(pContainer->hwnd, &wp);
+
+ BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation
+ if (wp.showCmd == SW_SHOWMAXIMIZED)
+ ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
else {
- SetFocus(hwndNew);
- RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_INVALIDATE);
- UpdateWindow(pContainer->hwnd);
- if (GetForegroundWindow() != pContainer->hwnd && bPopupContainer == TRUE)
- SetForegroundWindow(pContainer->hwnd);
+ ShowWindow(pContainer->hwnd, SW_SHOWNORMAL);
}
+ SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
+ SetFocus(hwndNew);
+ }
+ else {
+ SetFocus(hwndNew);
+ RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_INVALIDATE);
+ UpdateWindow(pContainer->hwnd);
+ if (GetForegroundWindow() != pContainer->hwnd)
+ SetForegroundWindow(pContainer->hwnd);
}
if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M.GetByte("forceAeroPeek", 0))
CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING | MB_OK);
- return hwndNew; // return handle of the new dialog
-}
-
-void ShowRoom(SESSION_INFO *si)
-{
- if (si == nullptr)
- return;
-
- if (si->hWnd != nullptr) {
- ActivateExistingTab(si->dat->m_pContainer, si->hWnd);
- return;
- }
-
- wchar_t szName[CONTAINER_NAMELEN + 2]; szName[0] = 0;
- TContainerData *pContainer = nullptr;
- if (si->dat != nullptr)
- pContainer = si->dat->m_pContainer;
- if (pContainer == nullptr) {
- GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
- if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default"))
- wcsncpy(szName, L"Chat Rooms", CONTAINER_NAMELEN);
- szName[CONTAINER_NAMELEN] = 0;
- pContainer = FindContainerByName(szName);
- }
- if (pContainer == nullptr)
- pContainer = CreateContainer(szName, FALSE, si->hContact);
- if (pContainer)
- si->hWnd = CreateNewRoom(pContainer, si, TRUE, TRUE, FALSE);
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index dd9568becc..47feb637df 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -274,7 +274,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS* p)
else if (dat->m_iFlashIcon) {
dat->m_hTabIcon = dat->m_iFlashIcon;
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_IMAGE;
item.iImage = 0;
TabCtrl_SetItem(GetParent(si->hWnd), dat->m_iTabID, &item);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 152c958ae8..97e50a8b93 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1512,8 +1512,8 @@ static void __cdecl phase2(void * lParam)
// the actual group chat session window procedure.Handles the entire chat session window
// which is usually a (tabbed) child of a container class window.
-CChatRoomDlg::CChatRoomDlg(TNewWindowData *pData)
- : CTabBaseDlg(pData, IDD_CHANNEL),
+CChatRoomDlg::CChatRoomDlg(SESSION_INFO *_si)
+ : CTabBaseDlg(IDD_CHANNEL),
m_btnOk(this, IDOK),
m_list(this, IDC_LIST),
m_btnBold(this, IDC_BOLD),
@@ -1528,7 +1528,7 @@ CChatRoomDlg::CChatRoomDlg(TNewWindowData *pData)
{
m_bType = SESSIONTYPE_CHAT;
- si = newData->si;
+ si = _si;
m_hContact = si->hContact;
m_szProto = GetContactProto(si->hContact);
@@ -1575,10 +1575,7 @@ void CChatRoomDlg::OnInitDialog()
m_cache = CContactCache::getContactCache(m_hContact);
m_cache->updateNick();
m_cache->updateUIN();
- newData->item.lParam = (LPARAM)m_hwnd;
- TabCtrl_SetItem(m_hwndParent, newData->iTabID, &newData->item);
- m_iTabID = newData->iTabID;
- m_pContainer = newData->pContainer;
+
si->hWnd = m_hwnd;
si->dat = this;
m_bIsAutosizingInput = IsAutoSplitEnabled();
@@ -2060,7 +2057,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (m_cache->getStatus() != m_cache->getOldStatus()) {
wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_wStatus, 0), _TRUNCATE);
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_TEXT;
item.pszText = m_wszTitle;
TabCtrl_SetItem(m_hwndParent, m_iTabID, &item);
@@ -3037,7 +3034,7 @@ LABEL_SHOWWINDOW:
i++;
TabCtrl_SetCurSel(m_hwndParent, i);
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(m_hwndParent, i, &item); // retrieve dialog hwnd for the now active tab...
m_pContainer->hwndActive = (HWND)item.lParam;
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index a48d215385..e2fbfaed7e 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1428,7 +1428,7 @@ panel_found:
if ((iItem = GetTabItemFromMouse(hwndTab, (POINT*)lParam)) != -1) {
HWND hwndCurrent = pContainer->hwndActive;
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, iItem, &item);
if (item.lParam) {
@@ -1635,7 +1635,7 @@ panel_found:
DWORD dwTimestamp;
{
int iItems = TabCtrl_GetItemCount(hwndTab);
- TCITEM item = { 0 };
+ TCITEM item = {};
RECENTINFO *ri = (RECENTINFO *)lParam;
ri->iFirstIndex = ri->iMostRecent = -1;
@@ -1833,7 +1833,7 @@ panel_found:
if (lParam == 0 && TabCtrl_GetItemCount(hwndTab) > 0) {
int clients = TabCtrl_GetItemCount(hwndTab), iOpenJobs = 0;
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
for (int i = 0; i < clients; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
@@ -1858,7 +1858,7 @@ panel_found:
wp.length = sizeof(wp);
if (GetWindowPlacement(hwndDlg, &wp) != 0) {
if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item);
@@ -1893,7 +1893,7 @@ panel_found:
// clear temp flags which should NEVER be saved...
if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
for (int i = 0; i < TabCtrl_GetItemCount(hwndTab); i++) {
@@ -2002,7 +2002,7 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
{
int iItems = TabCtrl_GetItemCount(hwndTab);
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
for (int i = 0; i < iItems; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
@@ -2014,7 +2014,7 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
{
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, idx, &item);
return (HWND)item.lParam;
@@ -2367,7 +2367,7 @@ void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WP
return;
HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
int nCount = TabCtrl_GetItemCount(hwndTab);
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index 631ad8de83..7d2c820c2f 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -70,8 +70,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT iSelection);
* gneric msgwindow functions(creation, container management etc.)
*/
-HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, int isSend,
- const char *pszInitialText, BOOL bActivateTAb, BOOL bPopupContainer, BOOL bWantPopup, MEVENT hdbEvent);
+HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, bool bActivateTAb, bool bPopupContainer, bool bWantPopup, MEVENT hdbEvent = 0, bool bIsWchar = false, const char *pszInitialText = nullptr);
int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd);
void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iNum);
void TSAPI CreateImageList(BOOL bInitial);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index a079cb67f2..a3fcb7c383 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1415,7 +1415,7 @@ void CTabBaseDlg::DM_UpdateTitle(WPARAM, LPARAM lParam)
if (m_iTabID == -1)
return;
- TCITEM item = { 0 };
+ TCITEM item = {};
wchar_t newtitle[128];
if (m_hContact) {
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 549ea6a18d..ed75b909ba 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -381,7 +381,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else
SendMessage(hWnd, WM_CLOSE, 0, 1);
- CreateNewTabForContact((TContainerData*)wParam, lParam, 0, NULL, TRUE, TRUE, FALSE, 0);
+ CreateNewTabForContact((TContainerData*)wParam, lParam, true, true, false);
}
}
}
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index b85e7ac1e8..2ef1e245bc 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -502,7 +502,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
if (pContainer)
- CreateNewTabForContact(pContainer, hContact, 0, NULL, TRUE, TRUE, FALSE, 0);
+ CreateNewTabForContact(pContainer, hContact, true, true, false);
return 0;
}
@@ -511,18 +511,18 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (pContainer != NULL) {
if (M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) {
if ((pContainer = FindMatchingContainer(L"default")) != NULL) {
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
+ CreateNewTabForContact(pContainer, hContact, bActivate, bPopup, true, hDbEvent);
return 0;
}
}
else {
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
+ CreateNewTabForContact(pContainer, hContact, bActivate, bPopup, true, hDbEvent);
return 0;
}
}
if (bAutoContainer) {
if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact)) != NULL) { // 2 means create minimized, don't popup...
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
+ CreateNewTabForContact(pContainer, hContact, bActivate, bPopup, true, hDbEvent);
SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0);
}
return 0;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index c853b3fb55..cb06147211 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -417,7 +417,7 @@ void TSAPI SetDialogToType(HWND hwndDlg)
dat->GetAvatarVisibility();
Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->m_bShowAvatar ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_SPLITTER, dat->m_bIsAutosizingInput ? SW_HIDE : SW_SHOW);
+ Utils::showDlgControl(hwndDlg, IDC_SPLITTERY, dat->m_bIsAutosizingInput ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
dat->EnableSendButton(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
@@ -797,7 +797,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
return TRUE;
case WM_LBUTTONDOWN:
- if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
+ if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
if (dat) {
GetClientRect(hwnd, &rc);
dat->m_savedSplitter = rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2;
@@ -852,7 +852,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SendMessage(hwndParent, WM_SIZE, 0, 0);
RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
}
- else if ((dat && dat->m_bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
+ else if ((dat && dat->m_bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) ||
(dat && dat->m_bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
POINT pt;
int selection;
@@ -929,8 +929,8 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
/////////////////////////////////////////////////////////////////////////////////////////
-CSrmmWindow::CSrmmWindow(TNewWindowData *pNewData)
- : CTabBaseDlg(pNewData, IDD_MSGSPLITNEW)
+CSrmmWindow::CSrmmWindow()
+ : CTabBaseDlg(IDD_MSGSPLITNEW)
{
m_pLog = &m_log;
m_pEntry = &m_message;
@@ -968,19 +968,13 @@ CThumbBase* CSrmmWindow::CreateThumb(CProxyWindow *pProxy) const
void CSrmmWindow::OnInitDialog()
{
- m_pContainer = newData->pContainer;
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
if (Utils::rtf_ctable == 0)
Utils::RTF_CTableInit();
- newData->item.lParam = (LPARAM)m_hwnd;
- TabCtrl_SetItem(m_hwndParent, newData->iTabID, &newData->item);
- m_iTabID = newData->iTabID;
-
DM_ThemeChanged();
- m_hContact = newData->hContact;
m_cache = CContactCache::getContactCache(m_hContact);
m_cache->updateNick();
m_cache->setWindowData(m_hwnd, this);
@@ -994,6 +988,15 @@ void CSrmmWindow::OnInitDialog()
m_cache->updateUIN();
+ // show a popup if wanted...
+ if (m_bWantPopup) {
+ DBEVENTINFO dbei = {};
+ m_bWantPopup = false;
+ db_event_get(m_hDbEventFirst, &dbei);
+ tabSRMM_ShowPopup(m_hContact, m_hDbEventFirst, dbei.eventType, 0, 0, m_hwnd, m_cache->getActiveProto());
+ }
+ m_hDbEventFirst = 0;
+
if (m_hContact && m_szProto != NULL) {
m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE);
wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == NULL ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE);
@@ -1060,7 +1063,7 @@ void CSrmmWindow::OnInitDialog()
Utils::showDlgControl(m_hwnd, IDC_MULTISPLITTER, SW_HIDE);
RECT rc;
- GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTER), &rc);
+ GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTERY), &rc);
POINT pt;
pt.y = (rc.top + rc.bottom) / 2;
@@ -1133,7 +1136,7 @@ void CSrmmWindow::OnInitDialog()
// subclassing stuff
mir_subclassWindow(m_message.GetHwnd(), MessageEditSubclassProc);
mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CONTACTPIC), AvatarSubclassProc);
- mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTER), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERY), SplitterSubclassProc);
mir_subclassWindow(GetDlgItem(m_hwnd, IDC_MULTISPLITTER), SplitterSubclassProc);
mir_subclassWindow(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), SplitterSubclassProc);
@@ -1158,15 +1161,13 @@ void CSrmmWindow::OnInitDialog()
UpdateReadChars();
}
}
- if (newData->szInitialText) {
- if (newData->isWchar)
- SetDlgItemTextW(m_hwnd, IDC_MESSAGE, (wchar_t*)newData->szInitialText);
- else
- SetDlgItemTextA(m_hwnd, IDC_MESSAGE, newData->szInitialText);
+ if (wszInitialText) {
+ SetDlgItemTextW(m_hwnd, IDC_MESSAGE, wszInitialText);
int len = GetWindowTextLength(m_message.GetHwnd());
PostMessage(m_message.GetHwnd(), EM_SETSEL, len, len);
if (len)
EnableSendButton(true);
+ mir_free(wszInitialText);
}
for (MEVENT hdbEvent = db_event_last(m_hContact); hdbEvent; hdbEvent = db_event_prev(m_hContact, hdbEvent)) {
@@ -1186,11 +1187,11 @@ void CSrmmWindow::OnInitDialog()
mir_subclassWindowFull(m_log.GetHwnd(), MessageLogSubclassProc, wndClass.lpfnWndProc);
}
- SetWindowPos(m_hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), newData->iActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(m_hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), m_bActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
LoadSplitter();
ShowPicture(true);
- if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED || !newData->iActivate || m_pContainer->dwFlags & CNT_DEFERREDTABSELECT) {
+ if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED || !m_bActivate || m_pContainer->dwFlags & CNT_DEFERREDTABSELECT) {
m_iFlashIcon = PluginConfig.g_IconMsgEvent;
SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
m_bCanFlashTab = true;
@@ -1204,7 +1205,7 @@ void CSrmmWindow::OnInitDialog()
m_dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL;
}
- if (newData->iActivate) {
+ if (m_bActivate) {
m_pContainer->hwndActive = m_hwnd;
ShowWindow(m_hwnd, SW_SHOW);
SetActiveWindow(m_hwnd);
@@ -1228,14 +1229,6 @@ void CSrmmWindow::OnInitDialog()
m_dwFlags &= ~MWF_INITMODE;
TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN, 0);
- // show a popup if wanted...
- if (newData->bWantPopup) {
- DBEVENTINFO dbei = {};
- newData->bWantPopup = FALSE;
- db_event_get(newData->hdbEvent, &dbei);
- tabSRMM_ShowPopup(m_hContact, newData->hdbEvent, dbei.eventType, 0, 0, m_hwnd, m_cache->getActiveProto());
- }
-
if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
m_pContainer->hwndActive = m_hwnd;
@@ -1453,7 +1446,7 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc)
return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
- case IDC_SPLITTER:
+ case IDC_SPLITTERY:
urc->rcItem.right = urc->dlgNewSize.cx;
urc->rcItem.top -= m_splitterY - m_originalSplitterY;
urc->rcItem.bottom = urc->rcItem.top + 2;
@@ -2181,7 +2174,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case DM_CONFIGURETOOLBAR:
m_bShowUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTER), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTER), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
+ SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
if (lParam == 1) {
GetSendFormat();
@@ -2255,7 +2248,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
m_multiSplitterX = oldSplitterX;
SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
- else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTER)) {
+ else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTERY)) {
GetClientRect(m_hwnd, &rc);
rc.top += (m_pPanel.isActive() ? m_pPanel.getHeight() + 40 : 30);
pt.x = 0;
@@ -2643,7 +2636,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
int tabCount = TabCtrl_GetItemCount(m_hwndParent);
ptrA szFromStream(Message_GetFromStream(m_message.GetHwnd(), m_SendFormat ? 0 : SF_TEXT));
- TCITEM tci = { 0 };
+ TCITEM tci = {};
tci.mask = TCIF_PARAM;
for (int i = 0; i < tabCount; i++) {
TabCtrl_GetItem(m_hwndParent, i, &tci);
@@ -3027,7 +3020,7 @@ quote_from_last:
i++;
TabCtrl_SetCurSel(m_hwndParent, i);
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(m_hwndParent, i, &item); // retrieve dialog hwnd for the now active tab...
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 48d7c3894b..1a7c838961 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -79,7 +79,7 @@ void TSAPI RearrangeTab(HWND hwndDlg, const CTabBaseDlg *dat, int iMode, BOOL fS
HWND hwndTab = GetParent(hwndDlg);
wchar_t oldText[512];
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM;
item.pszText = oldText;
item.cchTextMax = _countof(oldText);
@@ -200,7 +200,7 @@ void CTabBaseDlg::FlashTab(bool bInvertMode)
if (bInvertMode)
m_bTabFlash = !m_bTabFlash;
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_IMAGE;
TabCtrl_SetItem(m_hwndParent, m_iTabID, &item);
if (m_pContainer->dwFlags & CNT_SIDEBAR)
@@ -480,7 +480,7 @@ void CTabBaseDlg::UpdateStatusBar() const
void TSAPI HandleIconFeedback(CTabBaseDlg *dat, HICON iIcon)
{
- TCITEM item = { 0 };
+ TCITEM item = {};
if (iIcon == (HICON)-1) { // restore status image
if (dat->m_dwFlags & MWF_ERRORSTATE)
@@ -722,7 +722,7 @@ void CTabBaseDlg::ShowPicture(bool showNewPic)
RECT rc;
GetWindowRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), &rc);
if (m_minEditBoxSize.cy + DPISCALEY_S(3) > m_splitterY)
- SendMessage(m_hwnd, DM_SPLITTERMOVED, (WPARAM)rc.bottom - m_minEditBoxSize.cy, (LPARAM)GetDlgItem(m_hwnd, IDC_SPLITTER));
+ SendMessage(m_hwnd, DM_SPLITTERMOVED, (WPARAM)rc.bottom - m_minEditBoxSize.cy, (LPARAM)GetDlgItem(m_hwnd, IDC_SPLITTERY));
if (!showNewPic)
SetDialogToType(m_hwnd);
else
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index e012ee46d3..c131b19025 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -117,18 +117,14 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// basic window class
-CTabBaseDlg::CTabBaseDlg(TNewWindowData *pData, int iResource)
+CTabBaseDlg::CTabBaseDlg(int iResource)
: CSrmmBaseDialog(g_hInst, iResource),
m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
- newData(pData),
- m_pPanel(this),
-
- m_pContainer(pData->pContainer)
+ m_pPanel(this)
{
m_pLog = &m_log;
m_pEntry = &m_message;
- m_hContact = pData->hContact;
m_autoClose = 0;
m_forceResizable = true;
@@ -449,7 +445,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
if (pContainer)
- CreateNewTabForContact(pContainer, hContact, 0, NULL, TRUE, TRUE, FALSE, 0);
+ CreateNewTabForContact(pContainer, hContact, true, true, false, 0);
}
return 0;
}
@@ -499,7 +495,7 @@ INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
if (pContainer)
- CreateNewTabForContact(pContainer, hContact, isWchar, pszMsg, TRUE, TRUE, FALSE, 0);
+ CreateNewTabForContact(pContainer, hContact, true, true, false, 0, isWchar, pszMsg);
}
return 0;
}
@@ -625,7 +621,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
// bActivateTab: make the new tab the active one
// bPopupContainer: restore container if it was minimized, otherwise flash it...
-HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, int isSend, const char *pszInitialText, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup, MEVENT hdbEvent)
+HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, bool bActivateTab, bool bPopupContainer, bool bWantPopup, MEVENT hdbEvent, bool bIsUnicode, const char *pszInitialText)
{
if (M.FindWindow(hContact) != 0) {
_DebugPopup(hContact, L"Warning: trying to create duplicate window");
@@ -638,16 +634,10 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
if ((pContainer = CreateContainer(L"default", CNT_CREATEFLAG_CLONED, hContact)) == NULL)
return 0;
- TNewWindowData newData = { 0 };
- newData.hContact = hContact;
- newData.isWchar = isSend;
- newData.szInitialText = pszInitialText;
- char *szProto = GetContactProto(newData.hContact);
-
- memset(&newData.item, 0, sizeof(newData.item));
+ char *szProto = GetContactProto(hContact);
// obtain various status information about the contact
- wchar_t *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0);
+ wchar_t *contactName = pcli->pfnGetContactDisplayName(hContact, 0);
// cut nickname if larger than x chars...
wchar_t newcontactname[128], tabtitle[128];
@@ -661,18 +651,13 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
}
else wcsncpy_s(newcontactname, L"_U_", _TRUNCATE);
- wchar_t *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ wchar_t *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
if (M.GetByte("tabstatus", 1))
mir_snwprintf(tabtitle, L"%s (%s) ", newcontactname, szStatus);
else
mir_snwprintf(tabtitle, L"%s ", newcontactname);
- newData.item.pszText = tabtitle;
- newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
- newData.item.iImage = 0;
- newData.item.cchTextMax = _countof(tabtitle);
-
HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
// hide the active tab
if (pContainer->hwndActive && bActivateTab)
@@ -680,10 +665,10 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100);
int iCount = TabCtrl_GetItemCount(hwndTab);
- TCITEM item = { 0 };
pContainer->iTabIndex = iCount;
if (iCount > 0) {
+ TCITEM item = {};
for (int i = iCount - 1; i >= 0; i--) {
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &item);
@@ -697,22 +682,34 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
}
}
- int newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item);
+ TCITEM item = {};
+ item.pszText = tabtitle;
+ item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
+ item.iImage = 0;
+ item.cchTextMax = _countof(tabtitle);
+ int iTabId = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &item);
+
SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0);
if (bActivateTab)
- TabCtrl_SetCurSel(hwndTab, newItem);
- newData.iTabID = newItem;
- newData.iTabImage = newData.item.iImage;
- newData.pContainer = pContainer;
- newData.iActivate = (int)bActivateTab;
- pContainer->iChilds++;
- newData.bWantPopup = bWantPopup;
- newData.hdbEvent = hdbEvent;
+ TabCtrl_SetCurSel(hwndTab, iTabId);
- CSrmmWindow *pWindow = new CSrmmWindow(&newData);
+ CSrmmWindow *pWindow = new CSrmmWindow();
+ pWindow->m_hContact = hContact;
+ pWindow->m_iTabID = iTabId;
+ pWindow->m_pContainer = pContainer;
+ pContainer->iChilds++;
+
+ pWindow->m_bActivate = bActivateTab;
+ pWindow->m_bWantPopup = bWantPopup;
+ pWindow->m_hDbEventFirst = hdbEvent;
+ if (pszInitialText)
+ pWindow->wszInitialText = (bIsUnicode) ? mir_wstrdup((const wchar_t*)pszInitialText) : mir_a2u(pszInitialText);
pWindow->SetParent(hwndTab);
pWindow->Create();
+
HWND hwndNew = pWindow->GetHwnd();
+ item.lParam = (LPARAM)hwndNew;
+ TabCtrl_SetItem(hwndTab, iTabId, &item);
// switchbar support
if (pContainer->dwFlags & CNT_SIDEBAR)
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 737b3fe1a1..8c5c4b24db 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -230,31 +230,11 @@ struct TContainerData
struct SESSION_INFO;
-struct TNewWindowData
-{
- MCONTACT hContact;
- int isWchar;
- LPCSTR szInitialText;
- int iTabID;
- int iTabImage;
- int iActivate;
- TCITEM item;
- BOOL bWantPopup;
- HKL hkl;
-
- union {
- MEVENT hdbEvent;
- SESSION_INFO *si;
- };
- TContainerData *pContainer;
-};
-
class CTabBaseDlg : public CSrmmBaseDialog
{
protected:
CCtrlEdit m_log, m_message;
- TNewWindowData *newData;
void DM_AddDivider();
void DM_DismissTip(const POINT& pt);
@@ -374,7 +354,7 @@ public:
char *m_enteredText;
public:
- CTabBaseDlg(TNewWindowData*, int);
+ CTabBaseDlg(int iDialogId);
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -459,9 +439,11 @@ class CSrmmWindow : public CTabBaseDlg
public:
int msgTop, rcLogBottom;
+ wchar_t *wszInitialText;
+ bool m_bActivate, m_bWantPopup;
public:
- CSrmmWindow(TNewWindowData*);
+ CSrmmWindow();
virtual void OnInitDialog() override;
virtual void OnDestroy() override;
@@ -489,7 +471,7 @@ public:
wchar_t m_wszSearch[255];
public:
- CChatRoomDlg(TNewWindowData*);
+ CChatRoomDlg(SESSION_INFO*);
virtual void OnInitDialog() override;
virtual void OnDestroy() override;
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h
index 5a789f815c..5f725e24e6 100644
--- a/plugins/TabSRMM/src/resource.h
+++ b/plugins/TabSRMM/src/resource.h
@@ -72,12 +72,14 @@
#define IDC_THEMEEXPORT 1002
#define IDC_THEMEEXPORT2 1003
#define IDC_THEMEIMPORT 1003
+#define IDC_SPLITTERX 1004
#define IDC_EXPORT 1005
#define IDC_IMPORT 1006
#define IDC_PREVIEW 1006
#define IDC_LOG 1006
#define IDC_CHKNOTIFY_MESSAGE 1007
#define IDC_FASTGRADIENT 1008
+#define IDC_SPLITTERY 1008
#define IDC_CHKNOTIFY_URL 1009
#define IDC_USESKIN 1011
#define IDC_AUTOCLOSE 1012
@@ -105,7 +107,6 @@
#define IDC_CHKPREVIEW 1034
#define IDC_CHKINFINITE 1035
#define IDC_PANELSTATUS 1036
-#define IDC_SPLITTER 1037
#define IDC_CHKDEFAULTCOL_MESSAGE 1038
#define IDC_CHKDEFAULTCOL_MUC 1039
#define IDC_CHKDEFAULTCOL_ERR 1040
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index fa6f1116e1..81a4949897 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -389,7 +389,7 @@ void SendQueue::showErrorControls(CTabBaseDlg *dat, const int showCmd) const
HWND hwndDlg = dat->GetHwnd();
if (showCmd) {
- TCITEM item = { 0 };
+ TCITEM item = {};
dat->m_hTabIcon = PluginConfig.g_iconErr;
item.mask = TCIF_IMAGE;
item.iImage = 0;
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index 55676f6cdf..e0e3b5ea16 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -495,7 +495,7 @@ void CSideBar::populateAll()
int iItems = (int)TabCtrl_GetItemCount(hwndTab);
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
m_iTopButtons = 0;
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index ec39dfb404..b57e66b3f1 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -615,7 +615,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
InvalidateRect(hwnd, NULL, FALSE);
tabdat->iHoveredTabIndex = hotItem;
- TCITEM tci = { 0 };
+ TCITEM tci = {};
tci.mask = TCIF_PARAM;
tabdat->fAeroTabs = (CSkin::m_fAeroSkinsValid && (isAero || PluginConfig.m_fillColor)) ? TRUE : FALSE;
@@ -1258,7 +1258,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
ti.cbSize = sizeof(ti);
ti.ptCursor = pt;
- TCITEM item = { 0 };
+ TCITEM item = {};
item.mask = TCIF_PARAM;
int nItem = GetTabItemFromMouse(hwnd, &pt);
if (nItem >= 0 && nItem < TabCtrl_GetItemCount(hwnd)) {