diff options
author | George Hazan <ghazan@miranda.im> | 2017-02-28 22:50:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-02-28 22:50:58 +0300 |
commit | 76cbb63e192079281d7c4b51ed8318b245b6b39b (patch) | |
tree | fbc2a8aa23005e9327d3b14d2420b60b6544fd31 /plugins/TabSRMM/src | |
parent | e0b470b5a7e9b11299fdf0567317d59a104c50cf (diff) |
TabSrmm -> UI classes
Diffstat (limited to 'plugins/TabSRMM/src')
47 files changed, 3343 insertions, 3494 deletions
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 8a0825003b..c43e67ece5 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -97,7 +97,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) if (ctl == NULL || hdcPaint == NULL)
return;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA);
if (dat == NULL)
return;
@@ -154,7 +154,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) GetWindowRect(ctl->hwnd, &rcWin);
POINT pt;
pt.x = rcWin.left;
- ScreenToClient(dat->hwnd, &pt);
+ ScreenToClient(dat->GetHwnd(), &pt);
BitBlt(hdcMem, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
}
@@ -420,7 +420,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_MBUTTONUP:
if (bct->sitem)
if (bct->sitem->getDat())
- SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0);
+ SendMessage(bct->sitem->getDat()->GetHwnd(), WM_CLOSE, 1, 0);
break;
case WM_LBUTTONDOWN:
@@ -451,7 +451,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_LBUTTONUP:
if (bct->sitem) {
if (bct->sitem->testCloseButton() != -1) {
- SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0);
+ SendMessage(bct->sitem->getDat()->GetHwnd(), WM_CLOSE, 1, 0);
return TRUE;
}
}
diff --git a/plugins/TabSRMM/src/buttonbar.h b/plugins/TabSRMM/src/buttonbar.h index b29538554e..d0863d6b65 100644 --- a/plugins/TabSRMM/src/buttonbar.h +++ b/plugins/TabSRMM/src/buttonbar.h @@ -1,17 +1,6 @@ #ifndef _BUTTONSBAR_H
#define _BUTTONSBAR_H
-struct TWindowData;
-
void CB_InitCustomButtons();
-void BB_InitDlgButtons(TWindowData *dat);
-void BB_RefreshTheme(const TWindowData *dat);
-BOOL BB_SetButtonsPos(TWindowData *dat);
-void BB_RedrawButtons(TWindowData *dat);
-
-void CB_DestroyAllButtons(HWND hwndDlg);
-void CB_DestroyButton(HWND hwndDlg, TWindowData *dat, DWORD dwButtonCID, DWORD dwFlags);
-void CB_ChangeButton(HWND hwndDlg, TWindowData *dat, CustomButtonData *cbd);
-
#endif
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 0c9c79ba8f..8af676e0e0 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -140,42 +140,36 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) return 0; } -void BB_InitDlgButtons(TWindowData *dat) +void CTabBaseDlg::BB_InitDlgButtons() { - if (dat == 0) - return; - HWND hdlg = dat->hwnd; - if (hdlg == 0) - return; - BYTE gap = DPISCALEX_S(db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1)); RECT rcSplitter; - GetWindowRect(GetDlgItem(hdlg, (dat->bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter); + GetWindowRect(GetDlgItem(m_hwnd, (bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter); POINT ptSplitter = { 0, rcSplitter.top }; - ScreenToClient(hdlg, &ptSplitter); + ScreenToClient(m_hwnd, &ptSplitter); RECT rect; - GetClientRect(hdlg, &rect); + GetClientRect(m_hwnd, &rect); - dat->bbLSideWidth = dat->bbRSideWidth = 0; + bbLSideWidth = bbRSideWidth = 0; - Srmm_CreateToolbarIcons(hdlg, (dat->bType == SESSIONTYPE_IM) ? BBBF_ISIMBUTTON : BBBF_ISCHATBUTTON); + Srmm_CreateToolbarIcons(m_hwnd, (bType == SESSIONTYPE_IM) ? BBBF_ISIMBUTTON : BBBF_ISCHATBUTTON); CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { - HWND hwndButton = GetDlgItem(hdlg, cbd->m_dwButtonCID); + HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (hwndButton == NULL) continue; if (!cbd->m_bHidden) { if (cbd->m_bRSided) - dat->bbRSideWidth += cbd->m_iButtonWidth + gap; + bbRSideWidth += cbd->m_iButtonWidth + gap; else - dat->bbLSideWidth += cbd->m_iButtonWidth + gap; + bbLSideWidth += cbd->m_iButtonWidth + gap; } if (!cbd->m_bHidden && !cbd->m_bCanBeHidden) - dat->iButtonBarReallyNeeds += cbd->m_iButtonWidth + gap; + iButtonBarReallyNeeds += cbd->m_iButtonWidth + gap; if (cbd->m_bSeparator) continue; @@ -186,47 +180,47 @@ void BB_InitDlgButtons(TWindowData *dat) SendMessage(hwndButton, BUTTONSETARROW, (cbd->m_dwButtonCID == IDOK) ? IDC_SENDMENU : cbd->m_dwArrowCID, 0); SendMessage(hwndButton, BUTTONSETASTHEMEDBTN, CSkin::IsThemed(), 0); - SendMessage(hwndButton, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0); + SendMessage(hwndButton, BUTTONSETCONTAINER, (LPARAM)pContainer, 0); SendMessage(hwndButton, BUTTONSETASTOOLBARBUTTON, TRUE, 0); } } -void BB_RedrawButtons(TWindowData *dat) +void CTabBaseDlg::BB_RedrawButtons() { - Srmm_RedrawToolbarIcons(dat->hwnd); + Srmm_RedrawToolbarIcons(m_hwnd); - HWND hwndToggleSideBar = GetDlgItem(dat->hwnd, IDC_TOGGLESIDEBAR); + HWND hwndToggleSideBar = GetDlgItem(m_hwnd, IDC_TOGGLESIDEBAR); if (hwndToggleSideBar && IsWindow(hwndToggleSideBar)) InvalidateRect(hwndToggleSideBar, 0, TRUE); } -void BB_RefreshTheme(const TWindowData *dat) +void CTabBaseDlg::BB_RefreshTheme() { CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) - SendDlgItemMessage(dat->hwnd, cbd->m_dwButtonCID, WM_THEMECHANGED, 0, 0); + SendDlgItemMessage(m_hwnd, cbd->m_dwButtonCID, WM_THEMECHANGED, 0, 0); } -BOOL BB_SetButtonsPos(TWindowData *dat) +BOOL CTabBaseDlg::BB_SetButtonsPos() { - if (!dat || !IsWindowVisible(dat->hwnd)) + if (!m_hwnd || !IsWindowVisible(m_hwnd)) return 0; - HWND hwnd = dat->hwnd; + HWND hwnd = m_hwnd; RECT rect; HWND hwndButton = 0; BYTE gap = DPISCALEX_S(db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1)); - bool showToolbar = !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR); - bool bBottomToolbar = (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; + bool showToolbar = !(pContainer->dwFlags & CNT_HIDETOOLBAR); + bool bBottomToolbar = (pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; HWND hwndToggleSideBar = GetDlgItem(hwnd, IDC_TOGGLESIDEBAR); - ShowWindow(hwndToggleSideBar, (showToolbar && dat->pContainer->SideBar->isActive()) ? SW_SHOW : SW_HIDE); + ShowWindow(hwndToggleSideBar, (showToolbar && pContainer->SideBar->isActive()) ? SW_SHOW : SW_HIDE); HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount() + 1); RECT rcSplitter; - GetWindowRect(GetDlgItem(hwnd, (dat->bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter); + GetWindowRect(GetDlgItem(hwnd, (bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter); POINT ptSplitter = { 0, rcSplitter.top }; ScreenToClient(hwnd, &ptSplitter); @@ -234,15 +228,15 @@ BOOL BB_SetButtonsPos(TWindowData *dat) GetClientRect(hwnd, &rect); int splitterY = (!bBottomToolbar) ? ptSplitter.y - DPISCALEY_S(1) : rect.bottom; - int tempL = dat->bbLSideWidth, tempR = dat->bbRSideWidth; + int tempL = bbLSideWidth, tempR = bbRSideWidth; int lwidth = 0, rwidth = 0; - int iOff = DPISCALEY_S((PluginConfig.m_DPIscaleY > 1.0) ? (dat->bType == SESSIONTYPE_IM ? 22 : 23) : 22); + int iOff = DPISCALEY_S((PluginConfig.m_DPIscaleY > 1.0) ? (bType == SESSIONTYPE_IM ? 22 : 23) : 22); int foravatar = 0; - if ((rect.bottom - ptSplitter.y - (rcSplitter.bottom - rcSplitter.top) /*- DPISCALEY(2)*/ - (bBottomToolbar ? DPISCALEY_S(24) : 0) < dat->pic.cy - DPISCALEY_S(2)) && dat->bShowAvatar && !PluginConfig.m_bAlwaysFullToolbarWidth) - foravatar = dat->pic.cx + gap; + if ((rect.bottom - ptSplitter.y - (rcSplitter.bottom - rcSplitter.top) /*- DPISCALEY(2)*/ - (bBottomToolbar ? DPISCALEY_S(24) : 0) < pic.cy - DPISCALEY_S(2)) && bShowAvatar && !PluginConfig.m_bAlwaysFullToolbarWidth) + foravatar = pic.cx + gap; - if ((dat->pContainer->dwFlags & CNT_SIDEBAR) && (dat->pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT)) { + if ((pContainer->dwFlags & CNT_SIDEBAR) && (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT)) { if (NULL != hwndToggleSideBar) /* Wine fix. */ hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, NULL, 4, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); lwidth += 10; @@ -254,7 +248,7 @@ BOOL BB_SetButtonsPos(TWindowData *dat) if (cbd->m_bRSided) // filter only left buttons continue; - if (((dat->bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((dat->bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { + if (((bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { hwndButton = GetDlgItem(hwnd, cbd->m_dwButtonCID); if (!showToolbar) { @@ -293,7 +287,7 @@ BOOL BB_SetButtonsPos(TWindowData *dat) } } - if ((dat->pContainer->dwFlags & CNT_SIDEBAR) && (dat->pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT)) { + if ((pContainer->dwFlags & CNT_SIDEBAR) && (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT)) { if (NULL != hwndToggleSideBar) /* Wine fix. */ hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, NULL, rect.right - foravatar - 10, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); rwidth += 12; @@ -304,7 +298,7 @@ BOOL BB_SetButtonsPos(TWindowData *dat) if (!cbd->m_bRSided) // filter only right buttons continue; - if (((dat->bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((dat->bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { + if (((bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { hwndButton = GetDlgItem(hwnd, cbd->m_dwButtonCID); if (!showToolbar) { @@ -346,36 +340,36 @@ BOOL BB_SetButtonsPos(TWindowData *dat) return EndDeferWindowPos(hdwp); } -void CB_DestroyAllButtons(HWND hwndDlg) +void CTabBaseDlg::CB_DestroyAllButtons() { CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { - HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (hwndButton) DestroyWindow(hwndButton); } } -void CB_DestroyButton(HWND hwndDlg, TWindowData *dat, DWORD dwButtonCID, DWORD dwFlags) +void CTabBaseDlg::CB_DestroyButton(DWORD dwButtonCID, DWORD dwFlags) { - HWND hwndButton = GetDlgItem(hwndDlg, dwButtonCID); + HWND hwndButton = GetDlgItem(m_hwnd, dwButtonCID); if (hwndButton == NULL) return; RECT rc = { 0 }; GetClientRect(hwndButton, &rc); if (dwFlags & BBBF_ISRSIDEBUTTON) - dat->bbRSideWidth -= rc.right; + bbRSideWidth -= rc.right; else - dat->bbLSideWidth -= rc.right; + bbLSideWidth -= rc.right; DestroyWindow(hwndButton); - BB_SetButtonsPos(dat); + BB_SetButtonsPos(); } -void CB_ChangeButton(HWND hwndDlg, TWindowData *dat, CustomButtonData *cbd) +void CTabBaseDlg::CB_ChangeButton(CustomButtonData *cbd) { - HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (hwndButton == NULL) return; @@ -383,7 +377,7 @@ void CB_ChangeButton(HWND hwndDlg, TWindowData *dat, CustomButtonData *cbd) SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); if (cbd->m_pwszTooltip) SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)cbd->m_pwszTooltip, BATF_UNICODE); - SendMessage(hwndButton, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0); + SendMessage(hwndButton, BUTTONSETCONTAINER, (LPARAM)pContainer, 0); SetWindowTextA(hwndButton, cbd->m_pszModuleName); } diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index f4ef815a72..e38ee9c643 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -46,7 +46,7 @@ typedef struct { class CMUCHighlight;
-//structs
+// structs
struct MODULEINFO : public GCModuleInfoBase
{
@@ -57,7 +57,7 @@ struct MODULEINFO : public GCModuleInfoBase struct SESSION_INFO : public GCSessionInfoBase
{
- TWindowData *dat;
+ CChatRoomDlg *dat;
TContainerData *pContainer;
int iLogTrayFlags, iLogPopupFlags, iDiskLogFlags;
@@ -67,8 +67,8 @@ struct SESSION_INFO : public GCSessionInfoBase struct LOGSTREAMDATA : public GCLogStreamDataBase
{
- int crCount;
- TWindowData *dat;
+ int crCount;
+ CChatRoomDlg *dat;
};
struct TMUCSettings : public GlobalLogSettingsBase
@@ -111,11 +111,9 @@ extern CHAT_MANAGER saveCI; //////////////////////////////////////////////////////////////////////////////////
// log.c
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw);
-char* Log_CreateRtfHeader(MODULEINFO *mi);
+char* Log_CreateRtfHeader(MODULEINFO *mi);
// window.c
-INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
int GetTextPixelSize(wchar_t* pszText, HFONT hFont, bool bWidth);
// options.c
diff --git a/plugins/TabSRMM/src/chat/chat_resource.h b/plugins/TabSRMM/src/chat/chat_resource.h index 07916d6f51..79207f3db8 100644 --- a/plugins/TabSRMM/src/chat/chat_resource.h +++ b/plugins/TabSRMM/src/chat/chat_resource.h @@ -11,11 +11,8 @@ #define IDD_OPTIONS3 407
#define IDD_OPTIONS4 408
#define IDD_ADDHIGHLIGHT 409
-#define IDC_CHAT_LOG 1005
-#define IDC_SPLITTERX 1006
#define IDC_SMILEY 1007
#define IDC_SPLITTERY 1008
-#define IDC_CHAT_MESSAGE 1009
#define IDC_FILTER 1013
#define IDC_CHANMGR 1014
#define IDC_SHOWNICKLIST 1015
@@ -39,6 +36,7 @@ #define IDC_LIMIT 1050
#define IDC_LOGTIMESTAMP 1051
#define IDC_GROUP 1057
+#define IDC_SPLITTERX 1058
#define IDC_CHAT_RADIO1 1061
#define IDC_RADIO2 1062
#define IDC_RADIO3 1063
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 8ecb13e423..ace05686ba 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -260,7 +260,7 @@ static void LogEventIEView(LOGSTREAMDATA *streamData, wchar_t *ptszNick) event.cbSize = sizeof(event);
event.dwFlags = 0;
event.hwnd = streamData->dat->hwndIEView ? streamData->dat->hwndIEView : streamData->dat->hwndHPP;
- event.hContact = streamData->dat->hContact;
+ event.hContact = streamData->dat->m_hContact;
event.codepage = streamData->dat->codePage;
event.pszProto = streamData->si->pszModule;
event.iType = IEE_LOG_MEM_EVENTS;
@@ -857,16 +857,15 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG return 0;
}
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
+void CChatRoomDlg::StreamInEvents(LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
{
CHARRANGE oldsel, sel, newsel;
POINT point = { 0 };
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (hwndDlg == 0 || lin == 0 || si == 0 || dat == 0)
+ if (m_hwnd == 0 || lin == 0 || si == 0)
return;
- HWND hwndRich = GetDlgItem(hwndDlg, IDC_CHAT_LOG);
+ HWND hwndRich = GetDlgItem(m_hwnd, IDC_LOG);
LOGSTREAMDATA streamData;
memset(&streamData, 0, sizeof(streamData));
@@ -874,7 +873,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedra streamData.si = si;
streamData.lin = lin;
streamData.bStripFormat = FALSE;
- streamData.dat = dat;
+ streamData.dat = this;
if (!bRedraw && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && si->bFilterEnabled && (si->iLogFilterFlags & lin->iType) == 0)
return;
@@ -888,7 +887,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedra SCROLLINFO scroll = { 0 };
scroll.cbSize = sizeof(SCROLLINFO);
scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &scroll);
+ GetScrollInfo(GetDlgItem(m_hwnd, IDC_LOG), SB_VERT, &scroll);
SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point);
// do not scroll to bottom if there is a selection
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 072337c2cc..f34f5d18ad 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -64,7 +64,7 @@ static void OnNewUser(SESSION_INFO *si, USERINFO*) if (si->hWnd) {
SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
if (si->dat)
- GetMyNick(si->dat);
+ si->dat->GetMyNick();
}
}
@@ -72,7 +72,7 @@ static void OnChangeNick(SESSION_INFO *si) {
if (si->hWnd) {
if (si->dat)
- GetMyNick(si->dat);
+ si->dat->GetMyNick();
SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
}
}
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 0ddb66652c..c5735a6a8d 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -45,8 +45,6 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT TNewWindowData newData = { 0 };
newData.hContact = hContact;
- newData.isWchar = 0;
- newData.szInitialText = NULL;
memset(&newData.item, 0, sizeof(newData.item));
wchar_t *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0);
@@ -65,7 +63,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
newData.item.iImage = 0;
- HWND hwndTab = GetDlgItem(pContainer->hwnd, 1159);
+ HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
// hide the active tab
if (pContainer->hwndActive && bActivateTab)
@@ -81,9 +79,9 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &item);
HWND hwnd = (HWND)item.lParam;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat) {
- int relPos = M.GetDword(dat->hContact, "tabindex", i * 100);
+ int relPos = M.GetDword(dat->m_hContact, "tabindex", i * 100);
if (iTabIndex_wanted <= relPos)
pContainer->iTabIndex = i;
}
@@ -101,9 +99,14 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT pContainer->iChilds++;
newData.bWantPopup = bWantPopup;
newData.si = si;
- HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), GetDlgItem(pContainer->hwnd, 1159), RoomWndProc, (LPARAM)&newData);
+
+ CChatRoomDlg *pDlg = new CChatRoomDlg(&newData);
+ pDlg->SetParent(GetDlgItem(pContainer->hwnd, IDC_MSGTABS));
+ pDlg->Show();
+
+ HWND hwndNew = pDlg->GetHwnd();
if (pContainer->dwFlags & CNT_SIDEBAR) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndNew, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndNew, GWLP_USERDATA);
if (dat)
pContainer->SideBar->addSession(dat, pContainer->iTabIndex);
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 9be9b80567..566d506377 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -141,7 +141,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) if (si == NULL || !(iEvent & si->iLogPopupFlags))
return true;
- TWindowData *dat = si->dat;
+ CTabBaseDlg *dat = si->dat;
TContainerData *pContainer = dat ? dat->pContainer : NULL;
wchar_t *bbStart, *bbEnd;
@@ -215,7 +215,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS* p) if (si == 0)
return;
- TWindowData *dat = 0;
+ CTabBaseDlg *dat = 0;
if (si->hWnd) {
dat = si->dat;
if (dat) {
@@ -240,7 +240,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS* p) if (dat->iFlashIcon != pci->hIcons[ICON_HIGHLIGHT] && dat->iFlashIcon != pci->hIcons[ICON_MESSAGE])
dat->iFlashIcon = p->hNotifyIcon;
}
- dat->mayFlashTab = TRUE;
+ dat->m_bCanFlashTab = TRUE;
SetTimer(si->hWnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
}
}
@@ -257,7 +257,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS* p) TabCtrl_SetCurSel(hwndTab, iItem);
ShowWindow(dat->pContainer->hwndActive, SW_HIDE);
dat->pContainer->hwndActive = si->hWnd;
- SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
+ SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->m_hContact, 0);
dat->pContainer->dwFlags |= CNT_DEFERREDTABSELECT;
}
}
@@ -299,7 +299,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (gce == 0 || si == 0 || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
- TWindowData *dat = NULL;
+ CTabBaseDlg *dat = NULL;
FLASH_PARAMS *params = (FLASH_PARAMS*)mir_calloc(sizeof(FLASH_PARAMS));
params->hContact = si->hContact;
params->bInactive = TRUE;
@@ -328,7 +328,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (dat && g_Settings.bAnnoyingHighlight && params->bInactive && dat->pContainer->hwnd != GetForegroundWindow()) {
wParamForHighLight = 2;
- params->hWnd = dat->hwnd;
+ params->hWnd = dat->GetHwnd();
}
if (dat || !nen_options.iMUCDisable)
@@ -518,7 +518,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO gcmi.pszUID = pszUID;
if (iIndex == 1) {
- int i = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG));
+ int i = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
EnableMenuItem(*hMenu, ID_CLEARLOG, MF_ENABLED);
EnableMenuItem(*hMenu, ID_COPYALL, MF_ENABLED);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 3d932bcf5d..c0873157fa 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -118,14 +118,14 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT *ptClient, UINT uMsg, WPARAM wPa if (bIsCustomLink) { ENLINK enlink = { 0 }; enlink.nmhdr.hwndFrom = hwndDlg; - enlink.nmhdr.idFrom = IDC_CHAT_LOG; + enlink.nmhdr.idFrom = IDC_LOG; enlink.nmhdr.code = EN_LINK; enlink.msg = uMsg; enlink.wParam = wParam; enlink.lParam = lParam; enlink.chrg.cpMin = cpMin; enlink.chrg.cpMax = cpMax; - SendMessage(GetParent(hwndDlg), WM_NOTIFY, IDC_CHAT_LOG, (LPARAM)&enlink); + SendMessage(GetParent(hwndDlg), WM_NOTIFY, IDC_LOG, (LPARAM)&enlink); } return bIsCustomLink; } @@ -148,22 +148,18 @@ bool IsStringValidLink(wchar_t *pszText) // called whenever a group chat tab becomes active(either by switching tabs or activating a // container window -static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) +void CChatRoomDlg::UpdateWindowState(UINT msg) { - if (dat == NULL) - return; - - SESSION_INFO *si = dat->si; if (si == NULL) return; - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = GetHwnd(); HWND hwndTab = GetParent(hwndDlg); if (msg == WM_ACTIVATE) { - if (dat->pContainer->dwFlags & CNT_TRANSPARENCY) { - DWORD trans = LOWORD(dat->pContainer->settings->dwTransparency); - SetLayeredWindowAttributes(dat->pContainer->hwnd, CSkin::m_ContainerColorKey, (BYTE)trans, (dat->pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); + if (pContainer->dwFlags & CNT_TRANSPARENCY) { + DWORD trans = LOWORD(pContainer->settings->dwTransparency); + SetLayeredWindowAttributes(pContainer->hwnd, CSkin::m_ContainerColorKey, (BYTE)trans, (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); } } @@ -179,78 +175,78 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) } } - if (dat->bIsAutosizingInput && dat->iInputAreaHeight == -1) { - dat->iInputAreaHeight = 0; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REQUESTRESIZE, 0, 0); + if (bIsAutosizingInput && iInputAreaHeight == -1) { + iInputAreaHeight = 0; + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0); } - dat->Panel->dismissConfig(); - dat->dwUnread = 0; - if (dat->pWnd) { - dat->pWnd->activateTab(); - dat->pWnd->setOverlayIcon(0, true); + Panel->dismissConfig(); + dwUnread = 0; + if (pWnd) { + pWnd->activateTab(); + pWnd->setOverlayIcon(0, true); } - if (dat->pContainer->hwndSaved == hwndDlg || dat->bWasDeleted) + if (pContainer->hwndSaved == hwndDlg || m_bWasDeleted) return; - dat->pContainer->hwndSaved = hwndDlg; + pContainer->hwndSaved = hwndDlg; pci->SetActiveSession(si->ptszID, si->pszModule); - dat->hTabIcon = dat->hTabStatusIcon; + hTabIcon = hTabStatusIcon; - if (dat->iTabID >= 0) { + if (iTabID >= 0) { if (db_get_w(si->hContact, si->pszModule, "ApparentMode", 0) != 0) db_set_w(si->hContact, si->pszModule, "ApparentMode", 0); if (pcli->pfnGetEvent(si->hContact, 0)) pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1); - dat->dwTickLastEvent = 0; - dat->dwFlags &= ~MWF_DIVIDERSET; - if (KillTimer(hwndDlg, TIMERID_FLASHWND) || dat->iFlashIcon) { - FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, FALSE, dat->hTabIcon); - dat->mayFlashTab = FALSE; - dat->iFlashIcon = 0; + dwTickLastEvent = 0; + dwFlags &= ~MWF_DIVIDERSET; + if (KillTimer(hwndDlg, TIMERID_FLASHWND) || iFlashIcon) { + FlashTab(false); + m_bCanFlashTab = FALSE; + iFlashIcon = 0; } - if (dat->pContainer->dwFlashingStarted != 0) { - FlashContainer(dat->pContainer, 0, 0); - dat->pContainer->dwFlashingStarted = 0; + if (pContainer->dwFlashingStarted != 0) { + FlashContainer(pContainer, 0, 0); + pContainer->dwFlashingStarted = 0; } - dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE; + pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE; - if (dat->dwFlags & MWF_NEEDCHECKSIZE) + if (dwFlags & MWF_NEEDCHECKSIZE) PostMessage(hwndDlg, DM_SAVESIZE, 0, 0); if (PluginConfig.m_bAutoLocaleSupport) { - if (dat->hkl == 0) - DM_LoadLocale(dat); + if (hkl == 0) + DM_LoadLocale(this); else SendMessage(hwndDlg, DM_SETLOCALE, 0, 0); } - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); - dat->dwLastActivity = GetTickCount(); - dat->pContainer->dwLastActivity = dat->dwLastActivity; - dat->pContainer->MenuBar->configureMenu(); - UpdateTrayMenuState(dat, FALSE); - DM_SetDBButtonStates(hwndDlg, dat); - - if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) { - dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER; - ShowWindow(dat->pContainer->hwnd, SW_RESTORE); - PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, dat->wParam, dat->lParam); + SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE)); + dwLastActivity = GetTickCount(); + pContainer->dwLastActivity = dwLastActivity; + pContainer->MenuBar->configureMenu(); + UpdateTrayMenuState(this, FALSE); + DM_SetDBButtonStates(); + + if (dwFlagsEx & MWF_EX_DELAYEDSPLITTER) { + dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER; + ShowWindow(pContainer->hwnd, SW_RESTORE); + PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, wParam, lParam); PostMessage(hwndDlg, WM_SIZE, 0, 0); - dat->wParam = dat->lParam = 0; + wParam = lParam = 0; } } - BB_SetButtonsPos(dat); + BB_SetButtonsPos(); if (M.isAero()) InvalidateRect(hwndTab, NULL, FALSE); - if (dat->pContainer->dwFlags & CNT_SIDEBAR) - dat->pContainer->SideBar->setActiveItem(dat); + if (pContainer->dwFlags & CNT_SIDEBAR) + pContainer->SideBar->setActiveItem(this); - if (dat->pWnd) - dat->pWnd->Invalidate(); + if (pWnd) + pWnd->Invalidate(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -270,73 +266,45 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO *si) } } -static void Chat_ResizeIeView(const TWindowData *dat) -{ - int iMode = dat->hwndIEView ? 1 : 2; - HWND hwndDlg = dat->hwnd; - - RECT rcRichEdit; - GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcRichEdit); - - POINT pt = { rcRichEdit.left, rcRichEdit.top }; - ScreenToClient(hwndDlg, &pt); - - IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; - ieWindow.iType = IEW_SETPOS; - ieWindow.parent = hwndDlg; - ieWindow.hwnd = iMode == 1 ? dat->hwndIEView : dat->hwndHPP; - ieWindow.x = pt.x; - ieWindow.y = pt.y; - ieWindow.cx = rcRichEdit.right - rcRichEdit.left; - ieWindow.cy = rcRichEdit.bottom - rcRichEdit.top; - if (ieWindow.cx != 0 && ieWindow.cy != 0) - CallService(iMode == 1 ? MS_IEVIEW_WINDOW : MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); -} - ///////////////////////////////////////////////////////////////////////////////////////// // resizer callback for the group chat session window.Called from Mirandas dialog // resizing service -static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) +int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) { - RECT rc, rcTabs; - SESSION_INFO *si = (SESSION_INFO*)lParam; - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - bool bToolbar = !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR); - bool bBottomToolbar = dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0; + bool bToolbar = !(pContainer->dwFlags & CNT_HIDETOOLBAR); + bool bBottomToolbar = pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0; bool bNick = si->iType != GCW_SERVER && si->bNicklistEnabled; - bool bInfoPanel = dat->Panel->isActive(); - int panelHeight = dat->Panel->getHeight() + 1; - - rc.bottom = rc.top = rc.left = rc.right = 0; + bool bInfoPanel = Panel->isActive(); + int panelHeight = Panel->getHeight() + 1; - GetClientRect(hwndDlg, &rcTabs); + RECT rcTabs; + GetClientRect(m_hwnd, &rcTabs); - if (dat->bIsAutosizingInput) - Utils::showDlgControl(hwndDlg, IDC_SPLITTERY, SW_HIDE); + if (bIsAutosizingInput) + Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, SW_HIDE); if (si->iType != GCW_SERVER) { - Utils::showDlgControl(hwndDlg, IDC_LIST, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); - Utils::showDlgControl(hwndDlg, IDC_SPLITTERX, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_LIST, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); - Utils::enableDlgControl(hwndDlg, IDC_SHOWNICKLIST, true); - Utils::enableDlgControl(hwndDlg, IDC_FILTER, true); + Utils::enableDlgControl(m_hwnd, IDC_SHOWNICKLIST, true); + Utils::enableDlgControl(m_hwnd, IDC_FILTER, true); if (si->iType == GCW_CHATROOM) { MODULEINFO* tmp = pci->MM_FindModule(si->pszModule); if (tmp) - Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, tmp->bChanMgr); + Utils::enableDlgControl(m_hwnd, IDC_CHANMGR, tmp->bChanMgr); } } else { - Utils::showDlgControl(hwndDlg, IDC_LIST, SW_HIDE); - Utils::showDlgControl(hwndDlg, IDC_SPLITTERX, SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_LIST, SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, SW_HIDE); } if (si->iType == GCW_SERVER) { - Utils::enableDlgControl(hwndDlg, IDC_SHOWNICKLIST, false); - Utils::enableDlgControl(hwndDlg, IDC_FILTER, false); - Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, false); + Utils::enableDlgControl(m_hwnd, IDC_SHOWNICKLIST, false); + Utils::enableDlgControl(m_hwnd, IDC_FILTER, false); + Utils::enableDlgControl(m_hwnd, IDC_CHANMGR, false); } switch (urc->wId) { @@ -345,7 +313,7 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) urc->rcItem.top = panelHeight - 2; return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP; - case IDC_CHAT_LOG: + case IDC_LOG: urc->rcItem.top = 0; urc->rcItem.left = 0; urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx; @@ -399,12 +367,12 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) urc->rcItem.top++; return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - case IDC_CHAT_MESSAGE: + case IDC_MESSAGE: urc->rcItem.right = urc->dlgNewSize.cx; urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3; urc->rcItem.bottom = urc->dlgNewSize.cy; // - 1 ; - if (dat->bIsAutosizingInput) + if (bIsAutosizingInput) urc->rcItem.top -= DPISCALEY_S(1); if (bBottomToolbar && bToolbar) @@ -517,18 +485,17 @@ LBL_SkipEnd: static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndParent = GetParent(hwnd); - TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); - + CTabBaseDlg *mwdat = (CTabBaseDlg*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) { - GetKeyboardState(mwdat->kstate); - if (!(mwdat->kstate[VK_CONTROL] & 0x80) && !(mwdat->kstate[VK_SHIFT] & 0x80)) - mwdat->fkeyProcessed = false; - return 0; - } + if (mwdat != nullptr) + if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) { + GetKeyboardState(mwdat->kstate); + if (!(mwdat->kstate[VK_CONTROL] & 0x80) && !(mwdat->kstate[VK_SHIFT] & 0x80)) + mwdat->fkeyProcessed = false; + return 0; + } - SESSION_INFO *si = (SESSION_INFO*)mwdat->si; switch (msg) { case WM_NCCALCSIZE: return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageSubclassProc); @@ -551,7 +518,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, RemoveMenu(hSubMenu, 8, MF_BYPOSITION); RemoveMenu(hSubMenu, 4, MF_BYPOSITION); - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | ((mi && mi->bBold) ? MF_ENABLED : MF_GRAYED)); TranslateMenu(hSubMenu); @@ -565,7 +532,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, MessageWindowPopupData mwpd = { sizeof(mwpd) }; mwpd.uType = MSG_WINDOWPOPUP_SHOWING; mwpd.uFlags = MSG_WINDOWPOPUP_INPUT; - mwpd.hContact = mwdat->hContact; + mwpd.hContact = mwdat->m_hContact; mwpd.hwnd = hwnd; mwpd.hMenu = hSubMenu; mwpd.pt = pt; @@ -610,14 +577,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_SYSKEYUP: if (wParam == VK_MENU) { - ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_MESSAGE); + ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE); return 0; } break; case WM_SYSKEYDOWN: mwdat->fkeyProcessed = false; - if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_MESSAGE)) { + if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE)) { mwdat->fkeyProcessed = true; return 0; } @@ -638,14 +605,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; case WM_CHAR: - BOOL isShift, isAlt, isCtrl; - KbdState(mwdat, isShift, isCtrl, isAlt); + bool isShift, isAlt, isCtrl; + mwdat->KbdState(isShift, isCtrl, isAlt); if (PluginConfig.m_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND) && wParam != VK_ESCAPE&&!(wParam == VK_TAB&&PluginConfig.m_bAllowTab)) SkinPlaySound("SoundOnTyping"); if (isCtrl && !isAlt && !isShift) { - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); if (mi == NULL) return 0; @@ -702,7 +669,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; case WM_KEYDOWN: - KbdState(mwdat, isShift, isCtrl, isAlt); + mwdat->KbdState(isShift, isCtrl, isAlt); // sound on typing.. if (PluginConfig.m_bSoundOnTyping && !isAlt && wParam == VK_DELETE) @@ -740,7 +707,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, else if (wParam == VK_DOWN) wp = MAKEWPARAM(SB_LINEDOWN, 0); - SendDlgItemMessage(hwndParent, IDC_CHAT_LOG, WM_VSCROLL, wp, 0); + SendDlgItemMessage(hwndParent, IDC_LOG, WM_VSCROLL, wp, 0); return 0; } } @@ -789,14 +756,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); - bool fCompleted = TabAutoComplete(hwnd, dat, si); + bool fCompleted = TabAutoComplete(hwnd, dat, mwdat->si); SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE); if (!fCompleted && !PluginConfig.m_bAllowTab) { - if ((GetSendButtonState(mwdat->hwnd) != PBS_DISABLED)) - SetFocus(GetDlgItem(mwdat->hwnd, IDOK)); + if ((GetSendButtonState(mwdat->GetHwnd()) != PBS_DISABLED)) + SetFocus(GetDlgItem(mwdat->GetHwnd(), IDOK)); else - SetFocus(GetDlgItem(mwdat->hwnd, IDC_CHAT_LOG)); + SetFocus(GetDlgItem(mwdat->GetHwnd(), IDC_LOG)); } return 0; } @@ -814,15 +781,15 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (wParam == VK_NEXT || wParam == VK_PRIOR) { HWND htemp = hwndParent; - SendDlgItemMessage(htemp, IDC_CHAT_LOG, msg, wParam, lParam); + SendDlgItemMessage(htemp, IDC_LOG, msg, wParam, lParam); dat->lastEnterTime = 0; return 0; } if (wParam == VK_UP && isCtrl && !isAlt) { - char *lpPrevCmd = pci->SM_GetPrevCommand(si->ptszID, si->pszModule); + char *lpPrevCmd = pci->SM_GetPrevCommand(mwdat->si->ptszID, mwdat->si->pszModule); - if (!si->lpCurrentCommand || !si->lpCurrentCommand->last) { + if (!mwdat->si->lpCurrentCommand || !mwdat->si->lpCurrentCommand->last) { // Next command is not defined. It means currently entered text is not saved in the history and it // need to be saved in the window context. char *enteredText = Message_GetFromStream(hwndParent); @@ -864,7 +831,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, ste.flags = ST_DEFAULT; ste.codepage = CP_ACP; - char *lpPrevCmd = pci->SM_GetNextCommand(si->ptszID, si->pszModule); + char *lpPrevCmd = pci->SM_GetNextCommand(mwdat->si->ptszID, mwdat->si->pszModule); if (lpPrevCmd) SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd); else if (mwdat->enteredText) { @@ -906,17 +873,17 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, cf.dwEffects = 0; SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); { - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); if (mi == NULL) break; if (mi->bColor) { - int index = Chat_GetColorIndex(si->pszModule, cf.crTextColor); + int index = Chat_GetColorIndex(mwdat->si->pszModule, cf.crTextColor); UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR); if (index >= 0) { - si->bFGSet = TRUE; - si->iFG = index; + mwdat->si->bFGSet = TRUE; + mwdat->si->iFG = index; } if (u == BST_UNCHECKED && cf.crTextColor != cr) @@ -926,13 +893,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (mi->bBkgColor) { - int index = Chat_GetColorIndex(si->pszModule, cf.crBackColor); + int index = Chat_GetColorIndex(mwdat->si->pszModule, cf.crBackColor); COLORREF crB = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR); UINT u = IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR); if (index >= 0) { - si->bBGSet = TRUE; - si->iBG = index; + mwdat->si->bBGSet = TRUE; + mwdat->si->iBG = index; } if (u == BST_UNCHECKED && cf.crBackColor != crB) @@ -1158,7 +1125,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndParent = GetParent(hwnd); - TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); + CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); switch (msg) { case WM_NCCALCSIZE: @@ -1202,7 +1169,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR SendMessage(hwnd, WM_COPY, 0, 0); sel.cpMin = sel.cpMax; SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); - SetFocus(GetDlgItem(hwndParent, IDC_CHAT_MESSAGE)); + SetFocus(GetDlgItem(hwndParent, IDC_MESSAGE)); } } break; @@ -1218,14 +1185,14 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_SYSKEYUP: if (wParam == VK_MENU) { - ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_LOG); + ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG); return 0; } break; case WM_SYSKEYDOWN: mwdat->fkeyProcessed = false; - if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_LOG)) { + if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG)) { mwdat->fkeyProcessed = true; return 0; } @@ -1250,13 +1217,13 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case WM_CHAR: - BOOL isCtrl, isShift, isAlt; - KbdState(mwdat, isShift, isCtrl, isAlt); + bool isCtrl, isShift, isAlt; + mwdat->KbdState(isShift, isCtrl, isAlt); if (wParam == 0x03 && isCtrl) // Ctrl+C return DM_WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); - SetFocus(GetDlgItem(hwndParent, IDC_CHAT_MESSAGE)); - SendDlgItemMessage(hwndParent, IDC_CHAT_MESSAGE, WM_CHAR, wParam, lParam); + SetFocus(GetDlgItem(hwndParent, IDC_MESSAGE)); + SendDlgItemMessage(hwndParent, IDC_MESSAGE, WM_CHAR, wParam, lParam); break; } @@ -1269,7 +1236,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndParent = GetParent(hwnd); - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); + CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); switch (msg) { case WM_NCCALCSIZE: @@ -1569,175 +1536,239 @@ 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. -INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +CChatRoomDlg::CChatRoomDlg(TNewWindowData *pData) + : CTabBaseDlg(pData, IDD_CHANNEL) { - SESSION_INFO *si = NULL; - HWND hwndTab = GetParent(hwndDlg); - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (dat) - si = dat->si; + bType = SESSIONTYPE_CHAT; + Panel = new CInfoPanel(this); +} - if (dat == NULL && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) - return 0; +void CChatRoomDlg::OnInitDialog() +{ + SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); + + si = newData->si; + m_hContact = si->hContact; + szProto = GetContactProto(si->hContact); + + cache = CContactCache::getContactCache(m_hContact); + cache->updateNick(); + cache->updateUIN(); + newData->item.lParam = (LPARAM)m_hwnd; + TabCtrl_SetItem(m_hwndParent, newData->iTabID, &newData->item); + iTabID = newData->iTabID; + pContainer = newData->pContainer; + si->pContainer = newData->pContainer; + si->hWnd = m_hwnd; + si->dat = this; + bIsAutosizingInput = IsAutoSplitEnabled(); + fLimitedUpdate = false; + iInputAreaHeight = -1; + if (!pContainer->settings->fPrivate) + si->iSplitterY = g_Settings.iSplitterY; + else { + if (M.GetByte(CHAT_MODULE, "SyncSplitter", 0)) + si->iSplitterY = pContainer->settings->splitterPos - DPISCALEY_S(23); + else + si->iSplitterY = g_Settings.iSplitterY; + } + + if (bIsAutosizingInput) + si->iSplitterY = GetDefaultMinimumInputHeight(); + + CProxyWindow::add(this); + + // Typing support for GCW_PRIVMESS sessions + if (si->iType == GCW_PRIVMESS) { + nTypeMode = PROTOTYPE_SELFTYPING_OFF; + SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL); + } + + Panel->getVisibility(); + Panel->Configure(); + M.AddWindow(m_hwnd, m_hContact); + BroadCastContainer(pContainer, DM_REFRESHTABINDEX, 0, 0); + + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_AUTOURLDETECT, 1, 0); + SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc); + TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING, 0); + + int mask = (int)SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETEVENTMASK, 0, 0); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_LIMITTEXT, 0x7FFFFFFF, 0); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); + Panel->loadHeight(); + + if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && szProto != NULL) + UpdateTrayMenu(0, wStatus, szProto, szStatus, m_hContact, FALSE); + + DM_ThemeChanged(); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_HIDESELECTION, TRUE, 0); + + GetMYUIN(); + GetMyNick(); + + HWND hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL); + CustomizeButton(hwndBtn); + SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, 1, 0); + SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)pContainer, 0); + SendMessage(hwndBtn, BUTTONSETASFLATBTN, FALSE, 0); + SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0); + SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), BATF_UNICODE); + + DM_InitTip(); + BB_InitDlgButtons(); + SendMessage(m_hwnd, WM_CBD_LOADICONS, 0, 0); + + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), SplitterSubclassProc); + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERY), SplitterSubclassProc); + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_LIST), NicklistSubclassProc); + mir_subclassWindow(m_log.GetHwnd(), LogSubclassProc); + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_FILTER), ButtonSubclassProc); + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_COLOR), ButtonSubclassProc); + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_BKGCOLOR), ButtonSubclassProc); + + mir_subclassWindow(GetDlgItem(m_hwnd, IDC_MESSAGE), MessageSubclassProc); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SUBCLASSED, 0, 0); + + SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0); + SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); + SendMessage(m_hwnd, GC_UPDATETITLE, 0, 1); - CHARFORMAT2 cf; - POINT pt, tmp, cur; RECT rc; + SendMessage(pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); + SetWindowPos(m_hwnd, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), 0); + ShowWindow(m_hwnd, SW_SHOW); + PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0); + pContainer->hwndActive = m_hwnd; + TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN, 0); +} - switch (uMsg) { - case WM_INITDIALOG: - dat = (TWindowData*)mir_calloc(sizeof(TWindowData)); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - { - TNewWindowData *newData = (TNewWindowData*)lParam; - dat->si = si = newData->si; - dat->hContact = si->hContact; - dat->szProto = GetContactProto(si->hContact); - dat->bType = SESSIONTYPE_CHAT; - dat->Panel = new CInfoPanel(dat); - - dat->cache = CContactCache::getContactCache(dat->hContact); - dat->cache->updateNick(); - dat->cache->updateUIN(); - newData->item.lParam = (LPARAM)hwndDlg; - TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item); - dat->iTabID = newData->iTabID; - dat->pContainer = newData->pContainer; - si->pContainer = newData->pContainer; - dat->hwnd = hwndDlg; - si->hWnd = hwndDlg; - si->dat = dat; - dat->bIsAutosizingInput = IsAutoSplitEnabled(dat); - dat->fLimitedUpdate = false; - dat->iInputAreaHeight = -1; - if (!dat->pContainer->settings->fPrivate) - si->iSplitterY = g_Settings.iSplitterY; - else { - if (M.GetByte(CHAT_MODULE, "SyncSplitter", 0)) - si->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23); - else - si->iSplitterY = g_Settings.iSplitterY; - } +void CChatRoomDlg::OnDestroy() +{ + // Typing support for GCW_PRIVMESS sessions + if (si->iType == GCW_PRIVMESS) + if (nTypeMode == PROTOTYPE_SELFTYPING_ON) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); - if (dat->bIsAutosizingInput) - si->iSplitterY = GetDefaultMinimumInputHeight(dat); + if (pcli->pfnGetEvent(si->hContact, 0)) + pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); + si->wState &= ~STATE_TALK; + si->hWnd = NULL; + si->dat = NULL; + si->pContainer = NULL; + si = NULL; - CProxyWindow::add(dat); + TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING, 0); - // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) { - dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF; - SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL); - } + if (!bIsAutosizingInput) + db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); + + if (pContainer->settings->fPrivate && !IsAutoSplitEnabled()) + db_set_w(NULL, CHAT_MODULE, "splitY", (WORD)g_Settings.iSplitterY); - dat->Panel->getVisibility(); - dat->Panel->Configure(); - M.AddWindow(hwndDlg, dat->hContact); - BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0); + DM_FreeTheme(); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_AUTOURLDETECT, 1, 0); - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc); - TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0); + UpdateTrayMenuState(this, FALSE); // remove me from the tray menu (if still there) + if (PluginConfig.g_hMenuTrayUnread) + DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)m_hContact, MF_BYCOMMAND); - int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS); - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, 0x7FFFFFFF, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); - dat->Panel->loadHeight(); + if (hSmileyIcon) + DestroyIcon(hSmileyIcon); - if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL) - UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE); + if (hwndTip) + DestroyWindow(hwndTip); - DM_ThemeChanged(dat); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_HIDESELECTION, TRUE, 0); + if (hCurHyperlinkHand) + DestroyCursor(hCurHyperlinkHand); + + int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd); + if (i >= 0) { + SendMessage(m_hwndParent, WM_USER + 100, 0, 0); // clean up tooltip + TabCtrl_DeleteItem(m_hwndParent, i); + BroadCastContainer(pContainer, DM_REFRESHTABINDEX, 0, 0); + iTabID = -1; + } + if (pWnd) { + delete pWnd; + pWnd = 0; + } + if (sbCustom) { + delete sbCustom; + sbCustom = 0; + } - GetMYUIN(dat); - GetMyNick(dat); + M.RemoveWindow(m_hwnd); - HWND hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL); - CustomizeButton(hwndBtn); - SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, 1, 0); - SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0); - SendMessage(hwndBtn, BUTTONSETASFLATBTN, FALSE, 0); - SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0); - SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), BATF_UNICODE); + TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE, 0); - DM_InitTip(dat); - BB_InitDlgButtons(dat); - SendMessage(hwndDlg, WM_CBD_LOADICONS, 0, 0); + memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS)); + PostMessage(pContainer->hwnd, WM_SIZE, 0, 1); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_LIST), NicklistSubclassProc); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_FILTER), ButtonSubclassProc); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_COLOR), ButtonSubclassProc); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), ButtonSubclassProc); + delete Panel; - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc); - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SUBCLASSED, 0, 0); + if (pContainer->dwFlags & CNT_SIDEBAR) + pContainer->SideBar->removeSession(this); + mir_free(enteredText); + SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); +} - SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0); - SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0); - SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1); +INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (si == NULL && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) + return 0; - SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); - SetWindowPos(hwndDlg, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), 0); - ShowWindow(hwndDlg, SW_SHOW); - PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0); - dat->pContainer->hwndActive = hwndDlg; - TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0); - } - break; + CHARFORMAT2 cf; + POINT pt, tmp, cur; + RECT rc; + switch (uMsg) { case WM_SETFOCUS: if (CMimAPI::m_shutDown) break; - Chat_UpdateWindowState(dat, WM_SETFOCUS); - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + UpdateWindowState(WM_SETFOCUS); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); return 1; case WM_TIMECHANGE: - PostMessage(hwndDlg, GC_REDRAWLOG, 0, 0); + PostMessage(m_hwnd, GC_REDRAWLOG, 0, 0); break; case WM_CBD_LOADICONS: - Srmm_UpdateToolbarIcons(hwndDlg); + Srmm_UpdateToolbarIcons(m_hwnd); return 0; case GC_SETWNDPROPS: - InitButtons(hwndDlg, si); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); + InitButtons(m_hwnd, si); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); - DM_InitRichEdit(dat); - SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, TRUE, 0); + DM_InitRichEdit(this); + SendDlgItemMessage(m_hwnd, IDOK, BUTTONSETASNORMAL, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight); - InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE); + SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight); + InvalidateRect(GetDlgItem(m_hwnd, IDC_LIST), NULL, TRUE); - SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON, + SendDlgItemMessage(m_hwnd, IDC_FILTER, BUTTONSETOVERLAYICON, (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); - SendMessage(hwndDlg, WM_SIZE, 0, 0); - SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0); + SendMessage(m_hwnd, WM_SIZE, 0, 0); + SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0); break; case DM_UPDATETITLE: - return SendMessage(hwndDlg, GC_UPDATETITLE, wParam, lParam); - case GC_UPDATETITLE: - if (!dat->bWasDeleted) { - dat->wStatus = si->wStatus; + if (!m_bWasDeleted) { + wStatus = si->wStatus; - const wchar_t *szNick = dat->cache->getNick(); + const wchar_t *szNick = cache->getNick(); if (mir_wstrlen(szNick) > 0) { if (M.GetByte("cuttitle", 0)) - CutContactName(szNick, dat->newtitle, _countof(dat->newtitle)); + CutContactName(szNick, newtitle, _countof(newtitle)); else - wcsncpy_s(dat->newtitle, szNick, _TRUNCATE); + wcsncpy_s(newtitle, szNick, _TRUNCATE); } wchar_t szTemp[100]; @@ -1745,13 +1776,13 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar switch (si->iType) { case GCW_CHATROOM: - hIcon = Skin_LoadProtoIcon(si->pszModule, (dat->wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : dat->wStatus); + hIcon = Skin_LoadProtoIcon(si->pszModule, (wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : wStatus); mir_snwprintf(szTemp, (si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user%s)") : TranslateT("%s: chat room (%u users%s)"), szNick, si->nUsersInNicklist, si->bFilterEnabled ? TranslateT(", event filter active") : L""); break; case GCW_PRIVMESS: - hIcon = Skin_LoadProtoIcon(si->pszModule, (dat->wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : dat->wStatus); + hIcon = Skin_LoadProtoIcon(si->pszModule, (wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : wStatus); if (si->nUsersInNicklist == 1) mir_snwprintf(szTemp, TranslateT("%s: message session"), szNick); else @@ -1763,36 +1794,36 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break; } - if (dat->pWnd) { - dat->pWnd->updateTitle(dat->newtitle); - dat->pWnd->updateIcon(hIcon); + if (pWnd) { + pWnd->updateTitle(newtitle); + pWnd->updateIcon(hIcon); } - dat->hTabStatusIcon = hIcon; + hTabStatusIcon = hIcon; if (lParam) - dat->hTabIcon = dat->hTabStatusIcon; + hTabIcon = hTabStatusIcon; - if (dat->cache->getStatus() != dat->cache->getOldStatus()) { - wcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->wStatus, 0), _TRUNCATE); + if (cache->getStatus() != cache->getOldStatus()) { + wcsncpy_s(szStatus, pcli->pfnGetStatusModeDescription(wStatus, 0), _TRUNCATE); TCITEM item = { 0 }; item.mask = TCIF_TEXT; - item.pszText = dat->newtitle; - TabCtrl_SetItem(hwndTab, dat->iTabID, &item); + item.pszText = newtitle; + TabCtrl_SetItem(m_hwndParent, iTabID, &item); } - SetWindowText(hwndDlg, szTemp); - if (dat->pContainer->hwndActive == hwndDlg) { - SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, (WPARAM)hwndDlg, 1); - SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0); + SetWindowText(m_hwnd, szTemp); + if (pContainer->hwndActive == m_hwnd) { + SendMessage(pContainer->hwnd, DM_UPDATETITLE, (WPARAM)m_hwnd, 1); + SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); } } break; case GC_UPDATESTATUSBAR: - if (dat->bWasDeleted) + if (m_bWasDeleted) return 0; - if (dat->pContainer->hwndActive != hwndDlg || dat->pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || dat->szStatusBar[0]) + if (pContainer->hwndActive != m_hwnd || pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || szStatusBar[0]) break; if (si->pszModule != NULL) { @@ -1807,10 +1838,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break; int x = 12; - x += GetTextPixelSize(mi->ptszModDispName, (HFONT)SendMessage(dat->pContainer->hwndStatus, WM_GETFONT, 0, 0), TRUE); + x += GetTextPixelSize(mi->ptszModDispName, (HFONT)SendMessage(pContainer->hwndStatus, WM_GETFONT, 0, 0), TRUE); x += GetSystemMetrics(SM_CXSMICON); - if (dat->Panel->isActive()) { + if (Panel->isActive()) { time_t now = time(0); DWORD diff = (now - mi->idleTimeStamp) / 60; @@ -1827,7 +1858,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } else mir_snwprintf(mi->tszIdleMsg, TranslateT(", %d %s idle"), diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute")); } - mir_snwprintf(szFinalStatusBarText, TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg); + mir_snwprintf(szFinalStatusBarText, TranslateT("%s on %s%s"), szMyNickname, mi->ptszModDispName, mi->tszIdleMsg); } else { if (si->ptszStatusbarText) @@ -1835,52 +1866,52 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar else wcsncpy_s(szFinalStatusBarText, mi->ptszModDispName, _TRUNCATE); } - SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText); - UpdateStatusBar(dat); - dat->Panel->Invalidate(); - if (dat->pWnd) - dat->pWnd->Invalidate(); + SendMessage(pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText); + UpdateStatusBar(); + Panel->Invalidate(); + if (pWnd) + pWnd->Invalidate(); return TRUE; } break; case WM_SIZE: - if (dat->ipFieldHeight == 0) - dat->ipFieldHeight = CInfoPanel::m_ipConfig.height1; + if (ipFieldHeight == 0) + ipFieldHeight = CInfoPanel::m_ipConfig.height1; if (wParam == SIZE_MAXIMIZED) - PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0); + PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); - if (!IsIconic(hwndDlg)) { - int panelHeight = dat->Panel->getHeight() + 1; + if (!IsIconic(m_hwnd)) { + int panelHeight = Panel->getHeight() + 1; - GetClientRect(hwndDlg, &rc); + GetClientRect(m_hwnd, &rc); int cx = rc.right; - Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si); + CTabBaseDlg::DlgProc(uMsg, 0, 0); // call basic window resizer - BB_SetButtonsPos(dat); + BB_SetButtonsPos(); rc.left = panelHeight <= CInfoPanel::LEFT_OFFSET_LOGO ? panelHeight : CInfoPanel::LEFT_OFFSET_LOGO; rc.right = cx; rc.top = 1; - rc.bottom = (panelHeight > CInfoPanel::DEGRADE_THRESHOLD ? rc.top + dat->ipFieldHeight - 2 : panelHeight - 1); - dat->rcNick = rc; + rc.bottom = (panelHeight > CInfoPanel::DEGRADE_THRESHOLD ? rc.top + ipFieldHeight - 2 : panelHeight - 1); + rcNick = rc; rc.left = panelHeight <= CInfoPanel::LEFT_OFFSET_LOGO ? panelHeight : CInfoPanel::LEFT_OFFSET_LOGO; rc.right = cx; rc.bottom = panelHeight - 2; - rc.top = dat->rcNick.bottom + 1; - dat->rcUIN = rc; + rc.top = rcNick.bottom + 1; + rcUIN = rc; - if (dat->hwndIEView || dat->hwndHPP) - Chat_ResizeIeView(dat); - DetermineMinHeight(dat); + if (hwndIEView || hwndHPP) + ResizeIeView(); + DetermineMinHeight(); } - break; + return 0; case GC_REDRAWWINDOW: - InvalidateRect(hwndDlg, NULL, TRUE); + InvalidateRect(m_hwnd, NULL, TRUE); break; case GC_REDRAWLOG: @@ -1896,49 +1927,49 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if ((si->iType != GCW_CHATROOM && si->iType != GCW_PRIVMESS) || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0) index++; } - Log_StreamInEvent(hwndDlg, pLog, si, TRUE); + StreamInEvents(pLog, si, TRUE); mir_forkthread(phase2, si); } - else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE); + else StreamInEvents(si->pLogEnd, si, TRUE); } - else SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); + else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); break; case GC_REDRAWLOG2: si->LastTime = 0; if (si->pLog) - Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE); + StreamInEvents(si->pLogEnd, si, TRUE); break; case GC_ADDLOG: if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) { - if (!MessageWindowOpened(0, (LPARAM)hwndDlg)) - SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0); + if (!MessageWindowOpened(0, (LPARAM)m_hwnd)) + SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); } else if (g_Settings.bUseDividers) { - bool bInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd); + bool bInactive = (GetForegroundWindow() != pContainer->hwnd || GetActiveWindow() != pContainer->hwnd); if (bInactive) - SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0); - else if (dat->pContainer->hwndActive != hwndDlg) - SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0); + SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); + else if (pContainer->hwndActive != m_hwnd) + SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); } if (si->pLogEnd) - Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE); + StreamInEvents(si->pLog, si, FALSE); else - SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); + SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); break; case DM_TYPING: // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS) { - int preTyping = dat->nTypeSecs != 0; - dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0; + int preTyping = nTypeSecs != 0; + nTypeSecs = (int)lParam > 0 ? (int)lParam : 0; - if (dat->nTypeSecs) - dat->bShowTyping = 0; + if (nTypeSecs) + bShowTyping = 0; - SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping); + SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, preTyping); } return TRUE; @@ -1950,7 +1981,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam; if (mis->CtlType == ODT_MENU) { - if (dat->Panel->isHovered()) { + if (Panel->isHovered()) { mis->itemHeight = 0; mis->itemWidth = 6; return TRUE; @@ -1965,7 +1996,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; if (dis->CtlType == ODT_MENU) { - if (dat->Panel->isHovered()) { + if (Panel->isHovered()) { DrawMenuItem(dis, (HICON)dis->itemData, 0); return TRUE; } @@ -2066,36 +2097,36 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { DWORD idFrom = GetDlgCtrlID((HWND)wParam); if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) - Srmm_ClickToolbarIcon(dat->hContact, idFrom, (HWND)wParam, 1); + Srmm_ClickToolbarIcon(m_hContact, idFrom, (HWND)wParam, 1); } break; case GC_UPDATENICKLIST: { - int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETTOPINDEX, 0, 0); - SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCOUNT, si->nUsersInNicklist, 0); - SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETTOPINDEX, i, 0); - SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0); + int i = SendDlgItemMessage(m_hwnd, IDC_LIST, LB_GETTOPINDEX, 0, 0); + SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETCOUNT, si->nUsersInNicklist, 0); + SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETTOPINDEX, i, 0); + SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); } break; case GC_CONTROL_MSG: switch (wParam) { case SESSION_OFFLINE: - SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0); + SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0); return TRUE; case SESSION_ONLINE: - SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0); + SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); return TRUE; case WINDOW_HIDDEN: - SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 1); + SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 1); return TRUE; case WINDOW_CLEARLOG: - SetDlgItemText(hwndDlg, IDC_CHAT_LOG, L""); + SetDlgItemText(m_hwnd, IDC_LOG, L""); return TRUE; case SESSION_TERMINATE: @@ -2103,25 +2134,25 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); si->wState &= ~STATE_TALK; - dat->bWasDeleted = 1; + m_bWasDeleted = true; db_set_w(si->hContact, si->pszModule, "ApparentMode", 0); - SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1); + SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1); return TRUE; case WINDOW_MINIMIZE: - ShowWindow(hwndDlg, SW_MINIMIZE); + ShowWindow(m_hwnd, SW_MINIMIZE); LABEL_SHOWWINDOW: - SendMessage(hwndDlg, WM_SIZE, 0, 0); - SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0); - SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0); - SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0); - ShowWindow(hwndDlg, SW_SHOW); - SendMessage(hwndDlg, WM_SIZE, 0, 0); - SetForegroundWindow(hwndDlg); + SendMessage(m_hwnd, WM_SIZE, 0, 0); + SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0); + SendMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0); + SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); + ShowWindow(m_hwnd, SW_SHOW); + SendMessage(m_hwnd, WM_SIZE, 0, 0); + SetForegroundWindow(m_hwnd); return TRUE; case WINDOW_MAXIMIZE: - ShowWindow(hwndDlg, SW_MAXIMIZE); + ShowWindow(m_hwnd, SW_MAXIMIZE); goto LABEL_SHOWWINDOW; case SESSION_INITDONE: @@ -2130,8 +2161,8 @@ LABEL_SHOWWINDOW: // fall through case WINDOW_VISIBLE: - if (IsIconic(hwndDlg)) - ShowWindow(hwndDlg, SW_NORMAL); + if (IsIconic(m_hwnd)) + ShowWindow(m_hwnd, SW_NORMAL); goto LABEL_SHOWWINDOW; } break; @@ -2139,11 +2170,11 @@ LABEL_SHOWWINDOW: case DM_SPLITTERMOVED: RECT rcLog; { - GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog); - if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERX)) { - GetClientRect(hwndDlg, &rc); + GetWindowRect(m_log.GetHwnd(), &rcLog); + if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTERX)) { + GetClientRect(m_hwnd, &rc); pt.x = wParam, pt.y = 0; - ScreenToClient(hwndDlg, &pt); + ScreenToClient(m_hwnd, &pt); si->iSplitterX = rc.right - pt.x + 1; if (si->iSplitterX < 35) @@ -2151,13 +2182,13 @@ LABEL_SHOWWINDOW: if (si->iSplitterX > rc.right - rc.left - 35) si->iSplitterX = rc.right - rc.left - 35; g_Settings.iSplitterX = si->iSplitterX; - SendMessage(dat->hwnd, WM_SIZE, 0, 0); + SendMessage(GetHwnd(), WM_SIZE, 0, 0); } - else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY) || lParam == -1) { - GetClientRect(hwndDlg, &rc); - rc.top += (dat->Panel->isActive() ? dat->Panel->getHeight() + 40 : 30); + else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTERY) || lParam == -1) { + GetClientRect(m_hwnd, &rc); + rc.top += (Panel->isActive() ? Panel->getHeight() + 40 : 30); pt.x = 0, pt.y = wParam; - ScreenToClient(hwndDlg, &pt); + ScreenToClient(m_hwnd, &pt); si->iSplitterY = rc.bottom - pt.y + DPISCALEY_S(1); if (si->iSplitterY < DPISCALEY_S(23)) @@ -2165,19 +2196,19 @@ LABEL_SHOWWINDOW: if (si->iSplitterY > rc.bottom - rc.top - DPISCALEY_S(40)) si->iSplitterY = rc.bottom - rc.top - DPISCALEY_S(40); g_Settings.iSplitterY = si->iSplitterY; - CSkin::UpdateToolbarBG(dat); - SendMessage(dat->hwnd, WM_SIZE, 0, 0); + UpdateToolbarBG(); + SendMessage(GetHwnd(), WM_SIZE, 0, 0); } - else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) { + else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_PANELSPLITTER)) { pt.x = 0, pt.y = wParam; - ScreenToClient(hwndDlg, &pt); - GetClientRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rc); + ScreenToClient(m_hwnd, &pt); + GetClientRect(m_log.GetHwnd(), &rc); if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30)) - dat->Panel->setHeight(pt.y + 2); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + Panel->setHeight(pt.y + 2); + RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); if (M.isAero()) - InvalidateRect(GetParent(hwndDlg), NULL, FALSE); - SendMessage(hwndDlg, WM_SIZE, DM_SPLITTERMOVED, 0); + InvalidateRect(m_hwndParent, NULL, FALSE); + SendMessage(m_hwnd, WM_SIZE, DM_SPLITTERMOVED, 0); break; } } @@ -2200,143 +2231,143 @@ LABEL_SHOWWINDOW: case GC_CHANGEFILTERFLAG: if (si->iLogFilterFlags == 0 && si->bFilterEnabled) - SendMessage(hwndDlg, WM_COMMAND, IDC_FILTER, 0); + SendMessage(m_hwnd, WM_COMMAND, IDC_FILTER, 0); break; case GC_SHOWFILTERMENU: - si->hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), dat->pContainer->hwnd, FilterWndProc, (LPARAM)si); + si->hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), pContainer->hwnd, FilterWndProc, (LPARAM)si); TranslateDialogDefault(si->hwndStatus); RECT rcFilter; GetClientRect(si->hwndStatus, &rcFilter); - GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog); + GetWindowRect(m_log.GetHwnd(), &rcLog); pt.x = rcLog.right; pt.y = rcLog.bottom; - ScreenToClient(dat->pContainer->hwnd, &pt); + ScreenToClient(pContainer->hwnd, &pt); SetWindowPos(si->hwndStatus, HWND_TOP, pt.x - rcFilter.right, pt.y - rcFilter.bottom, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); break; case DM_SPLITTERGLOBALEVENT: - DM_SplitterGlobalEvent(dat, wParam, lParam); + DM_SplitterGlobalEvent(this, wParam, lParam); return 0; case GC_SHOWCOLORCHOOSER: - pci->ColorChooser(si, lParam == IDC_COLOR, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GetDlgItem(hwndDlg, lParam)); + pci->ColorChooser(si, lParam == IDC_COLOR, m_hwnd, GetDlgItem(m_hwnd, IDC_MESSAGE), GetDlgItem(m_hwnd, lParam)); break; case GC_SCROLLTOBOTTOM: - DM_ScrollToBottom(dat, wParam, lParam); + DM_ScrollToBottom(this, wParam, lParam); return 0; case WM_TIMER: if (wParam == TIMERID_FLASHWND) - if (dat->mayFlashTab) - FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, TRUE, dat->hTabIcon); + if (m_bCanFlashTab) + FlashTab(true); // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS && wParam == TIMERID_TYPE) - DM_Typing(dat); + DM_Typing(this); break; case WM_ACTIVATE: if (LOWORD(wParam) != WA_ACTIVE) { - dat->pContainer->hwndSaved = 0; + pContainer->hwndSaved = 0; break; } // fall through case WM_MOUSEACTIVATE: - Chat_UpdateWindowState(dat, WM_ACTIVATE); + UpdateWindowState(WM_ACTIVATE); return 1; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case EN_MSGFILTER: - BOOL isShift, isCtrl, isMenu; + bool isShift, isCtrl, isMenu; { UINT msg = ((MSGFILTER *)lParam)->msg; WPARAM wp = ((MSGFILTER *)lParam)->wParam; LPARAM lp = ((MSGFILTER *)lParam)->lParam; - KbdState(dat, isShift, isCtrl, isMenu); + KbdState(isShift, isCtrl, isMenu); MSG message; - message.hwnd = hwndDlg; + message.hwnd = m_hwnd; 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))) - dat->pContainer->MenuBar->autoShow(); + if (!fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24))) + pContainer->MenuBar->autoShow(); - return _dlgReturn(hwndDlg, 0); + return _dlgReturn(m_hwnd, 0); } if (msg == WM_MOUSEMOVE) { GetCursorPos(&pt); - DM_DismissTip(dat, pt); - dat->Panel->trackMouse(pt); + DM_DismissTip(this, pt); + Panel->trackMouse(pt); break; } if (msg == WM_KEYDOWN) { if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) { - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0); ((MSGFILTER*)lParam)->msg = WM_NULL; ((MSGFILTER*)lParam)->wParam = 0; ((MSGFILTER*)lParam)->lParam = 0; - return _dlgReturn(hwndDlg, 1); + return _dlgReturn(m_hwnd, 1); } } if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN) - dat->pContainer->MenuBar->Cancel(); + pContainer->MenuBar->Cancel(); if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) { - if (DM_GenericHotkeysCheck(&message, dat)) { - dat->fkeyProcessed = true; - return _dlgReturn(hwndDlg, 1); + if (DM_GenericHotkeysCheck(&message, this)) { + fkeyProcessed = true; + return _dlgReturn(m_hwnd, 1); } LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC)); if (mim_hotkey_check) - dat->fkeyProcessed = true; + fkeyProcessed = true; switch (mim_hotkey_check) { case TABSRMM_HK_CHANNELMGR: - SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0); - return _dlgReturn(hwndDlg, 1); + SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0); + return _dlgReturn(m_hwnd, 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); + SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0); + InvalidateRect(GetDlgItem(m_hwnd, IDC_FILTER), NULL, TRUE); + return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_LISTTOGGLE: - SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0); - return _dlgReturn(hwndDlg, 1); + SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0); + return _dlgReturn(m_hwnd, 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); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0); + return _dlgReturn(m_hwnd, 1); } } - if (msg == WM_KEYDOWN && ((NMHDR*)lParam)->idFrom != IDC_CHAT_MESSAGE) { + if (msg == WM_KEYDOWN && ((NMHDR*)lParam)->idFrom != IDC_MESSAGE) { if ((wp == VK_NEXT && isCtrl && !isShift) || (wp == VK_TAB && isCtrl && !isShift)) // CTRL-TAB (switch tab/window) - SendMessage(dat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0); + SendMessage(pContainer->hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0); else if ((wp == VK_PRIOR && isCtrl && !isShift) || (wp == VK_TAB && isCtrl && isShift)) // CTRL_SHIFT-TAB (switch tab/window) - SendMessage(dat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0); + SendMessage(pContainer->hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0); } if (msg == WM_KEYDOWN && wp == VK_TAB) { - if (((NMHDR*)lParam)->idFrom == IDC_CHAT_LOG) { - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); - return _dlgReturn(hwndDlg, 1); + if (((NMHDR*)lParam)->idFrom == IDC_LOG) { + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); + return _dlgReturn(m_hwnd, 1); } } - if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) { + if (((LPNMHDR)lParam)->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) { CHARRANGE sel, all = { 0, -1 }; pt.x = LOWORD(((ENLINK*)lParam)->lParam), pt.y = HIWORD(((ENLINK*)lParam)->lParam); @@ -2346,13 +2377,13 @@ LABEL_SHOWWINDOW: wchar_t *pszWord = (wchar_t*)_alloca(8192); pszWord[0] = '\0'; POINTL ptl = { pt.x, pt.y }; - ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), (LPPOINT)&ptl); - int iCharIndex = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl); + ScreenToClient(m_log.GetHwnd(), (LPPOINT)&ptl); + int iCharIndex = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl); if (iCharIndex < 0) break; - int start = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex); - int end = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex); + int start = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex); + int end = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex); if (end - start > 0) { static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n"; @@ -2364,7 +2395,7 @@ LABEL_SHOWWINDOW: TEXTRANGE tr = { 0 }; tr.chrg = cr; tr.lpstrText = (wchar_t*)pszWord; - int iRes = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + int iRes = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) { size_t iLen = mir_wstrlen(pszWord) - 1; @@ -2376,10 +2407,10 @@ LABEL_SHOWWINDOW: } HMENU hMenu = 0; - UINT uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord); + UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, si, NULL, pszWord); switch (uID) { case 0: - PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); break; case ID_COPYALL: @@ -2387,30 +2418,30 @@ LABEL_SHOWWINDOW: SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all); SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0); SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel); - PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); break; case ID_CLEARLOG: - ClearLog(dat); + ClearLog(); break; case ID_SEARCH_GOOGLE: if (pszWord[0]) Utils_OpenUrlW(CMStringW(FORMAT, L"http://www.google.com/search?q=%s", pszWord)); - PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); break; case ID_SEARCH_WIKIPEDIA: if (pszWord[0]) Utils_OpenUrlW(CMStringW(FORMAT, L"http://en.wikipedia.org/wiki/%s", pszWord)); - PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); break; default: - PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID); break; } @@ -2420,12 +2451,12 @@ LABEL_SHOWWINDOW: break; case EN_REQUESTRESIZE: - if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_MESSAGE) - DM_HandleAutoSizeRequest(dat, (REQRESIZE *)lParam); + if (((LPNMHDR)lParam)->idFrom == IDC_MESSAGE) + DM_HandleAutoSizeRequest(this, (REQRESIZE *)lParam); break; case EN_LINK: - if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG) { + if (((LPNMHDR)lParam)->idFrom == IDC_LOG) { switch (((ENLINK*)lParam)->msg) { case WM_SETCURSOR: if (g_Settings.bClickableNicks) { @@ -2444,7 +2475,7 @@ LABEL_SHOWWINDOW: SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin == sel.cpMax) { UINT msg = ((ENLINK*)lParam)->msg; - dat->pContainer->MenuBar->Cancel(); + pContainer->MenuBar->Cancel(); TEXTRANGE tr; tr.lpstrText = NULL; @@ -2460,7 +2491,7 @@ LABEL_SHOWWINDOW: pt.x = (short)LOWORD(((ENLINK*)lParam)->lParam); pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam); ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) { case ID_NEW: Utils_OpenUrlW(tr.lpstrText); break; @@ -2468,8 +2499,8 @@ LABEL_SHOWWINDOW: Utils_OpenUrlW(tr.lpstrText,false); break; case ID_COPY: - Utils::CopyToClipBoard(tr.lpstrText, hwndDlg); - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + Utils::CopyToClipBoard(tr.lpstrText, m_hwnd); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); break; } mir_free(tr.lpstrText); @@ -2477,7 +2508,7 @@ LABEL_SHOWWINDOW: } if (((ENLINK*)lParam)->msg == WM_LBUTTONUP) { Utils_OpenUrlW(tr.lpstrText); - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); mir_free(tr.lpstrText); return TRUE; } @@ -2494,17 +2525,17 @@ LABEL_SHOWWINDOW: pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam); ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt); memcpy(&uiNew, ui, sizeof(USERINFO)); - UINT uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, uiNew.pszNick); + UINT uID = CreateGCMenu(m_hwnd, &hMenu, 0, pt, si, uiNew.pszUID, uiNew.pszNick); switch (uID) { case 0: break; case ID_MESS: - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); break; default: - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, (LPARAM)uID); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, (LPARAM)uID); break; } DestroyGCMenu(&hMenu, 1); @@ -2514,7 +2545,7 @@ LABEL_SHOWWINDOW: } else if (msg == WM_LBUTTONUP) { CHARRANGE chr; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); wchar_t tszAplTmpl[] = L"%s:"; size_t bufSize = mir_wstrlen(tr.lpstrText) + mir_wstrlen(tszAplTmpl) + 3; @@ -2526,7 +2557,7 @@ LABEL_SHOWWINDOW: // prepend nick with space if needed tr2.chrg.cpMin = chr.cpMin - 1; tr2.chrg.cpMax = chr.cpMin; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2); if (!iswspace(*tr2.lpstrText)) *tszTmp++ = ' '; mir_wstrcpy(tszTmp, tr.lpstrText); @@ -2540,7 +2571,7 @@ LABEL_SHOWWINDOW: tr2.chrg.cpMax = chr.cpMax + 1; // if there is no space after selection, // or there is nothing after selection at all... - if (!SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !iswspace(*tr2.lpstrText)) { + if (!SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !iswspace(*tr2.lpstrText)) { tszAppeal[st++] = ' '; tszAppeal[st++] = '\0'; } @@ -2549,12 +2580,12 @@ LABEL_SHOWWINDOW: tszAppeal[st++] = ' '; tszAppeal[st++] = '\0'; } - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal); mir_free((void*)tr2.lpstrText); mir_free((void*)tszAppeal); } } - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); mir_free(tr.lpstrText); return TRUE; } @@ -2567,35 +2598,35 @@ LABEL_SHOWWINDOW: case WM_LBUTTONDOWN: GetCursorPos(&tmp); - if (!dat->Panel->isHovered()) { + if (!Panel->isHovered()) { cur.x = (SHORT)tmp.x; cur.y = (SHORT)tmp.y; - SendMessage(dat->pContainer->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur))); + SendMessage(pContainer->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur))); } break; case WM_LBUTTONUP: GetCursorPos(&tmp); - if (dat->Panel->isHovered()) - dat->Panel->handleClick(tmp); + if (Panel->isHovered()) + Panel->handleClick(tmp); else { cur.x = (SHORT)tmp.x; cur.y = (SHORT)tmp.y; - SendMessage(dat->pContainer->hwnd, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur))); + SendMessage(pContainer->hwnd, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur))); } break; case WM_MOUSEMOVE: GetCursorPos(&pt); - DM_DismissTip(dat, pt); - dat->Panel->trackMouse(pt); + DM_DismissTip(this, pt); + Panel->trackMouse(pt); break; case WM_APPCOMMAND: { DWORD cmd = GET_APPCOMMAND_LPARAM(lParam); if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) { - SendMessage(dat->pContainer->hwnd, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0); + SendMessage(pContainer->hwnd, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0); return 1; } } @@ -2603,7 +2634,7 @@ LABEL_SHOWWINDOW: case WM_COMMAND: if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID){ - Srmm_ClickToolbarIcon(dat->hContact, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0); + Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0); break; } @@ -2613,13 +2644,13 @@ LABEL_SHOWWINDOW: TVHITTESTINFO hti; hti.pt.x = (short)LOWORD(GetMessagePos()); hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(GetDlgItem(hwndDlg, IDC_LIST), &hti.pt); + ScreenToClient(GetDlgItem(m_hwnd, IDC_LIST), &hti.pt); - int item = LOWORD(SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); + int item = LOWORD(SendDlgItemMessage(m_hwnd, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, item); if (ui) { if (g_Settings.bDoubleClick4Privat ? GetKeyState(VK_SHIFT) & 0x8000 : !(GetKeyState(VK_SHIFT) & 0x8000)) { - LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETSEL, 0, 0); + LRESULT lResult = (LRESULT)SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETSEL, 0, 0); int start = LOWORD(lResult); CMStringW tszName; if (start == 0) @@ -2627,113 +2658,113 @@ LABEL_SHOWWINDOW: else tszName.Format(L"%s ", ui->pszNick); - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); - PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); } - else pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + else pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); } return TRUE; } if (HIWORD(wParam) == LBN_KILLFOCUS) - RedrawWindow(GetDlgItem(hwndDlg, IDC_LIST), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(m_hwnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE); break; case IDC_TOGGLESIDEBAR: - SendMessage(dat->pContainer->hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0); + SendMessage(pContainer->hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0); break; case IDCANCEL: - ShowWindow(dat->pContainer->hwnd, SW_MINIMIZE); + ShowWindow(pContainer->hwnd, SW_MINIMIZE); return FALSE; case IDOK: - if (GetSendButtonState(hwndDlg) != PBS_DISABLED) { + if (GetSendButtonState(m_hwnd) != PBS_DISABLED) { MODULEINFO *mi = pci->MM_FindModule(si->pszModule); if (mi == NULL) break; - ptrA pszRtf(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE))); + ptrA pszRtf(Message_GetFromStream(GetDlgItem(m_hwnd, IDC_MESSAGE))); pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf); CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf))); if (ptszText.IsEmpty()) break; - DoRtfToTags(si->dat, ptszText, mi->nColorCount, mi->crColors); + si->dat->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors); ptszText.Trim(); ptszText.Replace(L"%", L"%%"); if (mi->bAckMsg) { - Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, false); - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0); + Utils::enableDlgControl(m_hwnd, IDC_MESSAGE, false); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0); } - else SetDlgItemText(hwndDlg, IDC_CHAT_MESSAGE, L""); + else SetDlgItemText(m_hwnd, IDC_MESSAGE, L""); - Utils::enableDlgControl(hwndDlg, IDOK, false); + Utils::enableDlgControl(m_hwnd, IDOK, false); // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS) - if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON) - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); + if (nTypeMode == PROTOTYPE_SELFTYPING_ON) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); bool fSound = true; if (ptszText[0] == '/' || si->iType == GCW_SERVER) fSound = false; - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); mi->idleTimeStamp = time(0); mi->lastIdleCheck = 0; pci->SM_BroadcastMessage(si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE); - if (dat->pContainer) - if (fSound && !nen_options.iNoSounds && !(dat->pContainer->dwFlags & CNT_NOSOUND)) + if (pContainer) + if (fSound && !nen_options.iNoSounds && !(pContainer->dwFlags & CNT_NOSOUND)) SkinPlaySound("ChatSent"); - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); } break; case IDC_SHOWNICKLIST: - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST))) + if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_SHOWNICKLIST))) break; if (si->iType == GCW_SERVER) break; si->bNicklistEnabled = !si->bNicklistEnabled; - SendMessage(hwndDlg, WM_SIZE, 0, 0); + SendMessage(m_hwnd, WM_SIZE, 0, 0); if (CSkin::m_skinEnabled) - InvalidateRect(hwndDlg, NULL, TRUE); - PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0); + InvalidateRect(m_hwnd, NULL, TRUE); + PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); break; - case IDC_CHAT_MESSAGE: + case IDC_MESSAGE: if (HIWORD(wParam) == EN_CHANGE) { - if (dat->pContainer->hwndActive == hwndDlg) - UpdateReadChars(dat); - dat->dwLastActivity = GetTickCount(); - dat->pContainer->dwLastActivity = dat->dwLastActivity; - SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)) != 0, 0); - Utils::enableDlgControl(hwndDlg, IDOK, GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)) != 0); + if (pContainer->hwndActive == m_hwnd) + UpdateReadChars(); + dwLastActivity = GetTickCount(); + pContainer->dwLastActivity = dwLastActivity; + SendDlgItemMessage(m_hwnd, IDOK, BUTTONSETASNORMAL, GetRichTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE)) != 0, 0); + Utils::enableDlgControl(m_hwnd, IDOK, GetRichTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE)) != 0); // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS) { if (!(GetKeyState(VK_CONTROL) & 0x8000)) { - dat->nLastTyping = GetTickCount(); - if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE))) { - if (dat->nTypeMode == PROTOTYPE_SELFTYPING_OFF) { - if (!(dat->dwFlags & MWF_INITMODE)) - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_ON); + nLastTyping = GetTickCount(); + if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE))) { + if (nTypeMode == PROTOTYPE_SELFTYPING_OFF) { + if (!(dwFlags & MWF_INITMODE)) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_ON); } } - else if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON) - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); + else if (nTypeMode == PROTOTYPE_SELFTYPING_ON) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); } } } break; case IDC_CHAT_HISTORY: - if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY))) { + if (IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_HISTORY))) { MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule); if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(si->pszModule, "IRC")) { char szName[MAX_PATH]; @@ -2742,22 +2773,22 @@ LABEL_SHOWWINDOW: CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName); } else if (pInfo) - ShellExecute(hwndDlg, NULL, pci->GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW); + ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW); } break; case IDC_CHAT_CLOSE: - SendMessage(hwndDlg, WM_CLOSE, 0, 1); + SendMessage(m_hwnd, WM_CLOSE, 0, 1); break; case IDC_CHANMGR: - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHANMGR))) + if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHANMGR))) break; - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); break; case IDC_FILTER: - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILTER))) + if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_FILTER))) break; if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) { @@ -2766,15 +2797,15 @@ LABEL_SHOWWINDOW: } else si->bFilterEnabled = !si->bFilterEnabled; - SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON, + SendDlgItemMessage(m_hwnd, IDC_FILTER, BUTTONSETOVERLAYICON, (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); if (si->bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) { - SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0); + SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0); break; } - SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0); - SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0); + SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0); + SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); db_set_b(si->hContact, CHAT_MODULE, "FilterEnabled", (BYTE)si->bFilterEnabled); break; @@ -2782,22 +2813,22 @@ LABEL_SHOWWINDOW: cf.cbSize = sizeof(CHARFORMAT2); cf.dwEffects = 0; - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BKGCOLOR))) + if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_BKGCOLOR))) break; - if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR)) { + if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) { if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) - SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR); + SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR); else if (si->bBGSet) { cf.dwMask = CFM_BACKCOLOR; cf.crBackColor = pci->MM_FindModule(si->pszModule)->crColors[si->iBG]; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } } else { cf.dwMask = CFM_BACKCOLOR; cf.crBackColor = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR); - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } break; @@ -2805,16 +2836,16 @@ LABEL_SHOWWINDOW: cf.cbSize = sizeof(CHARFORMAT2); cf.dwEffects = 0; - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_COLOR))) + if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_COLOR))) break; - if (IsDlgButtonChecked(hwndDlg, IDC_COLOR)) { + if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) { if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) - SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR); + SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR); else if (si->bFGSet) { cf.dwMask = CFM_COLOR; cf.crTextColor = pci->MM_FindModule(si->pszModule)->crColors[si->iFG]; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } } else { @@ -2822,7 +2853,7 @@ LABEL_SHOWWINDOW: LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE); cf.dwMask = CFM_COLOR; cf.crTextColor = cr; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } break; @@ -2833,33 +2864,33 @@ LABEL_SHOWWINDOW: cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE; cf.dwEffects = 0; - if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_BOLD))) + if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_BOLD))) break; - if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ITALICS))) + if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_ITALICS))) break; - if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_UNDERLINE))) + if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_UNDERLINE))) break; - if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD)) + if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_BOLD)) cf.dwEffects |= CFE_BOLD; - if (IsDlgButtonChecked(hwndDlg, IDC_ITALICS)) + if (IsDlgButtonChecked(m_hwnd, IDC_ITALICS)) cf.dwEffects |= CFE_ITALIC; - if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE)) + if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_UNDERLINE)) cf.dwEffects |= CFE_UNDERLINE; - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); break; case IDC_SELFTYPING: // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS) { - if (dat->hContact) { - int iCurrentTypingMode = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); + if (m_hContact) { + int iCurrentTypingMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); - if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && iCurrentTypingMode) { - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); - dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF; + if (nTypeMode == PROTOTYPE_SELFTYPING_ON && iCurrentTypingMode) { + DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); + nTypeMode = PROTOTYPE_SELFTYPING_OFF; } - db_set_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)!iCurrentTypingMode); + db_set_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)!iCurrentTypingMode); } } break; @@ -2867,7 +2898,7 @@ LABEL_SHOWWINDOW: break; case WM_KEYDOWN: - SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); break; case WM_MOVE: @@ -2878,12 +2909,12 @@ LABEL_SHOWWINDOW: { HDC hdc = (HDC)wParam; UINT item_ids[3] = { ID_EXTBKUSERLIST, ID_EXTBKHISTORY, ID_EXTBKINPUTAREA }; - UINT ctl_ids[3] = { IDC_LIST, IDC_CHAT_LOG, IDC_CHAT_MESSAGE }; + UINT ctl_ids[3] = { IDC_LIST, IDC_LOG, IDC_MESSAGE }; HANDLE hbp = 0; HDC hdcMem = 0; HBITMAP hbm, hbmOld; - GetClientRect(hwndDlg, &rcClient); + GetClientRect(m_hwnd, &rcClient); LONG cx = rcClient.right - rcClient.left; LONG cy = rcClient.bottom - rcClient.top; @@ -2898,14 +2929,14 @@ LABEL_SHOWWINDOW: } if (CSkin::m_skinEnabled && !M.isAero()) { - CSkin::SkinDrawBG(hwndDlg, dat->pContainer->hwnd, dat->pContainer, &rcClient, hdcMem); + CSkin::SkinDrawBG(m_hwnd, pContainer->hwnd, pContainer, &rcClient, hdcMem); for (int i = 0; i < 3; i++) { CSkinItem *item = &SkinItems[item_ids[i]]; if (!item->IGNORED) { - GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow); + GetWindowRect(GetDlgItem(m_hwnd, ctl_ids[i]), &rcWindow); pt.x = rcWindow.left; pt.y = rcWindow.top; - ScreenToClient(hwndDlg, &pt); + ScreenToClient(m_hwnd, &pt); rc.left = pt.x - item->MARGIN_LEFT; rc.top = pt.y - item->MARGIN_TOP; rc.right = rc.left + item->MARGIN_RIGHT + (rcWindow.right - rcWindow.left) + item->MARGIN_LEFT; @@ -2919,18 +2950,18 @@ LABEL_SHOWWINDOW: if (M.isAero()) { LONG temp = rcClient.bottom; - rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5; + rcClient.bottom = Panel->isActive() ? Panel->getHeight() + 5 : 5; FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH)); rcClient.bottom = temp; } } - GetClientRect(hwndDlg, &rc); - dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], M.isAero()); - dat->Panel->renderContent(hdcMem); + GetClientRect(m_hwnd, &rc); + Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], M.isAero()); + Panel->renderContent(hdcMem); if (!CSkin::m_skinEnabled) - CSkin::RenderToolbarBG(dat, hdcMem, rcClient); + RenderToolbarBG(hdcMem, rcClient); if (hbp) CSkin::FinalizeBufferedPaint(hbp, &rcClient); @@ -2940,8 +2971,8 @@ LABEL_SHOWWINDOW: DeleteObject(hbm); DeleteDC(hdcMem); } - if (!dat->fLimitedUpdate) - SetAeroMargins(dat->pContainer); + if (!fLimitedUpdate) + SetAeroMargins(pContainer); } return TRUE; @@ -2952,27 +2983,27 @@ LABEL_SHOWWINDOW: case WM_PAINT: PAINTSTRUCT ps; - BeginPaint(hwndDlg, &ps); - EndPaint(hwndDlg, &ps); + BeginPaint(m_hwnd, &ps); + EndPaint(m_hwnd, &ps); return 0; case DM_SETINFOPANEL: - CInfoPanel::setPanelHandler(dat, wParam, lParam); + CInfoPanel::setPanelHandler(this, wParam, lParam); return 0; case DM_INVALIDATEPANEL: - if (dat->Panel) - dat->Panel->Invalidate(true); + if (Panel) + Panel->Invalidate(true); return 0; case WM_RBUTTONUP: GetCursorPos(&pt); - if (!dat->Panel->invokeConfigDialog(pt)) { + if (!Panel->invokeConfigDialog(pt)) { HMENU subMenu = GetSubMenu(PluginConfig.g_hMenuContext, 0); - MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT); + MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT); - int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL); if (iSelection >= IDM_CONTAINERMENU) { DBVARIANT dbv = { 0 }; char szIndex[10]; @@ -2980,34 +3011,36 @@ LABEL_SHOWWINDOW: mir_snprintf(szIndex, "%d", iSelection - IDM_CONTAINERMENU); if (iSelection - IDM_CONTAINERMENU >= 0) { if (!db_get_ws(NULL, szKey, szIndex, &dbv)) { - SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal); + SendMessage(m_hwnd, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal); db_free(&dbv); } } break; } - MsgWindowMenuHandler(dat, iSelection, MENU_TABCONTEXT); + MsgWindowMenuHandler(iSelection, MENU_TABCONTEXT); } break; case WM_LBUTTONDBLCLK: if (LOWORD(lParam) < 30) - PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0); + PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); break; case WM_CLOSE: if (wParam == 0 && lParam == 0) { if (PluginConfig.m_EscapeCloses == 1) { - SendMessage(dat->pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); return TRUE; } if (PluginConfig.m_bHideOnClose && PluginConfig.m_EscapeCloses == 2) { - ShowWindow(dat->pContainer->hwnd, SW_HIDE); + ShowWindow(pContainer->hwnd, SW_HIDE); return TRUE; } - _dlgReturn(hwndDlg, TRUE); + _dlgReturn(m_hwnd, TRUE); } - SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 1); + SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 1); + if (lParam) // forced close not to be handled by the core + return 0; break; case DM_CONTAINERSELECTED: @@ -3015,17 +3048,17 @@ LABEL_SHOWWINDOW: wchar_t *szNewName = (wchar_t*)lParam; if (!mir_wstrcmp(szNewName, TranslateT("Default container"))) szNewName = CGlobals::m_default_container_name; - int iOldItems = TabCtrl_GetItemCount(hwndTab); - if (!wcsncmp(dat->pContainer->szName, szNewName, CONTAINER_NAMELEN)) + int iOldItems = TabCtrl_GetItemCount(m_hwndParent); + if (!wcsncmp(pContainer->szName, szNewName, CONTAINER_NAMELEN)) break; TContainerData *pNewContainer = FindContainerByName(szNewName); if (pNewContainer == NULL) - if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL) + if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == NULL) break; - db_set_ws(dat->hContact, SRMSGMOD_T, "containerW", szNewName); - PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB_CHAT, (WPARAM)pNewContainer, (LPARAM)hwndDlg); + db_set_ws(m_hContact, SRMSGMOD_T, "containerW", szNewName); + PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB_CHAT, (WPARAM)pNewContainer, (LPARAM)m_hwnd); if (iOldItems > 1) // there were more than 1 tab, container is still valid - SendMessage(dat->pContainer->hwndActive, WM_SIZE, 0, 0); + SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0); SetForegroundWindow(pNewContainer->hwnd); SetActiveWindow(pNewContainer->hwnd); } @@ -3034,262 +3067,185 @@ LABEL_SHOWWINDOW: // container API support functions case DM_QUERYCONTAINER: if (lParam) - *(TContainerData**)lParam = dat->pContainer; + *(TContainerData**)lParam = pContainer; return 0; case DM_QUERYHCONTACT: if (lParam) - *(MCONTACT*)lParam = dat->hContact; + *(MCONTACT*)lParam = m_hContact; return 0; case GC_CLOSEWINDOW: { - TContainerData *pContainer = dat->pContainer; bool bForced = (lParam == 2); - int iTabs = TabCtrl_GetItemCount(hwndTab); + int iTabs = TabCtrl_GetItemCount(m_hwndParent); if (iTabs == 1 && CMimAPI::m_shutDown == 0) { - SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1); + SendMessage(GetParent(m_hwndParent), WM_CLOSE, 0, 1); return 1; } - dat->pContainer->iChilds--; - int i = GetTabIndexFromHWND(hwndTab, hwndDlg); + pContainer->iChilds--; + int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd); // after closing a tab, we need to activate the tab to the left side of // the previously open tab. // normally, this tab has the same index after the deletion of the formerly active tab // unless, of course, we closed the last (rightmost) tab. - if (!dat->pContainer->bDontSmartClose && iTabs > 1 && !bForced) { + if (!pContainer->bDontSmartClose && iTabs > 1 && !bForced) { if (i == iTabs - 1) i--; else i++; - TabCtrl_SetCurSel(hwndTab, i); + TabCtrl_SetCurSel(m_hwndParent, i); TCITEM item = { 0 }; item.mask = TCIF_PARAM; - TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab... - dat->pContainer->hwndActive = (HWND)item.lParam; + TabCtrl_GetItem(m_hwndParent, i, &item); // retrieve dialog hwnd for the now active tab... + pContainer->hwndActive = (HWND)item.lParam; - SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); - SetWindowPos(dat->pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW); + SendMessage(pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); + SetWindowPos(pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW); ShowWindow((HWND)item.lParam, SW_SHOW); - SetForegroundWindow(dat->pContainer->hwndActive); - SetFocus(dat->pContainer->hwndActive); - SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0); + SetForegroundWindow(pContainer->hwndActive); + SetFocus(pContainer->hwndActive); + SendMessage(pContainer->hwnd, WM_SIZE, 0, 0); } if (iTabs == 1) - SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1); + SendMessage(GetParent(m_hwndParent), WM_CLOSE, 0, 1); else { PostMessage(pContainer->hwnd, WM_SIZE, 0, 0); - DestroyWindow(hwndDlg); + Close(); } } return 0; case DM_SETLOCALE: - if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) + if (dwFlags & MWF_WASBACKGROUNDCREATE) break; - if (dat->pContainer->hwndActive == hwndDlg && PluginConfig.m_bAutoLocaleSupport && dat->hContact != 0 && dat->pContainer->hwnd == GetForegroundWindow() && dat->pContainer->hwnd == GetActiveWindow()) { + if (pContainer->hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && m_hContact != 0 && pContainer->hwnd == GetForegroundWindow() && pContainer->hwnd == GetActiveWindow()) { if (lParam) - dat->hkl = (HKL)lParam; + hkl = (HKL)lParam; - if (dat->hkl) - ActivateKeyboardLayout(dat->hkl, 0); + if (hkl) + ActivateKeyboardLayout(hkl, 0); } return 0; case DM_SAVESIZE: - if (dat->dwFlags & MWF_NEEDCHECKSIZE) + if (dwFlags & MWF_NEEDCHECKSIZE) lParam = 0; - dat->dwFlags &= ~MWF_NEEDCHECKSIZE; - if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) - dat->dwFlags &= ~MWF_INITMODE; + dwFlags &= ~MWF_NEEDCHECKSIZE; + if (dwFlags & MWF_WASBACKGROUNDCREATE) + dwFlags &= ~MWF_INITMODE; - 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(pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient); + MoveWindow(m_hwnd, 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); + if (dwFlags & MWF_WASBACKGROUNDCREATE) { + dwFlags &= ~MWF_WASBACKGROUNDCREATE; + SendMessage(m_hwnd, WM_SIZE, 0, 0); pt.x = pt.y = 0; - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt); + SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt); if (PluginConfig.m_bAutoLocaleSupport) { - if (dat->hkl == 0) - DM_LoadLocale(dat); + if (hkl == 0) + DM_LoadLocale(this); else - PostMessage(hwndDlg, DM_SETLOCALE, 0, 0); + PostMessage(m_hwnd, DM_SETLOCALE, 0, 0); } } else { - SendMessage(hwndDlg, WM_SIZE, 0, 0); + SendMessage(m_hwnd, WM_SIZE, 0, 0); if (lParam == 0) - PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 1, 1); + PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 1, 1); } return 0; case DM_GETWINDOWSTATE: { UINT state = MSG_WINDOW_STATE_EXISTS; - if (IsWindowVisible(hwndDlg)) + if (IsWindowVisible(m_hwnd)) state |= MSG_WINDOW_STATE_VISIBLE; - if (GetForegroundWindow() == dat->pContainer->hwnd) + if (GetForegroundWindow() == pContainer->hwnd) state |= MSG_WINDOW_STATE_FOCUS; - if (IsIconic(dat->pContainer->hwnd)) + if (IsIconic(pContainer->hwnd)) state |= MSG_WINDOW_STATE_ICONIC; - SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state); + SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state); } return TRUE; case DM_ADDDIVIDER: - if (!(dat->dwFlags & MWF_DIVIDERSET) && g_Settings.bUseDividers) { - if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG)) > 0) { - dat->dwFlags |= MWF_DIVIDERWANTED; - dat->dwFlags |= MWF_DIVIDERSET; - } - } + if (!(dwFlags & MWF_DIVIDERSET) && g_Settings.bUseDividers) + if (GetWindowTextLength(m_log.GetHwnd()) > 0) + dwFlags |= MWF_DIVIDERWANTED | MWF_DIVIDERSET; return 0; case DM_CHECKSIZE: - dat->dwFlags |= MWF_NEEDCHECKSIZE; + dwFlags |= MWF_NEEDCHECKSIZE; return 0; case DM_REFRESHTABINDEX: - dat->iTabID = GetTabIndexFromHWND(GetParent(hwndDlg), hwndDlg); + iTabID = GetTabIndexFromHWND(m_hwndParent, m_hwnd); return 0; case DM_STATUSBARCHANGED: - UpdateStatusBar(dat); + UpdateStatusBar(); break; case WM_CBD_UPDATED: if (lParam) - CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam); + CB_ChangeButton((CustomButtonData*)lParam); else - BB_InitDlgButtons(dat); + BB_InitDlgButtons(); - BB_SetButtonsPos(dat); + BB_SetButtonsPos(); return 0; case WM_CBD_REMOVED: if (lParam) - CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam); + CB_DestroyButton((DWORD)wParam, (DWORD)lParam); else - CB_DestroyAllButtons(hwndDlg); + CB_DestroyAllButtons(); break; case DM_CONFIGURETOOLBAR: - SendMessage(hwndDlg, WM_SIZE, 0, 0); + SendMessage(m_hwnd, WM_SIZE, 0, 0); break; case DM_SMILEYOPTIONSCHANGED: - SendMessage(hwndDlg, GC_REDRAWLOG, 0, 1); + SendMessage(m_hwnd, GC_REDRAWLOG, 0, 1); break; case EM_THEMECHANGED: - DM_FreeTheme(dat); - return DM_ThemeChanged(dat); + DM_FreeTheme(); + DM_ThemeChanged(); + return 0; case WM_DWMCOMPOSITIONCHANGED: - BB_RefreshTheme(dat); - memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS)); - CProxyWindow::verify(dat); + BB_RefreshTheme(); + memset(&pContainer->mOld, -1000, sizeof(MARGINS)); + CProxyWindow::verify(this); break; case DM_ACTIVATEME: - ActivateExistingTab(dat->pContainer, hwndDlg); + ActivateExistingTab(pContainer, m_hwnd); return 0; case DM_ACTIVATETOOLTIP: - if (!IsIconic(dat->pContainer->hwnd) && dat->pContainer->hwndActive == hwndDlg) - dat->Panel->showTip(wParam, lParam); + if (!IsIconic(pContainer->hwnd) && pContainer->hwndActive == m_hwnd) + Panel->showTip(wParam, lParam); break; case DM_SAVEMESSAGELOG: - DM_SaveLogAsRTF(dat); + DM_SaveLogAsRTF(this); return 0; case DM_CHECKAUTOHIDE: - DM_CheckAutoHide(dat, wParam, lParam); + DM_CheckAutoHide(this, wParam, lParam); return 0; - - case WM_NCDESTROY: - if (dat) { - memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS)); - PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1); - delete dat->Panel; - if (dat->pContainer->dwFlags & CNT_SIDEBAR) - dat->pContainer->SideBar->removeSession(dat); - mir_free(dat->enteredText); - mir_free(dat); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); - } - break; - - case WM_DESTROY: - if (si == NULL) - break; - - if (pcli->pfnGetEvent(si->hContact, 0)) - pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); - si->wState &= ~STATE_TALK; - si->hWnd = NULL; - si->dat = NULL; - si->pContainer = NULL; - dat->si = NULL; - - TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0); - - if (!dat->bIsAutosizingInput) - db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); - - if (dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat)) - db_set_w(NULL, CHAT_MODULE, "splitY", (WORD)g_Settings.iSplitterY); - - // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) - if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON) - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); - - DM_FreeTheme(dat); - - UpdateTrayMenuState(dat, FALSE); // remove me from the tray menu (if still there) - if (PluginConfig.g_hMenuTrayUnread) - DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, MF_BYCOMMAND); - - if (dat->hSmileyIcon) - DestroyIcon(dat->hSmileyIcon); - - if (dat->hwndTip) - DestroyWindow(dat->hwndTip); - - if (hCurHyperlinkHand) - DestroyCursor(hCurHyperlinkHand); - - int i = GetTabIndexFromHWND(hwndTab, hwndDlg); - if (i >= 0) { - SendMessage(hwndTab, WM_USER + 100, 0, 0); // clean up tooltip - TabCtrl_DeleteItem(hwndTab, i); - BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0); - dat->iTabID = -1; - } - if (dat->pWnd) { - delete dat->pWnd; - dat->pWnd = 0; - } - if (dat->sbCustom) { - delete dat->sbCustom; - dat->sbCustom = 0; - } - - M.RemoveWindow(hwndDlg); - - TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0); - break; } - return FALSE; + return CTabBaseDlg::DlgProc(uMsg, wParam, lParam); } diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 62a490d9dd..0728b81e00 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -209,7 +209,7 @@ void CContactCache::allocStats() * @param hwnd: window handle * @param dat: _MessageWindowData - window data structure */ -void CContactCache::setWindowData(const HWND hwnd, TWindowData *dat) +void CContactCache::setWindowData(const HWND hwnd, CSrmmWindow *dat) { m_hwnd = hwnd; m_dat = dat; @@ -535,7 +535,7 @@ HICON CContactCache::getIcon(int &iSize) const if (m_dat->dwFlags & MWF_ERRORSTATE) return PluginConfig.g_iconErr; - if (m_dat->mayFlashTab) + if (m_dat->m_bCanFlashTab) return m_dat->iFlashIcon; if (m_dat->si && m_dat->iFlashIcon) { diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 2dfa05670d..d1f7e2ddb2 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -84,13 +84,13 @@ 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(TWindowData*& dat) const { dat = m_dat; return m_hwnd; }
+ __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; }
- __forceinline TWindowData* getDat() const { return m_dat; }
+ __forceinline CSrmmWindow* getDat() const { return m_dat; }
int getStatus(void) const
{
@@ -107,7 +107,7 @@ struct CContactCache : public MZeroedObject void updateMeta();
bool updateUIN();
void updateStatusMsg(const char *szKey = 0);
- void setWindowData(const HWND hwnd = 0, TWindowData *dat = 0);
+ void setWindowData(const HWND hwnd = 0, CSrmmWindow *dat = 0);
void resetMeta();
void closeWindow();
void deletedHandler();
@@ -146,7 +146,7 @@ private: int m_nMax;
int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize;
- TWindowData *m_dat;
+ CSrmmWindow *m_dat;
TSessionStats *m_stats;
TInputHistory *m_history;
DBCachedContact *cc;
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 744f053d2c..910266fc49 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -55,22 +55,22 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) return;
}
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (!dat)
return;
RECT rcWnd;
if (dat->bType == SESSIONTYPE_IM) {
if (dat->Panel->isActive())
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_LOG), &rcWnd);
+ GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
else
- GetWindowRect(dat->hwnd, &rcWnd);
+ GetWindowRect(dat->GetHwnd(), &rcWnd);
}
else {
if (dat->Panel->isActive())
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_CHAT_LOG), &rcWnd);
+ GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
else
- GetWindowRect(dat->hwnd, &rcWnd);
+ GetWindowRect(dat->GetHwnd(), &rcWnd);
}
POINT pt = { rcWnd.left, rcWnd.top };
@@ -81,7 +81,7 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) pContainer->MenuBar->setAero(true);
// bottom part
- GetWindowRect(dat->hwnd, &rcWnd);
+ GetWindowRect(dat->GetHwnd(), &rcWnd);
pt.x = rcWnd.left;
LONG sbar_left, sbar_right;
@@ -447,7 +447,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, RECT rc;
POINT pt;
MCONTACT hContact;
- TWindowData *dat;
+ CTabBaseDlg *dat;
TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
BOOL bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
@@ -612,7 +612,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->MenuBar->getClientRect();
if (pContainer->hwndStatus) {
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)dat);
RECT rcs;
@@ -664,7 +664,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, 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) {
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 1);
}
}
@@ -728,7 +728,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, else nPanel = nm->dwItemSpec;
panel_found:
if (nPanel == 2) {
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
if (dat)
CheckStatusIconClick(dat, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
@@ -786,17 +786,17 @@ panel_found: tci.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, iItem, &tci);
if (tci.lParam && IsWindow((HWND)tci.lParam))
- dat = (TWindowData*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
}
// sent from a sidebar button (RMB click) instead of the tab control
else if (((LPNMHDR)lParam)->idFrom == 5000) {
TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
- dat = const_cast<TWindowData *>(n->dat);
+ dat = const_cast<CTabBaseDlg*>(n->dat);
fFromSidebar = true;
}
if (dat)
- MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
+ dat->MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT);
int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (iSelection >= IDM_CONTAINERMENU) {
@@ -812,7 +812,7 @@ panel_found: switch (iSelection) {
case ID_TABMENU_CLOSETAB:
if (fFromSidebar)
- SendMessage(dat->hwnd, WM_CLOSE, 1, 0);
+ SendMessage(dat->GetHwnd(), WM_CLOSE, 1, 0);
else
SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
break;
@@ -820,18 +820,18 @@ panel_found: CloseOtherTabs(hwndTab, *dat);
break;
case ID_TABMENU_SAVETABPOSITION:
- db_set_dw(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
+ db_set_dw(dat->m_hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
break;
case ID_TABMENU_CLEARSAVEDTABPOSITION:
- db_unset(dat->hContact, SRMSGMOD_T, "tabindex");
+ db_unset(dat->m_hContact, SRMSGMOD_T, "tabindex");
break;
case ID_TABMENU_LEAVECHATROOM:
if (dat && dat->bType == SESSIONTYPE_CHAT) {
SESSION_INFO *si = dat->si;
- if (si && dat->hContact) {
- char *szProto = GetContactProto(dat->hContact);
+ if (si && dat->m_hContact) {
+ char *szProto = GetContactProto(dat->m_hContact);
if (szProto)
- CallProtoService(szProto, PS_LEAVECHAT, dat->hContact, 0);
+ CallProtoService(szProto, PS_LEAVECHAT, dat->m_hContact, 0);
}
}
break;
@@ -862,15 +862,15 @@ panel_found: bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
pContainer->MenuBar->Cancel();
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DWORD dwOldFlags = pContainer->dwFlags;
if (dat) {
if (fProcessContactMenu)
- return Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, dat->hContact);
+ return Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, dat->m_hContact);
if (fProcessMainMenu)
return Clist_MenuProcessCommand(LOWORD(wParam), MPCF_MAINMENU, 0);
- if (MsgWindowMenuHandler(dat, LOWORD(wParam), MENU_PICMENU) == 1)
+ if (dat->MsgWindowMenuHandler(LOWORD(wParam), MENU_PICMENU) == 1)
break;
}
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
@@ -931,7 +931,7 @@ panel_found: case WM_EXITSIZEMOVE:
GetClientRect(hwndTab, &rc);
if (!((rc.right - rc.left) == pContainer->oldSize.cx && (rc.bottom - rc.top) == pContainer->oldSize.cy)) {
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 0);
SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
}
@@ -1006,7 +1006,7 @@ panel_found: if (lParam) { // lParam != 0 means sent by a chat window
wchar_t szText[512];
- dat = (TWindowData*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
GetWindowText((HWND)wParam, szText, _countof(szText));
szText[_countof(szText) - 1] = 0;
SetWindowText(hwndDlg, szText);
@@ -1019,7 +1019,7 @@ panel_found: SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
else
break;
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
}
else {
HWND hwnd = M.FindWindow(wParam);
@@ -1032,7 +1032,7 @@ panel_found: }
hContact = wParam;
if (hwnd && hContact)
- dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
if (dat) {
SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabStatusIcon));
@@ -1052,13 +1052,13 @@ panel_found: PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat && dat->bType == SESSIONTYPE_IM) {
if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
dat->Panel->Invalidate(TRUE);
}
else if (dat)
- SendMessage(dat->hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(dat->GetHwnd(), GC_UPDATESTATUSBAR, 0, 0);
}
break;
@@ -1090,7 +1090,7 @@ panel_found: memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
break;
case SC_MINIMIZE:
- dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
+ dat = reinterpret_cast<CSrmmWindow *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
if (dat) {
GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
@@ -1397,7 +1397,7 @@ panel_found: 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) {
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 0);
}
}
@@ -1497,7 +1497,7 @@ panel_found: case DM_SETICON:
{
- dat = (TWindowData*)wParam;
+ dat = (CSrmmWindow*)wParam;
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
HICON hIconBig = (dat && dat->cache) ? Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus(), true) : 0;
@@ -1567,7 +1567,7 @@ panel_found: {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
if (dis->hwndItem == pContainer->hwndStatus && !(pContainer->dwFlags & CNT_NOSTATUSBAR)) {
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat)
DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
return TRUE;
@@ -1854,11 +1854,11 @@ int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd) }
// enumerates tabs and closes all of them, but the one in dat
-void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
+void TSAPI CloseOtherTabs(HWND hwndTab, CTabBaseDlg &dat)
{
for (int idxt = 0; idxt < dat.pContainer->iChilds;) {
HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt);
- if (otherTab != NULL && otherTab != dat.hwnd)
+ if (otherTab != NULL && otherTab != dat.GetHwnd())
SendMessage(otherTab, WM_CLOSE, 1, 0);
else
++idxt;
@@ -2193,7 +2193,7 @@ void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WP if (bType == SESSIONTYPE_ANY)
SendMessage((HWND)item.lParam, message, wParam, lParam);
else {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
if (dat && dat->bType == bType)
SendMessage((HWND)item.lParam, message, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index f72b9ea871..369ed45b21 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -384,9 +384,9 @@ void CMenuBar::invoke(const int id) m_isContactMenu = m_isMainMenu = false;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
- MCONTACT hContact = dat ? dat->hContact : 0;
+ MCONTACT hContact = dat ? dat->m_hContact : 0;
if (index == 3 && hContact != 0) {
hMenu = Menu_BuildContactMenu(hContact);
@@ -438,7 +438,7 @@ void CMenuBar::Cancel(void) void CMenuBar::updateState(const HMENU hMenu) const
{
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
if (dat) {
::CheckMenuItem(hMenu, ID_VIEW_SHOWMENUBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOMENUBAR ? MF_UNCHECKED : MF_CHECKED);
::CheckMenuItem(hMenu, ID_VIEW_SHOWSTATUSBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOSTATUSBAR ? MF_UNCHECKED : MF_CHECKED);
@@ -477,7 +477,7 @@ void CMenuBar::updateState(const HMENU hMenu) const void CMenuBar::configureMenu() const
{
- TWindowData *dat = (TWindowData*)::GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)::GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
if (dat) {
bool fChat = (dat->bType == SESSIONTYPE_CHAT);
@@ -486,7 +486,7 @@ void CMenuBar::configureMenu() const ::SendMessage(m_hwndToolbar, TB_SETSTATE, 105, fChat ? TBSTATE_HIDDEN : TBSTATE_ENABLED);
if (dat->bType == SESSIONTYPE_IM)
- ::EnableWindow(GetDlgItem(dat->hwnd, IDC_TIME), TRUE);
+ ::EnableWindow(GetDlgItem(dat->GetHwnd(), IDC_TIME), TRUE);
}
}
@@ -673,7 +673,7 @@ RECT rcLastStatusBarClick; // remembers click (down event) point for status b LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(GetParent(hWnd), GWLP_USERDATA);
- TWindowData *dat = NULL;
+ CSrmmWindow *dat = NULL;
POINT pt;
if (OldStatusBarproc == 0) {
@@ -732,7 +732,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR HANDLE hTheme = bAero ? OpenThemeData(hWnd, L"ButtonStyle") : 0;
if (pContainer)
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
RECT rcClient;
GetClientRect(hWnd, &rcClient);
@@ -837,7 +837,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR wchar_t szText[1024]; szText[0] = 0;
LRESULT result = SendMessage(hWnd, SB_GETTEXT, i, (LPARAM)szText);
if (i == 2 && pContainer) {
- TWindowData *pDat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ CSrmmWindow *pDat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (pDat)
DrawStatusIcons(pDat, hdcMem, itemRect, 2);
}
@@ -885,9 +885,9 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR case WM_USER + 101:
{
int list_icons = 0;
- dat = (TWindowData*)lParam;
+ dat = (CSrmmWindow*)lParam;
if (dat)
- while (Srmm_GetNthIcon(dat->hContact, list_icons))
+ while (Srmm_GetNthIcon(dat->m_hContact, list_icons))
list_icons++;
SendMessage(hWnd, WM_SIZE, 0, 0);
@@ -948,7 +948,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR GetCursorPos(&pt);
if (pt.x != ptMouse.x || pt.y != ptMouse.y)
break;
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat != NULL) {
RECT rc;
SIZE size;
@@ -960,7 +960,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR SendMessage(hWnd, SB_GETRECT, 2, (LPARAM)&rc);
if (PtInRect(&rc, pt)) {
unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + 2);
- StatusIconData *sid = Srmm_GetNthIcon(dat->hContact, iconNum);
+ StatusIconData *sid = Srmm_GetNthIcon(dat->m_hContact, iconNum);
if (sid == NULL)
break;
@@ -970,7 +970,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
else if (sid->dwId == MSG_ICON_UTN && (dat->bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS)) {
- int mtnStatus = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
+ int mtnStatus = db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
mir_snwprintf(wBuf, TranslateT("Sending typing notifications is %s."),
mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
}
@@ -989,10 +989,10 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (PtInRect(&rc, pt)) {
int iLength = 0;
GETTEXTLENGTHEX gtxl = { 0 };
- int iQueued = db_get_dw(dat->hContact, "SendLater", "count", 0);
+ int iQueued = db_get_dw(dat->m_hContact, "SendLater", "count", 0);
gtxl.codepage = CP_UTF8;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- iLength = SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
+ iLength = SendDlgItemMessage(dat->GetHwnd(), dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
tooltip_active = TRUE;
const wchar_t *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
@@ -1010,7 +1010,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (PtInRect(&rc, pt) && ((rc.right - rc.left) < size.cx)) {
if (dat->bType == SESSIONTYPE_CHAT) {
- ptrW tszTopic(db_get_wsa(dat->hContact, dat->szProto, "Topic"));
+ ptrW tszTopic(db_get_wsa(dat->m_hContact, dat->szProto, "Topic"));
if (tszTopic != NULL) {
tooltip_active = TRUE;
CallService("mToolTip/ShowTipW", tszTopic, (LPARAM)&ti);
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index dca01dc9c6..45b446550f 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -653,9 +653,9 @@ static int TSAPI PopupPreview(NEN_OPTIONS *pluginOptions) // updates the menu entry...
// bForced is used to only update the status, nickname etc. and does NOT update the unread count
-void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced)
+void TSAPI UpdateTrayMenuState(CTabBaseDlg *dat, BOOL bForced)
{
- if (PluginConfig.g_hMenuTrayUnread == 0 || dat->hContact == NULL)
+ if (PluginConfig.g_hMenuTrayUnread == 0 || dat->m_hContact == NULL)
return;
MENUITEMINFO mii = { 0 };
@@ -665,7 +665,7 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced) const wchar_t *tszProto = dat->cache->getRealAccount();
assert(tszProto != 0);
- GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, FALSE, &mii);
+ GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->m_hContact, FALSE, &mii);
if (!bForced)
PluginConfig.m_UnreadInTray -= (mii.dwItemData & 0x0000ffff);
if (mii.dwItemData > 0 || bForced) {
@@ -680,11 +680,11 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced) mii.cch = (int)mir_wstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
- SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, FALSE, &mii);
+ SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->m_hContact, FALSE, &mii);
}
// if we want tray support, add the contact to the list of unread sessions in the tray menu
-int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent)
+int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent)
{
if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == NULL)
return 0;
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index dd3532fbdb..631ad8de83 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -50,7 +50,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int TSAPI NEN_ReadOptions(NEN_OPTIONS *options);
int TSAPI NEN_WriteOptions(NEN_OPTIONS *options);
-int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent);
+int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent);
void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask);
/*
@@ -59,7 +59,7 @@ void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask); void TSAPI CreateSystrayIcon(int create);
void TSAPI FlashTrayIcon(HICON hIcon);
-void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced);
+void TSAPI UpdateTrayMenuState(CTabBaseDlg *dat, BOOL bForced);
void TSAPI LoadFavoritesAndRecent();
void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, const char *szProto, wchar_t *szStatus,
WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu);
@@ -83,7 +83,7 @@ TContainerData* TSAPI FindContainerByName(const wchar_t *name); int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd);
HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx);
int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt);
-void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat);
+void TSAPI CloseOtherTabs(HWND hwndTab, CTabBaseDlg &dat);
int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd);
void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc);
void TSAPI ReflashContainer(TContainerData *pContainer);
@@ -117,13 +117,10 @@ void TSAPI CacheLogFonts(); void TSAPI LoadIconTheme();
void TSAPI RTF_CTableInit();
-INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
int TSAPI InitOptions(void);
int TSAPI DbEventIsShown(DBEVENTINFO *dbei);
-void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s);
void TSAPI LoadLogfont(int i, LOGFONTA *lf, COLORREF *colour, char *szModule);
// custom tab control
@@ -143,20 +140,16 @@ int TSAPI UnloadTSButtonModule(); int _DebugTraceW(const wchar_t *fmt, ...);
#endif
int _DebugPopup(MCONTACT hContact, const wchar_t *fmt, ...);
-int _DebugMessage(HWND hwndDlg, TWindowData *dat, const char *fmt, ...);
+int _DebugMessage(HWND hwndDlg, CSrmmWindow *dat, const char *fmt, ...);
// themes
const wchar_t* TSAPI GetThemeFileName(int iMode);
int TSAPI CheckThemeVersion(const wchar_t *szIniFilename);
-void TSAPI WriteThemeToINI(const wchar_t *szIniFilename, TWindowData *dat);
+void TSAPI WriteThemeToINI(const wchar_t *szIniFilename, CSrmmWindow *dat);
void TSAPI ReadThemeFromINI(const wchar_t *szIniFilename, TContainerData *dat, int noAdvanced, DWORD dwFlags);
-// user prefs
-
-int TSAPI LoadLocalFlags(TWindowData *dat);
-
-//TypingNotify
+// TypingNotify
int TN_ModuleInit();
int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam);
int TN_ModuleDeInit();
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 1df30b4efd..81a2ec967d 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -33,12 +33,12 @@ ///////////////////////////////////////////////////////////////////////////////////////// // Save message log for given session as RTF document -void TSAPI DM_SaveLogAsRTF(const TWindowData *dat) +void TSAPI DM_SaveLogAsRTF(const CTabBaseDlg *dat) { if (dat && dat->hwndIEView != 0) { IEVIEWEVENT event = { sizeof(event) }; event.hwnd = dat->hwndIEView; - event.hContact = dat->hContact; + event.hContact = dat->m_hContact; event.iType = IEE_SAVE_DOCUMENT; CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event); } @@ -55,7 +55,7 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat) OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = dat->hwnd; + ofn.hwndOwner = dat->GetHwnd(); ofn.lpstrFile = szFilename; ofn.lpstrFilter = szFilter; ofn.lpstrInitialDir = szInitialDir; @@ -67,7 +67,7 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat) stream.dwCookie = (DWORD_PTR)szFilename; stream.dwError = 0; stream.pfnCallback = Utils::StreamOut; - SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG, EM_STREAMOUT, SF_RTF | SF_USECODEPAGE, (LPARAM)&stream); + SendDlgItemMessage(dat->GetHwnd(), dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG, EM_STREAMOUT, SF_RTF | SF_USECODEPAGE, (LPARAM)&stream); } } } @@ -82,12 +82,12 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat) // // If no session in the container disagrees, the container will be hidden. -void TSAPI DM_CheckAutoHide(const TWindowData *dat, WPARAM wParam, LPARAM lParam) +void TSAPI DM_CheckAutoHide(const CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) { if (dat && lParam) { BOOL *fResult = (BOOL*)lParam; - if (GetWindowTextLength(GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE)) > 0) { + if (GetWindowTextLength(GetDlgItem(dat->GetHwnd(), dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_MESSAGE)) > 0) { *fResult = FALSE; return; // text entered in the input area -> prevent autohide/cose } @@ -103,7 +103,7 @@ void TSAPI DM_CheckAutoHide(const TWindowData *dat, WPARAM wParam, LPARAM lParam ///////////////////////////////////////////////////////////////////////////////////////// // checks if the balloon tooltip can be dismissed (usually called by WM_MOUSEMOVE events) -void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt) +void TSAPI DM_DismissTip(CTabBaseDlg *dat, const POINT& pt) { if (!IsWindowVisible(dat->hwndTip)) return; @@ -122,21 +122,21 @@ void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt) ///////////////////////////////////////////////////////////////////////////////////////// // initialize the balloon tooltip for message window notifications -void TSAPI DM_InitTip(TWindowData *dat) +void CTabBaseDlg::DM_InitTip() { - dat->hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, dat->hwnd, NULL, g_hInst, (LPVOID)NULL); - - memset(&dat->ti, 0, sizeof(dat->ti)); - dat->ti.cbSize = sizeof(dat->ti); - dat->ti.lpszText = TranslateT("No status message"); - dat->ti.hinst = g_hInst; - dat->ti.hwnd = dat->hwnd; - dat->ti.uFlags = TTF_TRACK | TTF_IDISHWND | TTF_TRANSPARENT; - dat->ti.uId = (UINT_PTR)dat->hwnd; - SendMessage(dat->hwndTip, TTM_ADDTOOL, 0, (LPARAM)&dat->ti); - - SetWindowPos(dat->hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); + hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, m_hwnd, NULL, g_hInst, (LPVOID)NULL); + + memset(&ti, 0, sizeof(ti)); + ti.cbSize = sizeof(ti); + ti.lpszText = TranslateT("No status message"); + ti.hinst = g_hInst; + ti.hwnd = m_hwnd; + ti.uFlags = TTF_TRACK | TTF_IDISHWND | TTF_TRANSPARENT; + ti.uId = (UINT_PTR)m_hwnd; + SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti); + + SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -144,14 +144,14 @@ void TSAPI DM_InitTip(TWindowData *dat) // // returns 1 for handled hotkeys, 0 otherwise. -LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat) +LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, CTabBaseDlg *dat) { LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)message, (LPARAM)TABSRMM_HK_SECTION_GENERIC); - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->GetHwnd(); switch (mim_hotkey_check) { case TABSRMM_HK_PASTEANDSEND: - HandlePasteAndSend(dat); + dat->HandlePasteAndSend(); return 1; case TABSRMM_HK_HISTORY: SendMessage(hwndDlg, WM_COMMAND, IDC_HISTORY, 0); @@ -175,7 +175,7 @@ LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat) SendMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 0); return 1; case TABSRMM_HK_CLEARLOG: - ClearLog(dat); + dat->ClearLog(); return 1; case TABSRMM_HK_TOGGLESIDEBAR: if (dat->pContainer->SideBar->isActive()) @@ -188,7 +188,7 @@ LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat) return 0; } -LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, TWindowData *dat, UINT cmd, WPARAM wParam, LPARAM lParam) +LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, CTabBaseDlg *dat, UINT cmd, WPARAM wParam, LPARAM lParam) { RECT rc; HWND hwndContainer = pContainer->hwnd; @@ -261,23 +261,23 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T break; case IDC_HISTORY: - CallService(MS_HISTORY_SHOWCONTACTHISTORY, dat->hContact, 0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, dat->m_hContact, 0); break; case IDC_TIME: submenu = GetSubMenu(PluginConfig.g_hMenuContext, 2); - MsgWindowUpdateMenu(dat, submenu, MENU_LOGMENU); + dat->MsgWindowUpdateMenu(submenu, MENU_LOGMENU); GetWindowRect(GetDlgItem(hwndDlg, IDC_TIME), &rc); iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL); - return MsgWindowMenuHandler(dat, iSelection, MENU_LOGMENU); + return dat->MsgWindowMenuHandler(iSelection, MENU_LOGMENU); case IDC_PROTOMENU: - if (dat->hContact) { + if (dat->m_hContact) { submenu = GetSubMenu(PluginConfig.g_hMenuContext, 4); int iOldGlobalSendFormat = PluginConfig.m_SendFormat; - int iLocalFormat = M.GetDword(dat->hContact, "sendformat", 0); + int iLocalFormat = M.GetDword(dat->m_hContact, "sendformat", 0); int iNewLocalFormat = iLocalFormat; GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc); @@ -297,18 +297,18 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T switch (iSelection) { case ID_MODE_GLOBAL: dat->dwFlagsEx &= ~(MWF_SHOW_SPLITTEROVERRIDE); - db_set_b(dat->hContact, SRMSGMOD_T, "splitoverride", 0); - LoadSplitter(dat); - AdjustBottomAvatarDisplay(dat); - DM_RecalcPictureSize(dat); + db_set_b(dat->m_hContact, SRMSGMOD_T, "splitoverride", 0); + dat->LoadSplitter(); + dat->AdjustBottomAvatarDisplay(); + dat->DM_RecalcPictureSize(); SendMessage(hwndDlg, WM_SIZE, 0, 0); break; case ID_MODE_PRIVATE: dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE; - db_set_b(dat->hContact, SRMSGMOD_T, "splitoverride", 1); - LoadSplitter(dat); - AdjustBottomAvatarDisplay(dat); - DM_RecalcPictureSize(dat); + db_set_b(dat->m_hContact, SRMSGMOD_T, "splitoverride", 1); + dat->LoadSplitter(); + dat->AdjustBottomAvatarDisplay(); + dat->DM_RecalcPictureSize(); SendMessage(hwndDlg, WM_SIZE, 0, 0); break; case ID_GLOBAL_BBCODE: @@ -328,14 +328,14 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T break; } if (iNewLocalFormat == 0) - db_unset(dat->hContact, SRMSGMOD_T, "sendformat"); + db_unset(dat->m_hContact, SRMSGMOD_T, "sendformat"); else if (iNewLocalFormat != iLocalFormat) - db_set_dw(dat->hContact, SRMSGMOD_T, "sendformat", iNewLocalFormat); + db_set_dw(dat->m_hContact, SRMSGMOD_T, "sendformat", iNewLocalFormat); if (PluginConfig.m_SendFormat != iOldGlobalSendFormat) db_set_b(0, SRMSGMOD_T, "sendformat", (BYTE)PluginConfig.m_SendFormat); if (iNewLocalFormat != iLocalFormat || PluginConfig.m_SendFormat != iOldGlobalSendFormat) { - dat->SendFormat = M.GetDword(dat->hContact, "sendformat", PluginConfig.m_SendFormat); + dat->SendFormat = M.GetDword(dat->m_hContact, "sendformat", PluginConfig.m_SendFormat); if (dat->SendFormat == -1) // per contact override to disable it.. dat->SendFormat = 0; M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); @@ -361,12 +361,12 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T switch (iSelection) { case ID_FAVORITES_ADDCONTACTTOFAVORITES: - db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 1); - AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getProto(), dat->szStatus, dat->wStatus, Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 1, PluginConfig.g_hMenuFavorites); + db_set_b(dat->m_hContact, SRMSGMOD_T, "isFavorite", 1); + AddContactToFavorites(dat->m_hContact, dat->cache->getNick(), dat->cache->getProto(), dat->szStatus, dat->wStatus, Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 1, PluginConfig.g_hMenuFavorites); break; case ID_FAVORITES_REMOVECONTACTFROMFAVORITES: - db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 0); - DeleteMenu(PluginConfig.g_hMenuFavorites, (UINT_PTR)dat->hContact, MF_BYCOMMAND); + db_set_b(dat->m_hContact, SRMSGMOD_T, "isFavorite", 0); + DeleteMenu(PluginConfig.g_hMenuFavorites, (UINT_PTR)dat->m_hContact, MF_BYCOMMAND); break; } dat->cache->updateFavorite(); @@ -393,12 +393,12 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T case ID_SENDMENU_SENDTOMULTIPLEUSERS: dat->sendMode ^= SMODE_MULTIPLE; if (dat->sendMode & SMODE_MULTIPLE) - DM_CreateClist(dat); + dat->DM_CreateClist(); else if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST))) DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST)); break; case ID_SENDMENU_SENDNUDGE: - SendNudge(dat); + dat->SendNudge(); break; case ID_SENDMENU_SENDDEFAULT: dat->sendMode = 0; @@ -416,12 +416,12 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T case ID_SENDMENU_SENDWITHOUTTIMEOUTS: dat->sendMode ^= SMODE_NOACK; if (dat->sendMode & SMODE_NOACK) - db_set_b(dat->hContact, SRMSGMOD_T, "no_ack", 1); + db_set_b(dat->m_hContact, SRMSGMOD_T, "no_ack", 1); else - db_unset(dat->hContact, SRMSGMOD_T, "no_ack"); + db_unset(dat->m_hContact, SRMSGMOD_T, "no_ack"); break; } - db_set_b(dat->hContact, SRMSGMOD_T, "no_ack", (BYTE)(dat->sendMode & SMODE_NOACK ? 1 : 0)); + db_set_b(dat->m_hContact, SRMSGMOD_T, "no_ack", (BYTE)(dat->sendMode & SMODE_NOACK ? 1 : 0)); SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); if (dat->sendMode & SMODE_MULTIPLE || dat->sendMode & SMODE_CONTAINER) { SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | @@ -466,7 +466,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T DBVARIANT dbv = { 0 }; - if (0 == db_get_ws(dat->hContact, "UserInfo", "MyNotes", &dbv)) { + if (0 == db_get_ws(dat->m_hContact, "UserInfo", "MyNotes", &dbv)) { SetDlgItemText(hwndDlg, IDC_MESSAGE, dbv.ptszVal); mir_free(dbv.ptszVal); } @@ -476,7 +476,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T wchar_t *buf = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_MESSAGE, buf, iLen + 1); - db_set_ws(dat->hContact, "UserInfo", "MyNotes", buf); + db_set_ws(dat->m_hContact, "UserInfo", "MyNotes", buf); SetDlgItemText(hwndDlg, IDC_MESSAGE, L""); if (!dat->bIsAutosizingInput) { @@ -494,11 +494,11 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T break; case IDM_CLEAR: - ClearLog(dat); + dat->ClearLog(); break; case IDC_PROTOCOL: - submenu = Menu_BuildContactMenu(dat->hContact); + submenu = Menu_BuildContactMenu(dat->m_hContact); if (lParam == 0) GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc); else @@ -506,7 +506,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL); if (iSelection) - Clist_MenuProcessCommand(LOWORD(iSelection), MPCF_CONTACTMENU, dat->hContact); + Clist_MenuProcessCommand(LOWORD(iSelection), MPCF_CONTACTMENU, dat->m_hContact); DestroyMenu(submenu); break; @@ -525,14 +525,14 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T break; case IDC_SELFTYPING: - if (dat->hContact) { - int iCurrentTypingMode = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); + if (dat->m_hContact) { + int iCurrentTypingMode = db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && iCurrentTypingMode) { - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); + dat->DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF; } - db_set_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)!iCurrentTypingMode); + db_set_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)!iCurrentTypingMode); } break; @@ -587,7 +587,7 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA return 0; HWND hwndDlg = pContainer->hwnd; - TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); + CTabBaseDlg *dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); switch (cmd) { case IDC_CLOSE: @@ -698,7 +698,7 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA case ID_MESSAGELOGSETTINGS_FORTHISCONTACT: case ID_MESSAGELOGSETTINGS_GLOBAL: if (dat) { - MsgWindowMenuHandler(dat, (int)LOWORD(wParam), MENU_LOGMENU); + dat->MsgWindowMenuHandler((int)LOWORD(wParam), MENU_LOGMENU); return 1; } break; @@ -717,12 +717,12 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA // initialize rich edit control (log and edit control) for both MUC and // standard IM session windows. -void TSAPI DM_InitRichEdit(TWindowData *dat) +void TSAPI DM_InitRichEdit(CTabBaseDlg *dat) { bool fIsChat = ((dat->bType == SESSIONTYPE_CHAT) ? true : false); - HWND hwndLog = GetDlgItem(dat->hwnd, !fIsChat ? IDC_LOG : IDC_CHAT_LOG); - HWND hwndEdit = GetDlgItem(dat->hwnd, !fIsChat ? IDC_MESSAGE : IDC_CHAT_MESSAGE); - HWND hwndDlg = dat->hwnd; + HWND hwndLog = GetDlgItem(dat->GetHwnd(), !fIsChat ? IDC_LOG : IDC_LOG); + HWND hwndEdit = GetDlgItem(dat->GetHwnd(), !fIsChat ? IDC_MESSAGE : IDC_MESSAGE); + HWND hwndDlg = dat->GetHwnd(); dat->inputbg = fIsChat ? M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR) : dat->pContainer->theme.inputbg; COLORREF colour = fIsChat ? g_Settings.crLogBackground : dat->pContainer->theme.bg; @@ -824,17 +824,17 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) ///////////////////////////////////////////////////////////////////////////////////////// // set the states of defined database action buttons(only if button is a toggle) -void TSAPI DM_SetDBButtonStates(HWND hwndChild, TWindowData *dat) +void CTabBaseDlg::DM_SetDBButtonStates() { - ButtonItem *buttonItem = dat->pContainer->buttonItems; - MCONTACT hContact = dat->hContact, hFinalContact = 0; - HWND hwndContainer = dat->pContainer->hwnd; + ButtonItem *buttonItem = pContainer->buttonItems; + MCONTACT hFinalContact = 0; + HWND hwndContainer = pContainer->hwnd; while (buttonItem) { HWND hWnd = GetDlgItem(hwndContainer, buttonItem->uId); if (buttonItem->pfnCallback) - buttonItem->pfnCallback(buttonItem, hwndChild, dat, hWnd); + buttonItem->pfnCallback(buttonItem, m_hwnd, this, hWnd); if (!(buttonItem->dwFlags & BUTTON_ISTOGGLE && buttonItem->dwFlags & BUTTON_ISDBACTION)) { buttonItem = buttonItem->nextItem; @@ -845,14 +845,14 @@ void TSAPI DM_SetDBButtonStates(HWND hwndChild, TWindowData *dat) char *szModule = buttonItem->szModule; char *szSetting = buttonItem->szSetting; if (buttonItem->dwFlags & BUTTON_DBACTIONONCONTACT || buttonItem->dwFlags & BUTTON_ISCONTACTDBACTION) { - if (hContact == 0) { + if (m_hContact == 0) { SendMessage(hWnd, BM_SETCHECK, BST_UNCHECKED, 0); buttonItem = buttonItem->nextItem; continue; } if (buttonItem->dwFlags & BUTTON_ISCONTACTDBACTION) - szModule = GetContactProto(hContact); - hFinalContact = hContact; + szModule = GetContactProto(m_hContact); + hFinalContact = m_hContact; } else hFinalContact = 0; @@ -877,7 +877,7 @@ void TSAPI DM_SetDBButtonStates(HWND hwndChild, TWindowData *dat) } } -void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam) +void TSAPI DM_ScrollToBottom(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) { if (dat == NULL) return; @@ -889,15 +889,15 @@ void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam) dat->dwFlags |= MWF_DEFERREDSCROLL; if (dat->hwndIEView) { - PostMessage(dat->hwnd, DM_SCROLLIEVIEW, 0, 0); + PostMessage(dat->GetHwnd(), DM_SCROLLIEVIEW, 0, 0); return; } if (dat->hwndHPP) { - SendMessage(dat->hwnd, DM_SCROLLIEVIEW, 0, 0); + SendMessage(dat->GetHwnd(), DM_SCROLLIEVIEW, 0, 0); return; } - HWND hwnd = GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG); + HWND hwnd = GetDlgItem(dat->GetHwnd(), dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG); if (lParam) SendMessage(hwnd, WM_SIZE, 0, 0); @@ -927,7 +927,7 @@ static void LoadKLThread(LPVOID _param) } } -void TSAPI DM_LoadLocale(TWindowData *dat) +void TSAPI DM_LoadLocale(CTabBaseDlg *dat) { if (dat == NULL || !PluginConfig.m_bAutoLocaleSupport) return; @@ -936,7 +936,7 @@ void TSAPI DM_LoadLocale(TWindowData *dat) return; DBVARIANT dbv; - if (!db_get_ws(dat->hContact, SRMSGMOD_T, "locale", &dbv)) + if (!db_get_ws(dat->m_hContact, SRMSGMOD_T, "locale", &dbv)) db_free(&dbv); else { wchar_t szKLName[KL_NAMELENGTH + 1]; @@ -944,38 +944,35 @@ void TSAPI DM_LoadLocale(TWindowData *dat) wchar_t szBuf[20]; GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, szBuf, 20); mir_snwprintf(szKLName, L"0000%s", szBuf); - db_set_ws(dat->hContact, SRMSGMOD_T, "locale", szKLName); + db_set_ws(dat->m_hContact, SRMSGMOD_T, "locale", szKLName); } else { GetKeyboardLayoutName(szKLName); - db_set_ws(dat->hContact, SRMSGMOD_T, "locale", szKLName); + db_set_ws(dat->m_hContact, SRMSGMOD_T, "locale", szKLName); } } - mir_forkthread(LoadKLThread, (void*)dat->hContact); + mir_forkthread(LoadKLThread, (void*)dat->m_hContact); } -LRESULT TSAPI DM_RecalcPictureSize(TWindowData *dat) +void CTabBaseDlg::DM_RecalcPictureSize() { - if (dat) { - HBITMAP hbm = ((dat->Panel->isActive()) && dat->pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown); - if (hbm) { - BITMAP bminfo; - GetObject(hbm, sizeof(bminfo), &bminfo); - CalcDynamicAvatarSize(dat, &bminfo); - SendMessage(dat->hwnd, WM_SIZE, 0, 0); - } - else dat->pic.cy = dat->pic.cx = 60; + HBITMAP hbm = ((Panel->isActive()) && pContainer->avatarMode != 3) ? hOwnPic : (ace ? ace->hbmPic : PluginConfig.g_hbmUnknown); + if (hbm) { + BITMAP bminfo; + GetObject(hbm, sizeof(bminfo), &bminfo); + CalcDynamicAvatarSize(&bminfo); + SendMessage(m_hwnd, WM_SIZE, 0, 0); } - return 0; + else pic.cy = pic.cx = 60; } -void TSAPI DM_UpdateLastMessage(const TWindowData *dat) +void TSAPI DM_UpdateLastMessage(const CTabBaseDlg *dat) { if (dat == NULL) return; - if (dat->pContainer->hwndStatus == 0 || dat->pContainer->hwndActive != dat->hwnd) + if (dat->pContainer->hwndStatus == 0 || dat->pContainer->hwndActive != dat->GetHwnd()) return; wchar_t szBuf[100]; @@ -1010,20 +1007,20 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) ///////////////////////////////////////////////////////////////////////////////////////// // save current keyboard layout for the given contact -void TSAPI DM_SaveLocale(TWindowData *dat, WPARAM, LPARAM lParam) +void TSAPI DM_SaveLocale(CTabBaseDlg *dat, WPARAM, LPARAM lParam) { if (dat == NULL) return; - if (PluginConfig.m_bAutoLocaleSupport && dat->hContact && dat->pContainer->hwndActive == dat->hwnd) { + if (PluginConfig.m_bAutoLocaleSupport && dat->m_hContact && dat->pContainer->hwndActive == dat->GetHwnd()) { wchar_t szKLName[KL_NAMELENGTH + 1]; if ((HKL)lParam != dat->hkl) { dat->hkl = (HKL)lParam; ActivateKeyboardLayout(dat->hkl, 0); GetKeyboardLayoutName(szKLName); - db_set_ws(dat->hContact, SRMSGMOD_T, "locale", szKLName); - GetLocaleID(dat, szKLName); - UpdateReadChars(dat); + db_set_ws(dat->m_hContact, SRMSGMOD_T, "locale", szKLName); + dat->GetLocaleID(szKLName); + dat->UpdateReadChars(); } } } @@ -1052,18 +1049,17 @@ LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM w ///////////////////////////////////////////////////////////////////////////////////////// // create embedded contact list control -HWND TSAPI DM_CreateClist(TWindowData *dat) +HWND CTabBaseDlg::DM_CreateClist() { if (!sendLater->isAvail()) { 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.")); - dat->sendMode &= ~SMODE_MULTIPLE; + sendMode &= ~SMODE_MULTIPLE; return 0; } - HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, - 184, 0, 30, 30, dat->hwnd, (HMENU)IDC_CLIST, g_hInst, NULL); + HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, 184, 0, 30, 30, m_hwnd, (HMENU)IDC_CLIST, g_hInst, NULL); SendMessage(hwndClist, WM_TIMER, 14, 0); - HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, dat->hContact, 0); + HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, m_hContact, 0); SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) & ~CLS_EX_TRACKSELECT); SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) | (CLS_EX_NOSMOOTHSCROLLING | CLS_EX_NOTRANSLUCENTSEL)); @@ -1083,10 +1079,10 @@ HWND TSAPI DM_CreateClist(TWindowData *dat) return hwndClist; } -LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwdat, WPARAM wParam, LPARAM lParam) +LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, CTabBaseDlg *mwdat, WPARAM wParam, LPARAM lParam) { - UINT uID = mwdat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG; - UINT uIDMsg = mwdat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE; + UINT uID = mwdat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG; + UINT uIDMsg = mwdat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_MESSAGE; POINT pt; GetCursorPos(&pt); @@ -1108,9 +1104,9 @@ LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwda } if (mwdat->bType == SESSIONTYPE_CHAT) { // scroll nick list by just hovering it RECT rcNicklist; - GetWindowRect(GetDlgItem(mwdat->hwnd, IDC_LIST), &rcNicklist); + GetWindowRect(GetDlgItem(mwdat->GetHwnd(), IDC_LIST), &rcNicklist); if (PtInRect(&rcNicklist, pt)) { - SendDlgItemMessage(mwdat->hwnd, IDC_LIST, WM_MOUSEWHEEL, wParam, lParam); + SendDlgItemMessage(mwdat->GetHwnd(), IDC_LIST, WM_MOUSEWHEEL, wParam, lParam); return 0; } } @@ -1145,70 +1141,63 @@ LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwda return 1; } -void TSAPI DM_FreeTheme(TWindowData *dat) +void CTabBaseDlg::DM_FreeTheme() { - if (dat == NULL) - return; - - if (dat->hTheme) { - CloseThemeData(dat->hTheme); - dat->hTheme = 0; + if (hTheme) { + CloseThemeData(hTheme); + hTheme = 0; } - if (dat->hThemeIP) { - CloseThemeData(dat->hThemeIP); - dat->hThemeIP = 0; + if (hThemeIP) { + CloseThemeData(hThemeIP); + hThemeIP = 0; } - if (dat->hThemeToolbar) { - CloseThemeData(dat->hThemeToolbar); - dat->hThemeToolbar = 0; + if (hThemeToolbar) { + CloseThemeData(hThemeToolbar); + hThemeToolbar = 0; } } -LRESULT TSAPI DM_ThemeChanged(TWindowData *dat) +void CTabBaseDlg::DM_ThemeChanged() { CSkinItem *item_log = &SkinItems[ID_EXTBKHISTORY]; CSkinItem *item_msg = &SkinItems[ID_EXTBKINPUTAREA]; - HWND hwnd = dat->hwnd; - - dat->hTheme = OpenThemeData(hwnd, L"EDIT"); + hTheme = OpenThemeData(m_hwnd, L"EDIT"); - if (dat->bType == SESSIONTYPE_IM) { - if (dat->hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) - SetWindowLongPtr(GetDlgItem(hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); - if (dat->hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) - SetWindowLongPtr(GetDlgItem(hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwnd, IDC_MESSAGE), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); + if (bType == SESSIONTYPE_IM) { + if (hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) + SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); + if (hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) + SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); } else { - if (dat->hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) { - SetWindowLongPtr(GetDlgItem(hwnd, IDC_CHAT_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwnd, IDC_CHAT_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); - SetWindowLongPtr(GetDlgItem(hwnd, IDC_LIST), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwnd, IDC_LIST), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); + if (hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) { + SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); + SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); } - if (dat->hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) - SetWindowLongPtr(GetDlgItem(hwnd, IDC_CHAT_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwnd, IDC_CHAT_MESSAGE), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); + if (hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) + SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); } - dat->hThemeIP = M.isAero() ? OpenThemeData(hwnd, L"ButtonStyle") : 0; - dat->hThemeToolbar = (M.isAero() || (!CSkin::m_skinEnabled && M.isVSThemed())) ? OpenThemeData(hwnd, L"REBAR") : 0; - - return 0; + hThemeIP = M.isAero() ? OpenThemeData(m_hwnd, L"ButtonStyle") : 0; + hThemeToolbar = (M.isAero() || (!CSkin::m_skinEnabled && M.isVSThemed())) ? OpenThemeData(m_hwnd, L"REBAR") : 0; } ///////////////////////////////////////////////////////////////////////////////////////// // send out message typing notifications (MTN) when the // user is typing/editing text in the message input area. -void TSAPI DM_NotifyTyping(TWindowData *dat, int mode) +void CTabBaseDlg::DM_NotifyTyping(int mode) { - if (dat == NULL || !dat->hContact) + if (!m_hContact) return; - DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_TYPE); + DeletePopupsForContact(m_hContact, PU_REMOVE_ON_TYPE); - const char *szProto = dat->cache->getActiveProto(); - MCONTACT hContact = dat->cache->getActiveContact(); + const char *szProto = cache->getActiveProto(); + MCONTACT hContact = cache->getActiveContact(); // editing user notes or preparing a message for queued delivery -> don't send MTN - if (dat->fEditNotesActive || dat->sendMode & SMODE_SENDLATER) + if (fEditNotesActive || (sendMode & SMODE_SENDLATER)) return; // allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle) @@ -1238,72 +1227,66 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode) // don't send to contacts which are not permanently added to the contact list, // unless the option to ignore added status is set. - if (db_get_b(dat->hContact, "CList", "NotOnList", 0) && !M.GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) + if (db_get_b(m_hContact, "CList", "NotOnList", 0) && !M.GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) return; // End user check - dat->nTypeMode = mode; - CallService(MS_PROTO_SELFISTYPING, hContact, dat->nTypeMode); + nTypeMode = mode; + CallService(MS_PROTO_SELFISTYPING, hContact, nTypeMode); } -void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM, LPARAM lParam) +void CSrmmWindow::DM_OptionsApplied(WPARAM, LPARAM lParam) { - if (dat == NULL) - return; - - HWND hwndDlg = dat->hwnd; - TContainerData *pContainer = dat->pContainer; - - dat->szMicroLf[0] = 0; - if (!(dat->pContainer->theme.isPrivate)) { - LoadThemeDefaults(dat->pContainer); - dat->dwFlags = dat->pContainer->theme.dwFlags; + szMicroLf[0] = 0; + if (!(pContainer->theme.isPrivate)) { + LoadThemeDefaults(pContainer); + dwFlags = pContainer->theme.dwFlags; } - LoadLocalFlags(dat); - LoadTimeZone(dat); + LoadLocalFlags(); + hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY); - dat->bShowUIElements = (pContainer->dwFlags & CNT_HIDETOOLBAR) == 0; + bShowUIElements = (pContainer->dwFlags & CNT_HIDETOOLBAR) == 0; - dat->dwFlagsEx = M.GetByte(dat->hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0; - dat->Panel->getVisibility(); + dwFlagsEx = M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0; + Panel->getVisibility(); // small inner margins (padding) for the text areas - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); + m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); + m_message.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); - GetSendFormat(dat); - SetDialogToType(hwndDlg); - SendMessage(hwndDlg, DM_CONFIGURETOOLBAR, 0, 0); + GetSendFormat(); + SetDialogToType(m_hwnd); + SendMessage(m_hwnd, DM_CONFIGURETOOLBAR, 0, 0); - DM_InitRichEdit(dat); - if (hwndDlg == pContainer->hwndActive) + DM_InitRichEdit(this); + if (m_hwnd == pContainer->hwndActive) SendMessage(pContainer->hwnd, WM_SIZE, 0, 0); - InvalidateRect(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, FALSE); + InvalidateRect(GetDlgItem(m_hwnd, IDC_MESSAGE), NULL, FALSE); if (!lParam) { if (IsIconic(pContainer->hwnd)) - dat->dwFlags |= MWF_DEFERREDREMAKELOG; + dwFlags |= MWF_DEFERREDREMAKELOG; else - SendMessage(hwndDlg, DM_REMAKELOG, 0, 0); + SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); } - ShowWindow(dat->hwndPanelPicParent, SW_SHOW); - EnableWindow(dat->hwndPanelPicParent, TRUE); + ShowWindow(hwndPanelPicParent, SW_SHOW); + EnableWindow(hwndPanelPicParent, TRUE); - SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); + SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0); } - -void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) + +void TSAPI DM_Typing(CTabBaseDlg *dat, bool fForceOff) { if (dat == NULL) return; - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->GetHwnd(); HWND hwndContainer = dat->pContainer->hwnd; HWND hwndStatus = dat->pContainer->hwndStatus; if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - dat->nLastTyping > TIMEOUT_TYPEOFF) - DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); + dat->DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); if (dat->bShowTyping == 1) { if (dat->nTypeSecs > 0) { @@ -1322,7 +1305,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) } SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); HandleIconFeedback(dat, (HICON)-1); - TWindowData *dat_active = (TWindowData*)GetWindowLongPtr(dat->pContainer->hwndActive, GWLP_USERDATA); + CTabBaseDlg *dat_active = (CTabBaseDlg*)GetWindowLongPtr(dat->pContainer->hwndActive, GWLP_USERDATA); if (dat_active && dat_active->bType == SESSIONTYPE_IM) SendMessage(hwndContainer, DM_UPDATETITLE, 0, 0); else @@ -1338,7 +1321,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) dat->szStatusBar[0] = 0; dat->bShowTyping = 0; } - UpdateStatusBar(dat); + dat->UpdateStatusBar(); } else if (dat->nTypeSecs > 0) { mir_snwprintf(dat->szStatusBar, TranslateT("%s is typing a message"), dat->cache->getNick()); @@ -1356,7 +1339,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) } if (dat->pContainer->hwndActive != hwndDlg) { - if (dat->mayFlashTab) + if (dat->m_bCanFlashTab) dat->iFlashIcon = PluginConfig.g_IconTypingEvent; HandleIconFeedback(dat, PluginConfig.g_IconTypingEvent); } @@ -1378,9 +1361,9 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) // This cares about private / per container / MUC <> IM splitter syncing and everything. // called from IM and MUC windows via DM_SPLITTERGLOBALEVENT -int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) +int TSAPI DM_SplitterGlobalEvent(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) { - TWindowData *srcDat = PluginConfig.lastSPlitterPos.pSrcDat; + CTabBaseDlg *srcDat = PluginConfig.lastSPlitterPos.pSrcDat; TContainerData *srcCnt = PluginConfig.lastSPlitterPos.pSrcContainer; bool fCntGlobal = (!dat->pContainer->settings->fPrivate ? true : false); @@ -1388,7 +1371,7 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) return 0; RECT rcWin; - GetWindowRect(dat->hwnd, &rcWin); + GetWindowRect(dat->GetHwnd(), &rcWin); LONG newPos; if (wParam == 0 && lParam == 0) { @@ -1408,7 +1391,7 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (dat->bType == SESSIONTYPE_IM) { dat->pContainer->settings->splitterPos = dat->splitterY; if (fCntGlobal) { - SaveSplitter(dat); + dat->SaveSplitter(); if (PluginConfig.lastSPlitterPos.bSync) g_Settings.iSplitterY = dat->splitterY - DPISCALEY_S(23); } @@ -1437,7 +1420,7 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) // for inactive sessions, delay the splitter repositioning until they become // active (faster, avoid redraw/resize problems for minimized windows) - if (IsIconic(dat->pContainer->hwnd) || dat->pContainer->hwndActive != dat->hwnd) { + if (IsIconic(dat->pContainer->hwnd) || dat->pContainer->hwndActive != dat->GetHwnd()) { dat->dwFlagsEx |= MWF_EX_DELAYEDSPLITTER; dat->wParam = newPos; dat->lParam = PluginConfig.lastSPlitterPos.lParam; @@ -1447,19 +1430,19 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) else newPos = wParam; if (dat->bType == SESSIONTYPE_IM) { - LoadSplitter(dat); - AdjustBottomAvatarDisplay(dat); - DM_RecalcPictureSize(dat); - SendMessage(dat->hwnd, WM_SIZE, 0, 0); + dat->LoadSplitter(); + dat->AdjustBottomAvatarDisplay(); + dat->DM_RecalcPictureSize(); + SendMessage(dat->GetHwnd(), WM_SIZE, 0, 0); DM_ScrollToBottom(dat, 1, 1); if (dat != srcDat) - CSkin::UpdateToolbarBG(dat); + dat->UpdateToolbarBG(); } else { SESSION_INFO *si = dat->si; if (si) { si->iSplitterY = g_Settings.iSplitterY; - SendMessage(dat->hwnd, WM_SIZE, 0, 0); + SendMessage(dat->GetHwnd(), WM_SIZE, 0, 0); } } return 0; @@ -1468,10 +1451,10 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // incoming event handler -void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) +void TSAPI DM_EventAdded(CTabBaseDlg *dat, WPARAM hContact, LPARAM lParam) { TContainerData *pContainer = dat->pContainer; - HWND hwndDlg = dat->hwnd, hwndContainer = pContainer->hwnd, hwndTab = GetParent(dat->hwnd); + HWND hwndDlg = dat->GetHwnd(), hwndContainer = pContainer->hwnd, hwndTab = GetParent(dat->GetHwnd()); MEVENT hDbEvent = (MEVENT)lParam; DBEVENTINFO dbei = {}; @@ -1502,7 +1485,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) // been minimized or in the background. if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) { if (PluginConfig.m_bDividersUsePopupConfig && PluginConfig.m_bUseDividers) { - if (!MessageWindowOpened(dat->hContact, 0)) + if (!MessageWindowOpened(dat->m_hContact, 0)) SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0); } else if (PluginConfig.m_bUseDividers) { @@ -1552,12 +1535,12 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) break; } SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); - dat->mayFlashTab = TRUE; + dat->m_bCanFlashTab = true; } // try to flash the contact list... if (!bDisableNotify) - FlashOnClist(hwndDlg, dat, hDbEvent, &dbei); + dat->FlashOnClist(hDbEvent, &dbei); // autoswitch tab if option is set AND container is minimized (otherwise, we never autoswitch) // never switch for status changes... @@ -1569,7 +1552,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) TabCtrl_SetCurSel(GetParent(hwndDlg), iItem); ShowWindow(pContainer->hwndActive, SW_HIDE); pContainer->hwndActive = hwndDlg; - SendMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0); + SendMessage(hwndContainer, DM_UPDATETITLE, dat->m_hContact, 0); pContainer->dwFlags |= CNT_DEFERREDTABSELECT; } } @@ -1593,7 +1576,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) dat->pWnd->Invalidate(); } -void TSAPI DM_HandleAutoSizeRequest(TWindowData *dat, REQRESIZE* rr) +void TSAPI DM_HandleAutoSizeRequest(CTabBaseDlg *dat, REQRESIZE* rr) { if (dat == NULL || rr == NULL || GetForegroundWindow() != dat->pContainer->hwnd) return; @@ -1614,7 +1597,7 @@ void TSAPI DM_HandleAutoSizeRequest(TWindowData *dat, REQRESIZE* rr) return; RECT rc; - GetClientRect(dat->hwnd, &rc); + GetClientRect(dat->GetHwnd(), &rc); LONG cy = rc.bottom - rc.top; LONG panelHeight = (dat->Panel->isActive() ? dat->Panel->getHeight() : 0); @@ -1626,49 +1609,46 @@ void TSAPI DM_HandleAutoSizeRequest(TWindowData *dat, REQRESIZE* rr) if (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR) dat->dynaSplitter += DPISCALEY_S(22); dat->splitterY = dat->dynaSplitter + DPISCALEY_S(34); - DM_RecalcPictureSize(dat); + dat->DM_RecalcPictureSize(); } else if (dat->si) { dat->si->iSplitterY = (rc.bottom - (rc.bottom - iNewHeight + DPISCALEY_S(3))) + DPISCALEY_S(34); if (!(dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR)) dat->si->iSplitterY -= DPISCALEY_S(22); - SendMessage(dat->hwnd, WM_SIZE, 0, 0); + SendMessage(dat->GetHwnd(), WM_SIZE, 0, 0); } dat->iInputAreaHeight = iNewHeight; - CSkin::UpdateToolbarBG(dat); + dat->UpdateToolbarBG(); DM_ScrollToBottom(dat, 1, 0); } -void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) +void CTabBaseDlg::DM_UpdateTitle(WPARAM, LPARAM lParam) { wchar_t newtitle[128]; - DWORD dwOldIdle = dat->idle; + DWORD dwOldIdle = idle; const char *szActProto = 0; - HWND hwndDlg = dat->hwnd; - HWND hwndTab = GetParent(hwndDlg); - HWND hwndContainer = dat->pContainer->hwnd; - TContainerData *pContainer = dat->pContainer; + HWND hwndContainer = pContainer->hwnd; - dat->szStatus[0] = 0; + szStatus[0] = 0; - if (dat->iTabID == -1) + if (iTabID == -1) return; TCITEM item = { 0 }; - if (dat->hContact) { - const wchar_t *szNick = dat->cache->getNick(); + if (m_hContact) { + const wchar_t *szNick = cache->getNick(); - if (dat->szProto) { - szActProto = dat->cache->getProto(); + if (szProto) { + szActProto = cache->getProto(); - bool bHasName = (dat->cache->getUIN()[0] != 0); - dat->idle = dat->cache->getIdleTS(); - dat->dwFlagsEx = dat->idle ? dat->dwFlagsEx | MWF_SHOW_ISIDLE : dat->dwFlagsEx & ~MWF_SHOW_ISIDLE; + bool bHasName = (cache->getUIN()[0] != 0); + idle = cache->getIdleTS(); + dwFlagsEx = idle ? dwFlagsEx | MWF_SHOW_ISIDLE : dwFlagsEx & ~MWF_SHOW_ISIDLE; - dat->wStatus = dat->cache->getStatus(); - wcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE); + wStatus = cache->getStatus(); + wcsncpy_s(szStatus, pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : wStatus, 0), _TRUNCATE); if (lParam != 0) { wchar_t newcontactname[128]; newcontactname[0] = 0; @@ -1681,7 +1661,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) if (newcontactname[0] != 0) { if (PluginConfig.m_bStatusOnTabs) - mir_snwprintf(newtitle, L"%s (%s)", newcontactname, dat->szStatus); + mir_snwprintf(newtitle, L"%s (%s)", newcontactname, szStatus); else wcsncpy_s(newtitle, newcontactname, _TRUNCATE); } @@ -1689,59 +1669,59 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) item.mask |= TCIF_TEXT; } - SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); + SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0); wchar_t fulluin[256]; - if (dat->bIsMeta) + if (bIsMeta) mir_snwprintf(fulluin, TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."), - bHasName ? dat->cache->getUIN() : TranslateT("No UID")); + bHasName ? cache->getUIN() : TranslateT("No UID")); else mir_snwprintf(fulluin, TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nClick dropdown to change this contact's favorite status."), - bHasName ? dat->cache->getUIN() : TranslateT("No UID")); + bHasName ? cache->getUIN() : TranslateT("No UID")); - SendDlgItemMessage(hwndDlg, IDC_NAME, BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_UNICODE); + SendDlgItemMessage(m_hwnd, IDC_NAME, BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_UNICODE); } } else wcsncpy_s(newtitle, L"Message Session", _TRUNCATE); - if (dat->idle != dwOldIdle || lParam != 0) { + if (idle != dwOldIdle || lParam != 0) { if (item.mask & TCIF_TEXT) { item.pszText = newtitle; - wcsncpy(dat->newtitle, newtitle, _countof(dat->newtitle)); - dat->newtitle[127] = 0; - if (dat->pWnd) - dat->pWnd->updateTitle(dat->cache->getNick()); + wcsncpy(newtitle, newtitle, _countof(newtitle)); + newtitle[127] = 0; + if (pWnd) + pWnd->updateTitle(cache->getNick()); } - if (dat->iTabID >= 0) { - TabCtrl_SetItem(hwndTab, dat->iTabID, &item); + if (iTabID >= 0) { + TabCtrl_SetItem(m_hwndParent, iTabID, &item); if (pContainer->dwFlags & CNT_SIDEBAR) - pContainer->SideBar->updateSession(dat); + pContainer->SideBar->updateSession(this); } - if (pContainer->hwndActive == hwndDlg && lParam) - SendMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0); + if (pContainer->hwndActive == m_hwnd && lParam) + SendMessage(hwndContainer, DM_UPDATETITLE, m_hContact, 0); - UpdateTrayMenuState(dat, TRUE); - if (dat->cache->isFavorite()) - AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus, - Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuFavorites); + UpdateTrayMenuState(this, TRUE); + if (cache->isFavorite()) + AddContactToFavorites(m_hContact, cache->getNick(), szActProto, szStatus, wStatus, + Skin_LoadProtoIcon(cache->getProto(), cache->getStatus()), 0, PluginConfig.g_hMenuFavorites); - if (dat->cache->isRecent()) - AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus, - Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuRecent); + if (cache->isRecent()) + AddContactToFavorites(m_hContact, cache->getNick(), szActProto, szStatus, wStatus, + Skin_LoadProtoIcon(cache->getProto(), cache->getStatus()), 0, PluginConfig.g_hMenuRecent); - dat->Panel->Invalidate(); - if (dat->pWnd) - dat->pWnd->Invalidate(); + Panel->Invalidate(); + if (pWnd) + pWnd->Invalidate(); } // care about MetaContacts and update the statusbar icon with the currently "most online" contact... - if (dat->bIsMeta) { - PostMessage(hwndDlg, DM_UPDATEMETACONTACTINFO, 0, 0); - PostMessage(hwndDlg, DM_OWNNICKCHANGED, 0, 0); + if (bIsMeta) { + PostMessage(m_hwnd, DM_UPDATEMETACONTACTINFO, 0, 0); + PostMessage(m_hwnd, DM_OWNNICKCHANGED, 0, 0); if (pContainer->dwFlags & CNT_UINSTATUSBAR) - DM_UpdateLastMessage(dat); + DM_UpdateLastMessage(this); } } @@ -1763,7 +1743,7 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM) return 0; } -void DrawStatusIcons(TWindowData *dat, HDC hDC, const RECT &rc, int gap) +void DrawStatusIcons(CTabBaseDlg *dat, HDC hDC, const RECT &rc, int gap) { int x = rc.left; int y = (rc.top + rc.bottom - PluginConfig.m_smcxicon) >> 1; @@ -1771,7 +1751,7 @@ void DrawStatusIcons(TWindowData *dat, HDC hDC, const RECT &rc, int gap) SetBkMode(hDC, TRANSPARENT); int nIcon = 0; - while (StatusIconData *si = Srmm_GetNthIcon(dat->hContact, nIcon++)) { + while (StatusIconData *si = Srmm_GetNthIcon(dat->m_hContact, nIcon++)) { if (!mir_strcmp(si->szModule, MSG_ICON_MODULE)) { if (si->dwId == MSG_ICON_SOUND) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_SOUNDS], @@ -1785,7 +1765,7 @@ void DrawStatusIcons(TWindowData *dat, HDC hDC, const RECT &rc, int gap) if (dat->bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); - DrawIconEx(hDC, x, y, db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? + DrawIconEx(hDC, x, y, db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); } else CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], 50); @@ -1811,7 +1791,7 @@ void DrawStatusIcons(TWindowData *dat, HDC hDC, const RECT &rc, int gap) } } -void CheckStatusIconClick(TWindowData *dat, POINT pt, const RECT &rc, int gap, int code) +void CheckStatusIconClick(CTabBaseDlg *dat, POINT pt, const RECT &rc, int gap, int code) { if (dat && (code == NM_CLICK || code == NM_RCLICK)) { POINT ptScreen; @@ -1824,7 +1804,7 @@ void CheckStatusIconClick(TWindowData *dat, POINT pt, const RECT &rc, int gap, i if (dat == NULL) return; - StatusIconData *si = Srmm_GetNthIcon(dat->hContact, iconNum); + StatusIconData *si = Srmm_GetNthIcon(dat->m_hContact, iconNum); if (si == NULL) return; @@ -1858,7 +1838,7 @@ void CheckStatusIconClick(TWindowData *dat, POINT pt, const RECT &rc, int gap, i sicd.dwId = si->dwId; sicd.szModule = si->szModule; sicd.flags = (code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0); - NotifyEventHooks(hHookIconPressedEvt, dat->hContact, (LPARAM)&sicd); + NotifyEventHooks(hHookIconPressedEvt, dat->m_hContact, (LPARAM)&sicd); InvalidateRect(dat->pContainer->hwndStatus, NULL, TRUE); } } diff --git a/plugins/TabSRMM/src/generic_msghandlers.h b/plugins/TabSRMM/src/generic_msghandlers.h index 63a024e2d4..c499a3722b 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.h +++ b/plugins/TabSRMM/src/generic_msghandlers.h @@ -26,32 +26,21 @@ //
// prototypes from generic_msghandlers.c
-void TSAPI DM_SetDBButtonStates(HWND hwndChild, TWindowData *dat);
-HWND TSAPI DM_CreateClist(TWindowData *dat);
-
-void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam);
-void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam);
-void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam);
-void TSAPI DM_LoadLocale(TWindowData *dat);
-void TSAPI DM_SaveLocale(TWindowData *dat, WPARAM wParam, LPARAM lParam);
-void TSAPI DM_UpdateLastMessage(const TWindowData *dat);
+void TSAPI DM_ScrollToBottom(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
+void TSAPI DM_LoadLocale(CTabBaseDlg *dat);
+void TSAPI DM_SaveLocale(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
+void TSAPI DM_UpdateLastMessage(const CTabBaseDlg *dat);
LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT uMsg, WPARAM wParam, LPARAM lParam);
-LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwdat, WPARAM wParam, LPARAM lParam);
-LRESULT TSAPI DM_ThemeChanged(TWindowData *dat);
-void TSAPI DM_Typing(TWindowData *dat, bool fForceOff = false);
-void TSAPI DM_FreeTheme(TWindowData *dat);
-void TSAPI DM_NotifyTyping(TWindowData *dat, int mode);
-int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam);
+LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, CTabBaseDlg *mwdat, WPARAM wParam, LPARAM lParam);
+void TSAPI DM_Typing(CTabBaseDlg *dat, bool fForceOff = false);
+int TSAPI DM_SplitterGlobalEvent(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
-void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam);
-void TSAPI DM_InitRichEdit(TWindowData *dat);
+void TSAPI DM_EventAdded(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
+void TSAPI DM_InitRichEdit(CTabBaseDlg *dat);
LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARAM wParam, LPARAM lParam);
-LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, TWindowData *dat, UINT cmd, WPARAM wParam, LPARAM lParam);
-LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat);
-void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt);
-void TSAPI DM_InitTip(TWindowData *dat);
-void TSAPI DM_HandleAutoSizeRequest(TWindowData *dat, REQRESIZE* rr);
-void TSAPI DM_SaveLogAsRTF(const TWindowData *dat);
-void TSAPI DM_CheckAutoHide(const TWindowData *dat, WPARAM wParam, LPARAM lParam);
-
-LRESULT __stdcall DM_RecalcPictureSize(TWindowData *dat);
+LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, CTabBaseDlg *dat, UINT cmd, WPARAM wParam, LPARAM lParam);
+LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, CTabBaseDlg *dat);
+void TSAPI DM_DismissTip(CTabBaseDlg *dat, const POINT& pt);
+void TSAPI DM_HandleAutoSizeRequest(CTabBaseDlg *dat, REQRESIZE* rr);
+void TSAPI DM_SaveLogAsRTF(const CTabBaseDlg *dat);
+void TSAPI DM_CheckAutoHide(const CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 5706e0d843..7d07841c50 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -413,7 +413,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) PostMessage(hwnd, DM_UPDATESTATUSMSG, 0, 0);
if (fChanged) {
if (c->getStatus() == ID_STATUS_OFFLINE) { // clear typing notification in the status bar when contact goes offline
- TWindowData *dat = c->getDat();
+ CTabBaseDlg *dat = c->getDat();
if (dat) {
dat->nTypeSecs = 0;
dat->bShowTyping = 0;
@@ -557,7 +557,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) if (c == 0)
return;
- TWindowData *dat = c->getDat();
+ CSrmmWindow *dat = c->getDat();
if (dat == NULL || !c->isValid())
return;
@@ -595,7 +595,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.timestamp = time(NULL);
dbei.szModule = (char*)c->getProto();
- StreamInEvents(dat->hwnd, NULL, 1, 1, &dbei);
+ dat->StreamInEvents(NULL, 1, 1, &dbei);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 9e03963b29..1e2d89dd5e 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -32,7 +32,7 @@ struct TSplitterBroadCast {
TContainerData *pSrcContainer;
- TWindowData *pSrcDat;
+ CSrmmWindow *pSrcDat;
LONG pos, pos_chat;
LONG off_chat, off_im;
LPARAM lParam;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index fe31a8c2c6..e62ac00c15 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -117,7 +117,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact) ActivateExistingTab(pContainer, si->hWnd);
if (GetForegroundWindow() != pContainer->hwnd)
SetForegroundWindow(pContainer->hwnd);
- SetFocus(GetDlgItem(pContainer->hwndActive, IDC_CHAT_MESSAGE));
+ SetFocus(GetDlgItem(pContainer->hwndActive, IDC_MESSAGE));
return;
}
}
@@ -202,9 +202,9 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP hWnd = si ? si->hWnd : 0;
}
- TWindowData *dat = 0;
+ CSrmmWindow *dat = 0;
if (hWnd)
- dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
{
HICON hIcon;
@@ -212,7 +212,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dis->itemData > 0)
hIcon = (dis->itemData & 0x10000000) ? pci->hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent;
else if (dat != NULL) {
- hIcon = MY_GetContactIcon(dat, 0);
+ hIcon = dat->GetMyContactIcon(0);
idle = dat->idle;
}
else hIcon = PluginConfig.g_iconContainer;
@@ -394,7 +394,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP TContainerData *pContainer = 0;
SendMessage(si->hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
if (pContainer) {
- int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, 1159));
+ int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS));
if (iTabs == 1)
SendMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
else
@@ -431,18 +431,18 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND hWnd = M.FindWindow(hContact);
if (hWnd) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (dat) {
if (hkl) {
dat->hkl = hkl;
- PostMessage(dat->hwnd, DM_SETLOCALE, 0, 0);
+ PostMessage(dat->GetHwnd(), DM_SETLOCALE, 0, 0);
}
DBVARIANT dbv;
if (0 == db_get_ws(hContact, SRMSGMOD_T, "locale", &dbv)) {
- GetLocaleID(dat, dbv.ptszVal);
+ dat->GetLocaleID(dbv.ptszVal);
db_free(&dbv);
- UpdateReadChars(dat);
+ dat->UpdateReadChars();
}
}
}
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index d41d55a27d..52c64e0c53 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -40,7 +40,7 @@ wchar_t *xStatusDescr[] = TInfoPanelConfig CInfoPanel::m_ipConfig = { 0 };
-int CInfoPanel::setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam)
+int CInfoPanel::setPanelHandler(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam)
{
if (wParam == 0 && lParam == 0) {
dat->Panel->getVisibility();
@@ -48,7 +48,7 @@ int CInfoPanel::setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam) dat->Panel->showHide();
}
else {
- TWindowData *srcDat = (TWindowData*)wParam;
+ CTabBaseDlg *srcDat = (CTabBaseDlg*)wParam;
if (lParam == 0)
dat->Panel->loadHeight();
else {
@@ -62,7 +62,7 @@ int CInfoPanel::setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam) dat->Panel->setHeight((LONG)lParam);
}
}
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ SendMessage(dat->GetHwnd(), WM_SIZE, 0, 0);
}
return 0;
}
@@ -79,7 +79,7 @@ void CInfoPanel::loadHeight() {
BYTE bSync = M.GetByte("syncAllPanels", 0); // sync muc <> im panels
- m_height = M.GetDword(m_dat->hContact, "panelheight", -1);
+ m_height = M.GetDword(m_dat->m_hContact, "panelheight", -1);
if (m_height == -1 || HIWORD(m_height) == 0) {
if (m_dat->pContainer->settings->fPrivate)
@@ -129,7 +129,7 @@ void CInfoPanel::saveHeight(bool fFlush) }
}
}
- else db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight", MAKELONG(m_height, 0xffff));
+ else db_set_dw(m_dat->m_hContact, SRMSGMOD_T, "panelheight", MAKELONG(m_height, 0xffff));
}
}
@@ -161,13 +161,13 @@ void CInfoPanel::setHeight(LONG newHeight, bool fBroadcast) void CInfoPanel::Configure() const
{
- Utils::showDlgControl(m_dat->hwnd, IDC_PANELSPLITTER, m_active ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_dat->GetHwnd(), IDC_PANELSPLITTER, m_active ? SW_SHOW : SW_HIDE);
}
void CInfoPanel::showHide() const
{
HBITMAP hbm = (m_active && m_dat->pContainer->avatarMode != 3) ? m_dat->hOwnPic : (m_dat->ace ? m_dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
- HWND hwndDlg = m_dat->hwnd;
+ HWND hwndDlg = m_dat->GetHwnd();
if (!m_isChat) {
::ShowWindow(m_dat->hwndPanelPicParent, (m_active) ? SW_SHOW : SW_HIDE);
@@ -178,18 +178,18 @@ void CInfoPanel::showHide() const }
m_dat->iRealAvatarHeight = 0;
- ::AdjustBottomAvatarDisplay(m_dat);
+ m_dat->AdjustBottomAvatarDisplay();
BITMAP bm;
::GetObject(hbm, sizeof(bm), &bm);
- ::CalcDynamicAvatarSize(m_dat, &bm);
+ m_dat->CalcDynamicAvatarSize(&bm);
if (m_active) {
if (m_dat->hwndContactPic) {
::DestroyWindow(m_dat->hwndContactPic);
m_dat->hwndContactPic = NULL;
}
- ::GetAvatarVisibility(hwndDlg, m_dat);
+ m_dat->GetAvatarVisibility();
Configure();
InvalidateRect(hwndDlg, NULL, FALSE);
}
@@ -225,13 +225,13 @@ void CInfoPanel::showHide() const bool CInfoPanel::getVisibility()
{
- if (m_dat->hContact == 0) {
+ if (m_dat->m_hContact == 0) {
setActive(false); // no info panel, if no hcontact
return false;
}
BYTE bDefault = (m_dat->pContainer->dwFlags & CNT_INFOPANEL) ? 1 : 0;
- BYTE bContact = M.GetByte(m_dat->hContact, "infopanel", 0);
+ BYTE bContact = M.GetByte(m_dat->m_hContact, "infopanel", 0);
BYTE visible = (bContact == 0 ? bDefault : (bContact == (BYTE)-1 ? 0 : 1));
setActive(visible);
@@ -301,7 +301,7 @@ void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, if (CSkin::m_skinEnabled) {
rc.bottom -= 2;
- CSkin::SkinDrawBG(m_dat->hwnd, m_dat->pContainer->hwnd, m_dat->pContainer, &rc, hdc);
+ CSkin::SkinDrawBG(m_dat->GetHwnd(), m_dat->pContainer->hwnd, m_dat->pContainer, &rc, hdc);
item = &SkinItems[ID_EXTBKINFOPANELBG];
// if new (= tabsrmm 3.x) skin item is not defined, use the old info panel
@@ -335,10 +335,10 @@ void CInfoPanel::renderContent(const HDC hdc) DRAWITEMSTRUCT dis = { 0 };
dis.rcItem = m_dat->rcPic;
dis.hDC = hdc;
- dis.hwndItem = m_dat->hwnd;
- if (::MsgWindowDrawHandler(0, (LPARAM)&dis, m_dat) == 0) {
- ::PostMessage(m_dat->hwnd, WM_SIZE, 0, 1);
- ::PostMessage(m_dat->hwnd, DM_FORCEREDRAW, 0, 0);
+ dis.hwndItem = m_dat->GetHwnd();
+ if (m_dat->MsgWindowDrawHandler(0, (LPARAM)&dis) == 0) {
+ ::PostMessage(m_dat->GetHwnd(), WM_SIZE, 0, 1);
+ ::PostMessage(m_dat->GetHwnd(), DM_FORCEREDRAW, 0, 0);
}
RECT rc = m_dat->rcNick;
@@ -400,7 +400,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) rcItem.left += 2;
if (szTextToShow[0]) {
- HICON xIcon = ::GetXStatusIcon(m_dat);
+ HICON xIcon = m_dat->GetXStatusIcon();
if (xIcon) {
::DrawIconEx(hdc, rcItem.left, (rcItem.bottom + rcItem.top - PluginConfig.m_smcyicon) / 2, xIcon, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, 0, DI_NORMAL | DI_COMPAT);
::DestroyIcon(xIcon);
@@ -550,7 +550,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) m_dat->panelStatusCX = 3 + sStatus.cx + sProto.cx + 14 + (m_dat->hClientIcon ? 20 : 0) + sTime.cx + 13;
if (m_dat->panelStatusCX != oldPanelStatusCX) {
- SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
+ SendMessage(m_dat->GetHwnd(), WM_SIZE, 0, 0);
rcItem = m_dat->rcStatus;
}
@@ -696,9 +696,9 @@ void CInfoPanel::Invalidate(BOOL fErase) const {
if (m_active) {
RECT rc;
- ::GetClientRect(m_dat->hwnd, &rc);
+ ::GetClientRect(m_dat->GetHwnd(), &rc);
rc.bottom = m_height;
- ::InvalidateRect(m_dat->hwnd, &rc, fErase);
+ ::InvalidateRect(m_dat->GetHwnd(), &rc, fErase);
}
}
@@ -750,11 +750,11 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd) switch (cmd) {
case CMD_IP_COPY:
if (m_hoverFlags & HOVER_NICK) {
- Utils::CopyToClipBoard(m_dat->cache->getNick(), m_dat->hwnd);
+ Utils::CopyToClipBoard(m_dat->cache->getNick(), m_dat->GetHwnd());
return(S_OK);
}
if (m_hoverFlags & HOVER_UIN) {
- Utils::CopyToClipBoard(m_isChat ? m_dat->si->ptszTopic : m_dat->cache->getUIN(), m_dat->hwnd);
+ Utils::CopyToClipBoard(m_isChat ? m_dat->si->ptszTopic : m_dat->cache->getUIN(), m_dat->GetHwnd());
return(S_OK);
}
break;
@@ -762,7 +762,7 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd) case IDC_CHAT_HISTORY:
case IDC_CHANMGR:
if (m_isChat) {
- SendMessage(m_dat->hwnd, WM_COMMAND, cmd, 0);
+ SendMessage(m_dat->GetHwnd(), WM_COMMAND, cmd, 0);
return(S_OK);
}
break;
@@ -781,16 +781,16 @@ void CInfoPanel::handleClick(const POINT& pt) return;
if (!m_isChat) {
- ::KillTimer(m_dat->hwnd, TIMERID_AWAYMSG);
+ ::KillTimer(m_dat->GetHwnd(), TIMERID_AWAYMSG);
m_dat->dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER;
}
HMENU m = constructContextualMenu();
if (m) {
- LRESULT r = ::TrackPopupMenu(m, TPM_RETURNCMD, pt.x, pt.y, 0, m_dat->hwnd, NULL);
+ LRESULT r = ::TrackPopupMenu(m, TPM_RETURNCMD, pt.x, pt.y, 0, m_dat->GetHwnd(), NULL);
::DestroyMenu(m);
if (S_OK != cmdHandler(r))
- Utils::CmdDispatcher(Utils::CMD_INFOPANEL, m_dat->hwnd, r, 0, 0, m_dat, m_dat->pContainer);
+ Utils::CmdDispatcher(Utils::CMD_INFOPANEL, m_dat->GetHwnd(), r, 0, 0, m_dat, m_dat->pContainer);
}
m_hoverFlags = 0;
Invalidate(TRUE);
@@ -805,7 +805,7 @@ void CInfoPanel::handleClick(const POINT& pt) int CInfoPanel::hitTest(POINT pt)
{
- ::ScreenToClient(m_dat->hwnd, &pt);
+ ::ScreenToClient(m_dat->GetHwnd(), &pt);
if (!m_isChat && ::PtInRect(&m_rcStatus, pt))
return(HTSTATUS);
@@ -852,7 +852,7 @@ void CInfoPanel::trackMouse(POINT &pt) if (m_hoverFlags) {
if (!(m_dat->dwFlagsEx & MWF_SHOW_AWAYMSGTIMER)) {
- ::SetTimer(m_dat->hwnd, TIMERID_AWAYMSG, 1000, 0);
+ ::SetTimer(m_dat->GetHwnd(), TIMERID_AWAYMSG, 1000, 0);
m_dat->dwFlagsEx |= MWF_SHOW_AWAYMSGTIMER;
}
}
@@ -872,7 +872,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam) if (!m_active || !m_dat->hwndTip)
return;
- HWND hwndDlg = m_dat->hwnd;
+ HWND hwndDlg = m_dat->GetHwnd();
{
RECT rc;
::GetWindowRect(GetDlgItem(hwndDlg, ctrlId), &rc);
@@ -922,7 +922,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam) POINT pt;
RECT rc = { 0, 0, 400, 600 };
GetCursorPos(&pt);
- m_tip = new CTip(m_dat->hwnd, m_dat->hContact, str, this);
+ m_tip = new CTip(m_dat->GetHwnd(), m_dat->m_hContact, str, this);
m_tip->show(rc, pt, m_dat->hTabIcon, m_dat->szStatus);
return;
}
@@ -968,7 +968,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP case WM_ERASEBKGND:
// parent window of the infopanel ACC control
RECT rc, rcItem;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
if (dat == 0)
break;
@@ -1059,168 +1059,168 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L {
switch (msg) {
case WM_INITDIALOG:
- {
- wchar_t tszTitle[100];
- mir_snwprintf(tszTitle, TranslateT("Set panel visibility for this %s"),
- m_isChat ? TranslateT("chat room") : TranslateT("contact"));
- ::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
+ {
+ wchar_t tszTitle[100];
+ mir_snwprintf(tszTitle, TranslateT("Set panel visibility for this %s"),
+ m_isChat ? TranslateT("chat room") : TranslateT("contact"));
+ ::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
- mir_snwprintf(tszTitle, m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
- TranslateT("Do not synchronize the panel height with group chat windows"));
+ mir_snwprintf(tszTitle, m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
+ TranslateT("Do not synchronize the panel height with group chat windows"));
- ::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
+ ::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Inherit from container setting"));
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always off"));
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always on"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Inherit from container setting"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always off"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always on"));
- BYTE v = M.GetByte(m_dat->hContact, "infopanel", 0);
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_SETCURSEL, (WPARAM)(v == 0 ? 0 : (v == (BYTE)-1 ? 1 : 2)), 0);
+ BYTE v = M.GetByte(m_dat->m_hContact, "infopanel", 0);
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_SETCURSEL, (WPARAM)(v == 0 ? 0 : (v == (BYTE)-1 ? 1 : 2)), 0);
- ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use default size"));
- ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use private size"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use default size"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use private size"));
- ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_SETCURSEL, (WPARAM)(m_fPrivateHeight ? 1 : 0), 0);
+ ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_SETCURSEL, (WPARAM)(m_fPrivateHeight ? 1 : 0), 0);
- ::CheckDlgButton(hwnd, IDC_NOSYNC, M.GetByte("syncAllPanels", 0) ? BST_UNCHECKED : BST_CHECKED);
+ ::CheckDlgButton(hwnd, IDC_NOSYNC, M.GetByte("syncAllPanels", 0) ? BST_UNCHECKED : BST_CHECKED);
- Utils::showDlgControl(hwnd, IDC_IPCONFIG_PRIVATECONTAINER, m_dat->pContainer->settings->fPrivate ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwnd, IDC_IPCONFIG_PRIVATECONTAINER, m_dat->pContainer->settings->fPrivate ? SW_SHOW : SW_HIDE);
- if (!m_isChat) {
- v = db_get_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use global setting"));
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Show always (if present)"));
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never show it at all"));
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_SETCURSEL, (v == (BYTE)-1 ? 0 : (v == 1 ? 1 : 2)), 0);
+ if (!m_isChat) {
+ v = db_get_b(m_dat->m_hContact, SRMSGMOD_T, "hideavatar", -1);
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use global setting"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Show always (if present)"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never show it at all"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_SETCURSEL, (v == (BYTE)-1 ? 0 : (v == 1 ? 1 : 2)), 0);
+ }
+ else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, false);
}
- else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, false);
- }
- return FALSE;
+ return FALSE;
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
- {
- HWND hwndChild = (HWND)lParam;
- UINT id = ::GetDlgCtrlID(hwndChild);
+ {
+ HWND hwndChild = (HWND)lParam;
+ UINT id = ::GetDlgCtrlID(hwndChild);
- if (m_configDlgFont == 0) {
- HFONT hFont = (HFONT)::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_GETFONT, 0, 0);
- LOGFONT lf = { 0 };
+ if (m_configDlgFont == 0) {
+ HFONT hFont = (HFONT)::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_GETFONT, 0, 0);
+ LOGFONT lf = { 0 };
- ::GetObject(hFont, sizeof(lf), &lf);
- lf.lfWeight = FW_BOLD;
- m_configDlgBoldFont = ::CreateFontIndirect(&lf);
+ ::GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ m_configDlgBoldFont = ::CreateFontIndirect(&lf);
- lf.lfHeight = (int)(lf.lfHeight * 1.2);
- m_configDlgFont = ::CreateFontIndirect(&lf);
- ::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
- }
+ lf.lfHeight = (int)(lf.lfHeight * 1.2);
+ m_configDlgFont = ::CreateFontIndirect(&lf);
+ ::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
+ }
- if (hwndChild == ::GetDlgItem(hwnd, IDC_IPCONFIG_TITLE)) {
- ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
- ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
- }
- else if (id == IDC_IPCONFIG_FOOTER || id == IDC_SIZE_TIP || id == IDC_IPCONFIG_PRIVATECONTAINER)
- ::SetTextColor((HDC)wParam, RGB(160, 50, 50));
- else if (id == IDC_GROUP_SIZE || id == IDC_GROUP_SCOPE || id == IDC_GROUP_OTHER)
- ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgBoldFont, FALSE);
+ if (hwndChild == ::GetDlgItem(hwnd, IDC_IPCONFIG_TITLE)) {
+ ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
+ }
+ else if (id == IDC_IPCONFIG_FOOTER || id == IDC_SIZE_TIP || id == IDC_IPCONFIG_PRIVATECONTAINER)
+ ::SetTextColor((HDC)wParam, RGB(160, 50, 50));
+ else if (id == IDC_GROUP_SIZE || id == IDC_GROUP_SCOPE || id == IDC_GROUP_OTHER)
+ ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgBoldFont, FALSE);
- ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
+ ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
+ }
return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
- }
case WM_COMMAND:
- {
- LONG lOldHeight = m_height;
- switch (LOWORD(wParam)) {
- case IDC_PANELSIZE:
{
- LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_GETCURSEL, 0, 0);
- if (iResult == 0) {
- if (m_fPrivateHeight) {
- db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight", m_height);
- loadHeight();
+ LONG lOldHeight = m_height;
+ switch (LOWORD(wParam)) {
+ case IDC_PANELSIZE:
+ {
+ LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_GETCURSEL, 0, 0);
+ if (iResult == 0) {
+ if (m_fPrivateHeight) {
+ db_set_dw(m_dat->m_hContact, SRMSGMOD_T, "panelheight", m_height);
+ loadHeight();
+ }
+ }
+ else if (iResult == 1) {
+ db_set_dw(m_dat->m_hContact, SRMSGMOD_T, "panelheight",
+ MAKELONG(M.GetDword(m_dat->m_hContact, "panelheight", m_height), 0xffff));
+ loadHeight();
+ }
}
- }
- else if (iResult == 1) {
- db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight",
- MAKELONG(M.GetDword(m_dat->hContact, "panelheight", m_height), 0xffff));
- loadHeight();
- }
- }
- break;
+ break;
- case IDC_PANELPICTUREVIS:
- {
- BYTE vOld = db_get_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
- LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_GETCURSEL, 0, 0);
-
- BYTE vNew = (iResult == 0 ? (BYTE)-1 : (iResult == 1 ? 1 : 0));
- if (vNew != vOld) {
- if (vNew == (BYTE)-1)
- db_unset(m_dat->hContact, SRMSGMOD_T, "hideavatar");
- else
- db_set_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", vNew);
-
- ::ShowPicture(m_dat, FALSE);
- ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
- ::DM_ScrollToBottom(m_dat, 0, 1);
- }
- }
- break;
+ case IDC_PANELPICTUREVIS:
+ {
+ BYTE vOld = db_get_b(m_dat->m_hContact, SRMSGMOD_T, "hideavatar", -1);
+ LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_GETCURSEL, 0, 0);
+
+ BYTE vNew = (iResult == 0 ? (BYTE)-1 : (iResult == 1 ? 1 : 0));
+ if (vNew != vOld) {
+ if (vNew == (BYTE)-1)
+ db_unset(m_dat->m_hContact, SRMSGMOD_T, "hideavatar");
+ else
+ db_set_b(m_dat->m_hContact, SRMSGMOD_T, "hideavatar", vNew);
+
+ m_dat->ShowPicture(false);
+ ::SendMessage(m_dat->GetHwnd(), WM_SIZE, 0, 0);
+ ::DM_ScrollToBottom(m_dat, 0, 1);
+ }
+ }
+ break;
- case IDC_PANELVISIBILITY:
- {
- BYTE vOld = db_get_b(m_dat->hContact, SRMSGMOD_T, "infopanel", 0);
- LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_GETCURSEL, 0, 0);
-
- BYTE vNew = (iResult == 0 ? 0 : (iResult == 1 ? (BYTE)-1 : 1));
- if (vNew != vOld) {
- db_set_b(m_dat->hContact, SRMSGMOD_T, "infopanel", vNew);
- getVisibility();
- showHide();
- }
- }
- break;
+ case IDC_PANELVISIBILITY:
+ {
+ BYTE vOld = db_get_b(m_dat->m_hContact, SRMSGMOD_T, "infopanel", 0);
+ LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_GETCURSEL, 0, 0);
+
+ BYTE vNew = (iResult == 0 ? 0 : (iResult == 1 ? (BYTE)-1 : 1));
+ if (vNew != vOld) {
+ db_set_b(m_dat->m_hContact, SRMSGMOD_T, "infopanel", vNew);
+ getVisibility();
+ showHide();
+ }
+ }
+ break;
- case IDC_SIZECOMPACT:
- setHeight(MIN_PANELHEIGHT + 2, true);
- break;
+ case IDC_SIZECOMPACT:
+ setHeight(MIN_PANELHEIGHT + 2, true);
+ break;
- case IDC_SIZENORMAL:
- setHeight(DEGRADE_THRESHOLD, true);
- break;
+ case IDC_SIZENORMAL:
+ setHeight(DEGRADE_THRESHOLD, true);
+ break;
- case IDC_SIZELARGE:
- setHeight(51, true);
- break;
+ case IDC_SIZELARGE:
+ setHeight(51, true);
+ break;
- case IDC_NOSYNC:
- db_set_b(0, SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1);
- if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_NOSYNC)) {
- loadHeight();
- if (!m_dat->pContainer->settings->fPrivate)
- M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
- else
- ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
- }
- else {
- if (!m_dat->pContainer->settings->fPrivate)
- M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, 0);
- else
- ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, 0);
+ case IDC_NOSYNC:
+ db_set_b(0, SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1);
+ if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_NOSYNC)) {
+ loadHeight();
+ if (!m_dat->pContainer->settings->fPrivate)
+ M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
+ else
+ ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
+ }
+ else {
+ if (!m_dat->pContainer->settings->fPrivate)
+ M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, 0);
+ else
+ ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, 0);
+ }
+ break;
}
- break;
- }
- if (m_height != lOldHeight) {
- ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
- ::SetAeroMargins(m_dat->pContainer);
- ::RedrawWindow(m_dat->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
- ::RedrawWindow(GetParent(m_dat->hwnd), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ if (m_height != lOldHeight) {
+ ::SendMessage(m_dat->GetHwnd(), WM_SIZE, 0, 0);
+ ::SetAeroMargins(m_dat->pContainer);
+ ::RedrawWindow(m_dat->GetHwnd(), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ ::RedrawWindow(GetParent(m_dat->GetHwnd()), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ }
}
- }
- break;
+ break;
case WM_CLOSE:
if (wParam == 1 && lParam == 1)
@@ -1249,7 +1249,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt) return 0;
RECT rc;
- ::GetWindowRect(m_dat->hwnd, &rc);
+ ::GetWindowRect(m_dat->GetHwnd(), &rc);
rc.bottom = rc.top + m_height;
rc.right -= m_dat->iPanelAvatarX;
@@ -1267,7 +1267,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt) ::GetClientRect(m_hwndConfig, &rc);
RECT rcLog;
- ::GetWindowRect(GetDlgItem(m_dat->hwnd, m_isChat ? IDC_CHAT_LOG : IDC_LOG), &rcLog);
+ ::GetWindowRect(GetDlgItem(m_dat->GetHwnd(), m_isChat ? IDC_LOG : IDC_LOG), &rcLog);
m_fDialogCreated = true;
::SetWindowPos(m_hwndConfig, HWND_TOP, rcLog.left + 10, rcLog.top - (m_active ? 10 : 0), 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h index 8ee1f4e304..ff31b61045 100644 --- a/plugins/TabSRMM/src/infopanel.h +++ b/plugins/TabSRMM/src/infopanel.h @@ -125,7 +125,7 @@ public: HTNIRVANA = 0
};
- CInfoPanel(TWindowData *dat)
+ CInfoPanel(CTabBaseDlg *dat)
{
if (dat) {
m_dat = dat;
@@ -149,7 +149,7 @@ public: __forceinline bool isActive() const { return m_active; }
__forceinline bool isPrivateHeight() const { return m_fPrivateHeight; }
__forceinline DWORD isHovered() const { return m_active ? m_hoverFlags : 0; }
- __forceinline const TWindowData* getDat() const { return m_dat; }
+ __forceinline const CTabBaseDlg* getDat() const { return m_dat; }
void setHeight(LONG newHeight, bool fBroadcast = false);
void setActive(const int newActive);
@@ -172,7 +172,7 @@ public: public:
static TInfoPanelConfig m_ipConfig;
- static int setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam);
+ static int setPanelHandler(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
@@ -194,7 +194,7 @@ private: bool m_active; // panel active and visible
bool m_fPrivateHeight;
bool m_fDialogCreated;
- TWindowData *m_dat; // this one OWNS us...
+ CTabBaseDlg *m_dat; // this one OWNS us...
LONG m_height; // height (determined by position of IDC_PANELSPLITTER)
LONG m_defaultHeight,
m_defaultMUCHeight; // global values for the info bar height
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index c5999eee9f..b85e7ac1e8 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -337,12 +337,12 @@ int CMimAPI::ProtoAck(WPARAM, LPARAM lParam) for (int j = 0; j < SendQueue::NR_SENDJOBS; j++) { SendJob &p = jobs[j]; if (pAck->hProcess == p.hSendId && pAck->hContact == p.hContact) { - TWindowData *dat = p.hOwnerWnd ? (TWindowData*)GetWindowLongPtr(p.hOwnerWnd, GWLP_USERDATA) : NULL; + CSrmmWindow *dat = p.hOwnerWnd ? (CSrmmWindow*)GetWindowLongPtr(p.hOwnerWnd, GWLP_USERDATA) : NULL; if (dat == NULL) { sendQueue->ackMessage(NULL, (WPARAM)MAKELONG(j, i), lParam); return 0; } - if (dat->hContact == p.hContact || dat->hContact == hMeta) { + if (dat->m_hContact == p.hContact || dat->m_hContact == hMeta) { iFound = j; break; } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 40cfee8e07..368d492a44 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -80,10 +80,10 @@ static void _clrMsgFilter(LPARAM lParam) // @param hwndFrom src window handle
// @param pt mouse pointer position
-static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt)
+static void ShowPopupMenu(CSrmmWindow *dat, int idFrom, HWND hwndFrom, POINT pt)
{
CHARRANGE sel, all = { 0, -1 };
- HWND hwndDlg = dat->hwnd;
+ HWND hwndDlg = dat->GetHwnd();
HMENU hSubMenu, hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
if (idFrom == IDC_LOG)
@@ -115,7 +115,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) mwpd.cbSize = sizeof(mwpd);
mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
- mwpd.hContact = dat->hContact;
+ mwpd.hContact = dat->m_hContact;
mwpd.hwnd = hwndFrom;
mwpd.hMenu = hSubMenu;
mwpd.selection = 0;
@@ -156,7 +156,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
break;
case IDM_CLEAR:
- ClearLog(dat);
+ dat->ClearLog();
break;
case ID_LOG_FREEZELOG:
SendDlgItemMessage(hwndDlg, IDC_LOG, WM_KEYDOWN, VK_F12, 0);
@@ -170,7 +170,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) RedrawWindow(dat->pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case ID_EDITOR_PASTEANDSENDIMMEDIATELY:
- HandlePasteAndSend(dat);
+ dat->HandlePasteAndSend();
break;
}
@@ -179,29 +179,29 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) DestroyMenu(hMenu);
}
-static void ResizeIeView(const TWindowData *dat)
+void CTabBaseDlg::ResizeIeView()
{
RECT rcRichEdit;
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_LOG), &rcRichEdit);
+ GetWindowRect(m_log.GetHwnd(), &rcRichEdit);
POINT pt = { rcRichEdit.left, rcRichEdit.top };
- ScreenToClient(dat->hwnd, &pt);
+ ScreenToClient(m_hwnd, &pt);
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_SETPOS;
- ieWindow.parent = dat->hwnd;
- ieWindow.hwnd = dat->hwndIEView ? dat->hwndIEView : dat->hwndHPP;
+ ieWindow.parent = m_hwnd;
+ ieWindow.hwnd = hwndIEView ? hwndIEView : hwndHPP;
ieWindow.x = pt.x;
ieWindow.y = pt.y;
ieWindow.cx = rcRichEdit.right - rcRichEdit.left;
ieWindow.cy = rcRichEdit.bottom - rcRichEdit.top;
if (ieWindow.cx != 0 && ieWindow.cy != 0)
- CallService(dat->hwndIEView ? MS_IEVIEW_WINDOW : MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+ CallService(hwndIEView ? MS_IEVIEW_WINDOW : MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
}
LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
switch (msg) {
case WM_NCCALCSIZE:
@@ -217,10 +217,10 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
if (mwdat) {
- BOOL isCtrl, isShift, isAlt;
- KbdState(mwdat, isShift, isCtrl, isAlt);
+ bool isCtrl, isShift, isAlt;
+ mwdat->KbdState(isShift, isCtrl, isAlt);
switch (msg) {
case WM_NCCALCSIZE:
@@ -234,7 +234,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP 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) {
- SetFocus(GetDlgItem(mwdat->hwnd, IDC_MESSAGE));
+ SetFocus(GetDlgItem(mwdat->GetHwnd(), IDC_MESSAGE));
keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam, 0), KEYEVENTF_EXTENDEDKEY | 0, 0);
return 0;
}
@@ -253,127 +253,124 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP // it protects itself from being called more than once per session activation and is valid for
// normal IM sessions *only*. Group chat sessions have their own activation handler (see chat/window.c)
-static void MsgWindowUpdateState(TWindowData *dat, UINT msg)
+void CSrmmWindow::MsgWindowUpdateState(UINT msg)
{
- if (dat == NULL || dat->iTabID < 0)
+ if (iTabID < 0)
return;
- HWND hwndDlg = dat->hwnd;
- HWND hwndTab = GetParent(hwndDlg);
-
if (msg == WM_ACTIVATE) {
- if (dat->pContainer->dwFlags & CNT_TRANSPARENCY) {
- DWORD trans = LOWORD(dat->pContainer->settings->dwTransparency);
- SetLayeredWindowAttributes(dat->pContainer->hwnd, 0, (BYTE)trans, (dat->pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
+ if (pContainer->dwFlags & CNT_TRANSPARENCY) {
+ DWORD trans = LOWORD(pContainer->settings->dwTransparency);
+ SetLayeredWindowAttributes(pContainer->hwnd, 0, (BYTE)trans, (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
}
}
- if (dat->bIsAutosizingInput && dat->iInputAreaHeight == -1) {
- dat->iInputAreaHeight = 0;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ if (bIsAutosizingInput && iInputAreaHeight == -1) {
+ iInputAreaHeight = 0;
+ SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
}
- if (dat->pWnd)
- dat->pWnd->activateTab();
- dat->Panel->dismissConfig();
- dat->dwUnread = 0;
- if (dat->pContainer->hwndSaved == hwndDlg)
+ if (pWnd)
+ pWnd->activateTab();
+ Panel->dismissConfig();
+ dwUnread = 0;
+ if (pContainer->hwndSaved == m_hwnd)
return;
- dat->pContainer->hwndSaved = hwndDlg;
+ pContainer->hwndSaved = m_hwnd;
- dat->dwTickLastEvent = 0;
- dat->dwFlags &= ~MWF_DIVIDERSET;
- if (KillTimer(hwndDlg, TIMERID_FLASHWND)) {
- FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, FALSE, dat->hTabIcon);
- dat->mayFlashTab = FALSE;
+ dwTickLastEvent = 0;
+ dwFlags &= ~MWF_DIVIDERSET;
+ if (KillTimer(m_hwnd, TIMERID_FLASHWND)) {
+ FlashTab(false);
+ m_bCanFlashTab = false;
}
- if (dat->pContainer->dwFlashingStarted != 0) {
- FlashContainer(dat->pContainer, 0, 0);
- dat->pContainer->dwFlashingStarted = 0;
+ if (pContainer->dwFlashingStarted != 0) {
+ FlashContainer(pContainer, 0, 0);
+ pContainer->dwFlashingStarted = 0;
}
- if (dat->dwFlagsEx & MWF_SHOW_FLASHCLIST) {
- dat->dwFlagsEx &= ~MWF_SHOW_FLASHCLIST;
- if (dat->hFlashingEvent != 0)
- pcli->pfnRemoveEvent(dat->hContact, dat->hFlashingEvent);
- dat->hFlashingEvent = 0;
+ if (dwFlagsEx & MWF_SHOW_FLASHCLIST) {
+ dwFlagsEx &= ~MWF_SHOW_FLASHCLIST;
+ if (hFlashingEvent != 0)
+ pcli->pfnRemoveEvent(m_hContact, hFlashingEvent);
+ hFlashingEvent = 0;
}
- dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE;
+ pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE;
- if ((dat->dwFlags & MWF_DEFERREDREMAKELOG) && !IsIconic(dat->pContainer->hwnd)) {
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- dat->dwFlags &= ~MWF_DEFERREDREMAKELOG;
+ if ((dwFlags & MWF_DEFERREDREMAKELOG) && !IsIconic(pContainer->hwnd)) {
+ SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
+ dwFlags &= ~MWF_DEFERREDREMAKELOG;
}
- if (dat->dwFlags & MWF_NEEDCHECKSIZE)
- PostMessage(hwndDlg, DM_SAVESIZE, 0, 0);
+ if (dwFlags & MWF_NEEDCHECKSIZE)
+ PostMessage(m_hwnd, DM_SAVESIZE, 0, 0);
if (PluginConfig.m_bAutoLocaleSupport) {
- if (dat->hkl == 0)
- DM_LoadLocale(dat);
+ if (hkl == 0)
+ DM_LoadLocale(this);
else
- SendMessage(hwndDlg, DM_SETLOCALE, 0, 0);
+ SendMessage(m_hwnd, DM_SETLOCALE, 0, 0);
}
- dat->pContainer->hIconTaskbarOverlay = 0;
- SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
+ pContainer->hIconTaskbarOverlay = 0;
+ SendMessage(pContainer->hwnd, DM_UPDATETITLE, m_hContact, 0);
- UpdateStatusBar(dat);
- dat->dwLastActivity = GetTickCount();
- dat->pContainer->dwLastActivity = dat->dwLastActivity;
+ UpdateStatusBar();
+ dwLastActivity = GetTickCount();
+ pContainer->dwLastActivity = dwLastActivity;
- dat->pContainer->MenuBar->configureMenu();
- UpdateTrayMenuState(dat, FALSE);
+ pContainer->MenuBar->configureMenu();
+ UpdateTrayMenuState(this, FALSE);
- if (dat->pContainer->hwndActive == hwndDlg)
- PostMessage(hwndDlg, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0);
+ if (pContainer->hwndActive == m_hwnd)
+ PostMessage(m_hwnd, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0);
- dat->Panel->Invalidate();
+ Panel->Invalidate();
- if (dat->dwFlags & MWF_DEFERREDSCROLL && dat->hwndIEView == 0 && dat->hwndHPP == 0) {
- dat->dwFlags &= ~MWF_DEFERREDSCROLL;
- DM_ScrollToBottom(dat, 0, 1);
+ if (dwFlags & MWF_DEFERREDSCROLL && hwndIEView == 0 && hwndHPP == 0) {
+ dwFlags &= ~MWF_DEFERREDSCROLL;
+ DM_ScrollToBottom(this, 0, 1);
}
- DM_SetDBButtonStates(hwndDlg, dat);
+ DM_SetDBButtonStates();
- if (dat->hwndIEView) {
+ if (hwndIEView) {
RECT rcRTF;
POINT pt;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcRTF);
+ GetWindowRect(GetDlgItem(m_hwnd, IDC_LOG), &rcRTF);
rcRTF.left += 20;
rcRTF.top += 20;
pt.x = rcRTF.left;
pt.y = rcRTF.top;
- if (dat->hwndIEView) {
+ if (hwndIEView) {
if (M.GetByte("subclassIEView", 0)) {
- mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc);
- SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
- RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ mir_subclassWindow(hwndIEView, IEViewSubclassProc);
+ SetWindowPos(hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
+ RedrawWindow(hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
}
}
- dat->hwndIWebBrowserControl = WindowFromPoint(pt);
+ hwndIWebBrowserControl = WindowFromPoint(pt);
}
- if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) {
- dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER;
- ShowWindow(dat->pContainer->hwnd, SW_RESTORE);
- PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, dat->wParam, dat->lParam);
- dat->wParam = dat->lParam = 0;
+ if (dwFlagsEx & MWF_EX_DELAYEDSPLITTER) {
+ dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER;
+ ShowWindow(pContainer->hwnd, SW_RESTORE);
+ PostMessage(m_hwnd, DM_SPLITTERGLOBALEVENT, wParam, lParam);
+ wParam = lParam = 0;
}
- if (dat->dwFlagsEx & MWF_EX_AVATARCHANGED) {
- dat->dwFlagsEx &= ~MWF_EX_AVATARCHANGED;
- PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0);
+ if (dwFlagsEx & MWF_EX_AVATARCHANGED) {
+ dwFlagsEx &= ~MWF_EX_AVATARCHANGED;
+ PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0);
}
- BB_SetButtonsPos(dat);
+ BB_SetButtonsPos();
if (M.isAero())
- InvalidateRect(hwndTab, NULL, FALSE);
- if (dat->pContainer->dwFlags & CNT_SIDEBAR)
- dat->pContainer->SideBar->setActiveItem(dat);
+ InvalidateRect(m_hwndParent, NULL, FALSE);
+ if (pContainer->dwFlags & CNT_SIDEBAR)
+ pContainer->SideBar->setActiveItem(this);
- if (dat->pWnd)
- dat->pWnd->Invalidate();
+ if (pWnd)
+ pWnd->Invalidate();
}
void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state)
@@ -384,9 +381,9 @@ void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControl void TSAPI SetDialogToType(HWND hwndDlg)
{
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (dat->hContact) {
- if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (dat->m_hContact) {
+ if (db_get_b(dat->m_hContact, "CList", "NotOnList", 0)) {
dat->bNotOnList = TRUE;
ShowMultipleControls(hwndDlg, addControls, _countof(addControls), SW_SHOW);
Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_SHOW);
@@ -414,18 +411,18 @@ void TSAPI SetDialogToType(HWND hwndDlg) ShowMultipleControls(hwndDlg, formatControls, _countof(formatControls), SW_HIDE);
if (dat->pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
+ dat->UpdateReadChars();
SetDlgItemText(hwndDlg, IDC_STATICTEXT, TranslateT("A message failed to send successfully."));
- DM_RecalcPictureSize(dat);
- GetAvatarVisibility(hwndDlg, dat);
+ dat->DM_RecalcPictureSize();
+ dat->GetAvatarVisibility();
Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->bShowAvatar ? SW_SHOW : SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_SPLITTER, dat->bIsAutosizingInput ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- EnableSendButton(dat, GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
+ dat->EnableSendButton(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -437,9 +434,9 @@ void TSAPI SetDialogToType(HWND hwndDlg) static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hwndParent = GetParent(hwnd);
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- BOOL isCtrl, isShift, isAlt;
- KbdState(mwdat, isShift, isCtrl, isAlt);
+ CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ bool isCtrl, isShift, isAlt;
+ mwdat->KbdState(isShift, isCtrl, isAlt);
switch (msg) {
case WM_KILLFOCUS:
@@ -457,7 +454,7 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (wParam == 0x03 && isCtrl) // Ctrl+C
return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
if (wParam == 0x11 && isCtrl)
- SendMessage(mwdat->hwnd, WM_COMMAND, IDC_QUOTE, 0);
+ SendMessage(mwdat->GetHwnd(), WM_COMMAND, IDC_QUOTE, 0);
break;
case WM_SYSKEYUP:
@@ -519,9 +516,9 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- BOOL isCtrl, isShift, isAlt;
+ bool isCtrl, isShift, isAlt;
HWND hwndParent = GetParent(hwnd);
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
if (mwdat == NULL)
return 0;
@@ -548,7 +545,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return 0;
case WM_CHAR:
- KbdState(mwdat, isShift, isCtrl, isAlt);
+ mwdat->KbdState(isShift, isCtrl, isAlt);
if (PluginConfig.m_bSoundOnTyping && !isAlt && !isCtrl && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab))
SkinPlaySound("SoundOnTyping");
@@ -594,14 +591,14 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
}
else if (hClip = GetClipboardData(CF_BITMAP))
- SendHBitmapAsFile(mwdat, (HBITMAP)hClip);
+ mwdat->SendHBitmapAsFile((HBITMAP)hClip);
CloseClipboard();
}
break;
case WM_KEYDOWN:
- KbdState(mwdat, isShift, isCtrl, isAlt);
+ mwdat->KbdState(isShift, isCtrl, isAlt);
if (PluginConfig.m_bSoundOnTyping && !isAlt && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam == VK_DELETE)
SkinPlaySound("SoundOnTyping");
@@ -716,7 +713,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return 0;
}
- KbdState(mwdat, isShift, isCtrl, isAlt);
+ mwdat->KbdState(isShift, isCtrl, isAlt);
if ((wParam >= '0' && wParam <= '9') && isAlt) { // ALT-1 -> ALT-0 direct tab selection
BYTE bChar = (BYTE)wParam;
int iIndex;
@@ -790,7 +787,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
RECT rc;
HWND hwndParent = GetParent(hwnd);
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
switch (msg) {
case WM_NCHITTEST:
@@ -877,14 +874,14 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (selection) {
case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
- db_set_b(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
+ db_set_b(dat->m_hContact, SRMSGMOD_T, "splitoverride", 1);
if (dat->bType == SESSIONTYPE_IM)
- SaveSplitter(dat);
+ dat->SaveSplitter();
break;
case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
if (dat->bIsAutosizingInput) {
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
+ GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_MESSAGE), &rc);
dat->iInputAreaHeight = 0;
}
break;
@@ -908,7 +905,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
PluginConfig.lastSPlitterPos.bSync = bSync;
- SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
+ SendMessage(dat->GetHwnd(), DM_SPLITTERGLOBALEVENT, 0, 0);
M.BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
}
break;
@@ -916,13 +913,13 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM default:
dat->splitterY = dat->savedSplitY;
dat->dynaSplitter = dat->savedDynaSplit;
- DM_RecalcPictureSize(dat);
+ dat->DM_RecalcPictureSize();
if (dat->bType == SESSIONTYPE_CHAT) {
SESSION_INFO *si = dat->si;
si->iSplitterY = dat->savedSplitY;
dat->splitterY = si->iSplitterY + DPISCALEY_S(22);
}
- CSkin::UpdateToolbarBG(dat);
+ dat->UpdateToolbarBG();
SendMessage(hwndParent, WM_SIZE, 0, 0);
DM_ScrollToBottom(dat, 0, 1);
break;
@@ -934,30 +931,446 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
/////////////////////////////////////////////////////////////////////////////////////////
-// resizer proc for the "new" layout.
-static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
+CSrmmWindow::CSrmmWindow(TNewWindowData *pNewData)
+ : CTabBaseDlg(pNewData, IDD_MSGSPLITNEW)
{
- TWindowData *dat = (TWindowData*)lParam;
- RECT rc, rcButton;
- static int uinWidth, msgTop = 0, msgBottom = 0;
+ m_pLog = &m_log;
+ m_pEntry = &m_message;
+ m_autoClose = 0;
+
+ dwFlags = MWF_INITMODE;
+ bType = SESSIONTYPE_IM;
+ Panel = new CInfoPanel(this);
+}
+
+void CSrmmWindow::OnInitDialog()
+{
+ 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);
+ iTabID = newData->iTabID;
+
+ DM_ThemeChanged();
+
+ pszIDCSAVE_close = TranslateT("Close session");
+ pszIDCSAVE_save = TranslateT("Save and close session");
+
+ m_hContact = newData->hContact;
+ cache = CContactCache::getContactCache(m_hContact);
+ cache->updateNick();
+ cache->setWindowData(m_hwnd, this);
+ M.AddWindow(m_hwnd, m_hContact);
+ BroadCastContainer(pContainer, DM_REFRESHTABINDEX, 0, 0);
+ CProxyWindow::add(this);
+ szProto = const_cast<char *>(cache->getProto());
+ bIsMeta = cache->isMeta();
+ if (bIsMeta)
+ cache->updateMeta();
+
+ cache->updateUIN();
+
+ if (m_hContact && szProto != NULL) {
+ wStatus = db_get_w(m_hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ wcsncpy_s(szStatus, pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : wStatus, 0), _TRUNCATE);
+ }
+ else wStatus = ID_STATUS_OFFLINE;
+
+ for (int i = 0; i < _countof(btnControls); i++)
+ CustomizeButton(GetDlgItem(m_hwnd, btnControls[i]));
+
+ GetMYUIN();
+ GetClientIcon();
+
+ CustomizeButton(CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
+ m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL));
+ hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, L"Static", L"", SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwnd, (HMENU)6000, NULL, NULL);
+ mir_subclassWindow(hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
+
+ bShowUIElements = (pContainer->dwFlags & CNT_HIDETOOLBAR) == 0;
+ sendMode |= m_hContact == 0 ? SMODE_MULTIPLE : 0;
+ sendMode |= M.GetByte(m_hContact, "no_ack", 0) ? SMODE_NOACK : 0;
+
+ hQueuedEvents = (MEVENT*)mir_calloc(sizeof(MEVENT)* EVENT_QUEUE_SIZE);
+ iEventQueueSize = EVENT_QUEUE_SIZE;
+ iCurrentQueueError = -1;
+
+ // message history limit
+ // hHistoryEvents holds up to n event handles
+ maxHistory = M.GetDword(m_hContact, "maxhist", M.GetDword("maxhist", 0));
+ curHistory = 0;
+ if (maxHistory)
+ hHistoryEvents = (MEVENT*)mir_alloc(maxHistory * sizeof(MEVENT));
+ else
+ hHistoryEvents = NULL;
+
+ if (bIsMeta)
+ SendMessage(m_hwnd, DM_UPDATEMETACONTACTINFO, 0, 0);
+ else
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+
+ GetMyNick();
+
+ multiSplitterX = (int)M.GetDword(SRMSGMOD, "multisplit", 150);
+ nTypeMode = PROTOTYPE_SELFTYPING_OFF;
+ SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL);
+ iLastEventType = 0xffffffff;
+
+ // load log option flags...
+ dwFlags = pContainer->theme.dwFlags;
+
+ // consider per-contact message setting overrides
+ if (m_hContact && M.GetDword(m_hContact, "mwmask", 0))
+ LoadLocalFlags();
+
+ DM_InitTip();
+ Panel->getVisibility();
+
+ dwFlagsEx |= M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
+ bIsAutosizingInput = IsAutoSplitEnabled();
+ iInputAreaHeight = -1;
+ SetMessageLog();
+ if (m_hContact)
+ Panel->loadHeight();
+
+ bShowAvatar = GetAvatarVisibility();
+
+ Utils::showDlgControl(m_hwnd, IDC_MULTISPLITTER, SW_HIDE);
+
+ RECT rc;
+ GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTER), &rc);
+
+ POINT pt;
+ pt.y = (rc.top + rc.bottom) / 2;
+ pt.x = 0;
+ ScreenToClient(m_hwnd, &pt);
+ originalSplitterY = pt.y;
+ if (splitterY == -1)
+ splitterY = originalSplitterY + 60;
+
+ GetWindowRect(m_message.GetHwnd(), &rc);
+ minEditBoxSize.cx = rc.right - rc.left;
+ minEditBoxSize.cy = rc.bottom - rc.top;
+
+ BB_InitDlgButtons();
+ SendMessage(m_hwnd, WM_CBD_LOADICONS, 0, 0);
+
+ SendDlgItemMessage(m_hwnd, IDC_ADD, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(m_hwnd, IDC_CANCELADD, BUTTONSETASFLATBTN, TRUE, 0);
+
+ SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, CSkin::IsThemed(), 0);
+ SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)pContainer, 0);
+ SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
+
+ TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING, 0);
+
+ for (int i = 0; i < _countof(tooltips); i++)
+ SendDlgItemMessage(m_hwnd, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE);
+
+ SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, bNotOnList ? TranslateT("Contact not on list. You may add it...") :
+ TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+
+ SendDlgItemMessage(m_hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_UNICODE);
+ SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Click for contact menu\nClick dropdown for window settings"), BATF_UNICODE);
+
+ SetDlgItemText(m_hwnd, IDC_RETRY, TranslateT("Retry"));
+ {
+ UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
+ for (int i = 0; i < _countof(_ctrls); i++) {
+ SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
+ SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
+ }
+ }
+
+ SetDlgItemText(m_hwnd, IDC_CANCELSEND, TranslateT("Cancel"));
+ SetDlgItemText(m_hwnd, IDC_MSGSENDLATER, TranslateT("Send later"));
+
+ m_log.SendMsg(EM_SETUNDOLIMIT, 0, 0);
+ m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_LINK);
+ m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+
+ m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
+ m_message.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
- int showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- BOOL bBottomToolbar = dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0;
- static LONG rcLogBottom;
+ bActualHistory = M.GetByte(m_hContact, "ActualHistory", 0);
- int panelHeight = dat->Panel->getHeight() + 1;
- int s_offset = 0;
- bool bInfoPanel = dat->Panel->isActive();
- bool fErrorState = (dat->dwFlags & MWF_ERRORSTATE) ? true : false;
+ /* OnO: higligh lines to their end */
+ m_log.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
- GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
- GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rcButton);
+ m_log.SendMsg(EM_SETLANGOPTIONS, 0, m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST);
- if (dat->panelStatusCX == 0)
- dat->panelStatusCX = 80;
+ // add us to the tray list (if it exists)
+ if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && szProto != NULL)
+ UpdateTrayMenu(0, wStatus, szProto, szStatus, m_hContact, FALSE);
- s_offset = 1;
+ m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
+ m_log.SendMsg(EM_EXLIMITTEXT, 0, 0x80000000);
+
+ // 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_MULTISPLITTER), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), SplitterSubclassProc);
+
+ // load old messages from history (if wanted...)
+ cache->updateStats(TSessionStats::INIT_TIMER);
+ if (m_hContact) {
+ FindFirstEvent();
+ nMax = (int)cache->getMaxMessageLength();
+ }
+ LoadContactAvatar();
+ SendMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ LoadOwnAvatar();
+
+ // restore saved msg if any...
+ if (m_hContact) {
+ ptrW tszSavedMsg(db_get_wsa(m_hContact, SRMSGMOD, "SavedMsg"));
+ if (tszSavedMsg != 0) {
+ SETTEXTEX stx = { ST_DEFAULT, 1200 };
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, tszSavedMsg);
+ SendQueue::UpdateSaveAndSendButton(this);
+ if (pContainer->hwndActive == m_hwnd)
+ UpdateReadChars();
+ }
+ }
+ if (newData->szInitialText) {
+ if (newData->isWchar)
+ SetDlgItemTextW(m_hwnd, IDC_MESSAGE, (wchar_t*)newData->szInitialText);
+ else
+ SetDlgItemTextA(m_hwnd, IDC_MESSAGE, newData->szInitialText);
+ int len = GetWindowTextLength(m_message.GetHwnd());
+ PostMessage(m_message.GetHwnd(), EM_SETSEL, len, len);
+ if (len)
+ EnableSendButton(true);
+ }
+
+ for (MEVENT hdbEvent = db_event_last(m_hContact); hdbEvent; hdbEvent = db_event_prev(m_hContact, hdbEvent)) {
+ DBEVENTINFO dbei = {};
+ db_event_get(hdbEvent, &dbei);
+ if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
+ lastMessage = dbei.timestamp;
+ DM_UpdateLastMessage(this);
+ break;
+ }
+ }
+
+ SendMessage(pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
+ {
+ WNDCLASS wndClass = { 0 };
+ GetClassInfo(g_hInst, L"RICHEDIT50W", &wndClass);
+ 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);
+ LoadSplitter();
+ ShowPicture(true);
+
+ if (pContainer->dwFlags & CNT_CREATE_MINIMIZED || !newData->iActivate || pContainer->dwFlags & CNT_DEFERREDTABSELECT) {
+ iFlashIcon = PluginConfig.g_IconMsgEvent;
+ SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
+ m_bCanFlashTab = true;
+
+ DBEVENTINFO dbei = { 0 };
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ FlashOnClist(hDbEventFirst, &dbei);
+
+ SendMessage(pContainer->hwnd, DM_SETICON, (WPARAM)this, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ pContainer->dwFlags |= CNT_NEED_UPDATETITLE;
+ dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL;
+ }
+
+ if (newData->iActivate) {
+ pContainer->hwndActive = m_hwnd;
+ ShowWindow(m_hwnd, SW_SHOW);
+ SetActiveWindow(m_hwnd);
+ SetForegroundWindow(m_hwnd);
+ }
+ else if (pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
+ dwFlags |= MWF_DEFERREDSCROLL;
+ ShowWindow(m_hwnd, SW_SHOWNOACTIVATE);
+ pContainer->hwndActive = m_hwnd;
+ pContainer->dwFlags |= CNT_DEFERREDCONFIGURE;
+ }
+ PostMessage(pContainer->hwnd, DM_UPDATETITLE, m_hContact, 0);
+
+ DM_RecalcPictureSize();
+ dwLastActivity = GetTickCount() - 1000;
+ pContainer->dwLastActivity = dwLastActivity;
+
+ if (hwndHPP)
+ mir_subclassWindow(hwndHPP, HPPKFSubclassProc);
+
+ 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, cache->getActiveProto());
+ }
+
+ if (pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
+ pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
+ pContainer->hwndActive = m_hwnd;
+ }
+}
+
+void CSrmmWindow::OnDestroy()
+{
+ memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
+ PostMessage(pContainer->hwnd, WM_SIZE, 0, 1);
+ if (pContainer->dwFlags & CNT_SIDEBAR)
+ pContainer->SideBar->removeSession(this);
+ cache->setWindowData();
+ if (cache->isValid() && !fIsReattach && m_hContact && M.GetByte("deletetemp", 0))
+ if (db_get_b(m_hContact, "CList", "NotOnList", 0))
+ db_delete_contact(m_hContact);
+
+ delete Panel;
+
+ if (hwndContactPic)
+ DestroyWindow(hwndContactPic);
+
+ if (hwndPanelPic)
+ DestroyWindow(hwndPanelPic);
+
+ if (hClientIcon)
+ DestroyIcon(hClientIcon);
+
+ if (hwndPanelPicParent)
+ DestroyWindow(hwndPanelPicParent);
+
+ if (cache->isValid()) { // not valid means the contact was deleted
+ TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING, 0);
+ AddContactToFavorites(m_hContact, cache->getNick(), cache->getActiveProto(), szStatus, wStatus,
+ Skin_LoadProtoIcon(cache->getActiveProto(), cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
+ if (m_hContact) {
+ if (!fEditNotesActive) {
+ char *msg = Message_GetFromStream(m_message.GetHwnd(), SF_TEXT);
+ if (msg) {
+ db_set_utf(m_hContact, SRMSGMOD, "SavedMsg", msg);
+ mir_free(msg);
+ }
+ else db_unset(m_hContact, SRMSGMOD, "SavedMsg");
+ }
+ else SendMessage(m_hwnd, WM_COMMAND, IDC_PIC, 0);
+ }
+ }
+
+ if (nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
+
+ DM_FreeTheme();
+
+ mir_free(sendBuffer);
+ mir_free(hHistoryEvents);
+
+ // search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
+ // messages in the queue as they can be acked later
+ {
+ SendJob *jobs = sendQueue->getJobByIndex(0);
+
+ for (int i = 0; i < SendQueue::NR_SENDJOBS; i++) {
+ if (jobs[i].hContact == m_hContact) {
+ if (jobs[i].iStatus >(unsigned)SendQueue::SQ_INPROGRESS)
+ sendQueue->clearJob(i);
+
+ // unfinished jobs which did not yet return anything are kept in the queue.
+ // the hwndOwner is set to 0 because the window handle is now no longer valid.
+ // Response for such a job is still silently handled by AckMessage() (sendqueue.c)
+ if (jobs[i].iStatus == (unsigned)SendQueue::SQ_INPROGRESS)
+ jobs[i].hOwnerWnd = 0;
+ }
+ }
+ }
+
+ mir_free(hQueuedEvents);
+
+ if (hSmileyIcon)
+ DestroyIcon(hSmileyIcon);
+
+ if (hXStatusIcon)
+ DestroyIcon(hXStatusIcon);
+
+ if (hwndTip)
+ DestroyWindow(hwndTip);
+
+ if (hTaskbarIcon)
+ DestroyIcon(hTaskbarIcon);
+
+ UpdateTrayMenuState(this, FALSE); // remove me from the tray menu (if still there)
+ if (PluginConfig.g_hMenuTrayUnread)
+ DeleteMenu(PluginConfig.g_hMenuTrayUnread, m_hContact, MF_BYCOMMAND);
+ M.RemoveWindow(m_hwnd);
+
+ if (cache->isValid())
+ db_set_dw(0, SRMSGMOD, "multisplit", multiSplitterX);
+
+ {
+ int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd);
+ if (i >= 0) {
+ SendMessage(m_hwndParent, WM_USER + 100, 0, 0); // remove tooltip
+ TabCtrl_DeleteItem(m_hwndParent, i);
+ BroadCastContainer(pContainer, DM_REFRESHTABINDEX, 0, 0);
+ iTabID = -1;
+ }
+ }
+
+ TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE, 0);
+
+ // clean up IEView and H++ log windows
+ if (hwndIEView != 0) {
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_DESTROY;
+ ieWindow.hwnd = hwndIEView;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
+ }
+ if (hwndHPP) {
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_DESTROY;
+ ieWindow.hwnd = hwndHPP;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+ }
+ if (pWnd) {
+ delete pWnd;
+ pWnd = 0;
+ }
+ if (sbCustom) {
+ delete sbCustom;
+ sbCustom = 0;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// resizer proc for the "new" layout.
+
+int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc)
+{
+ int panelHeight = Panel->getHeight() + 1;
+
+ bool bInfoPanel = Panel->isActive();
+ bool bErrorState = (dwFlags & MWF_ERRORSTATE) != 0;
+ bool bShowToolbar = (pContainer->dwFlags & CNT_HIDETOOLBAR) == 0;
+ bool bBottomToolbar = (pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0;
+
+ RECT rc, rcButton;
+ GetClientRect(m_log.GetHwnd(), &rc);
+ GetClientRect(GetDlgItem(m_hwnd, IDC_PROTOCOL), &rcButton);
+
+ if (panelStatusCX == 0)
+ panelStatusCX = 80;
switch (urc->wId) {
case IDC_PANELSPLITTER:
@@ -966,14 +1379,14 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
case IDC_LOG:
- if (dat->dwFlags & MWF_ERRORSTATE)
+ if (dwFlags & MWF_ERRORSTATE)
urc->rcItem.bottom -= ERRORPANEL_HEIGHT;
- if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || dat->bNotOnList)
+ if (dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || bNotOnList)
urc->rcItem.bottom -= 20;
- if (dat->sendMode & SMODE_MULTIPLE)
- urc->rcItem.right -= (dat->multiSplitterX + 3);
- urc->rcItem.bottom -= dat->splitterY - dat->originalSplitterY;
- if (!showToolbar || bBottomToolbar)
+ if (sendMode & SMODE_MULTIPLE)
+ urc->rcItem.right -= (multiSplitterX + 3);
+ urc->rcItem.bottom -= splitterY - originalSplitterY;
+ if (!bShowToolbar || bBottomToolbar)
urc->rcItem.bottom += 21;
if (bInfoPanel)
urc->rcItem.top += panelHeight;
@@ -991,53 +1404,52 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDC_CONTACTPIC:
- GetClientRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
- urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
- urc->rcItem.left = urc->rcItem.right - (dat->pic.cx + 2);
- if ((urc->rcItem.bottom - urc->rcItem.top) < (dat->pic.cy/* + 2*/) && dat->bShowAvatar) {
- urc->rcItem.top = urc->rcItem.bottom - dat->pic.cy;
- dat->bUseOffset = true;
+ GetClientRect(GetDlgItem(m_hwnd, IDC_MESSAGE), &rc);
+ urc->rcItem.top -= splitterY - originalSplitterY;
+ urc->rcItem.left = urc->rcItem.right - (pic.cx + 2);
+ if ((urc->rcItem.bottom - urc->rcItem.top) < (pic.cy/* + 2*/) && bShowAvatar) {
+ urc->rcItem.top = urc->rcItem.bottom - pic.cy;
+ bUseOffset = true;
}
- else dat->bUseOffset = false;
+ else bUseOffset = false;
- if (showToolbar && bBottomToolbar && (PluginConfig.m_bAlwaysFullToolbarWidth || ((dat->pic.cy - DPISCALEY_S(6)) < rc.bottom))) {
+ if (bShowToolbar && bBottomToolbar && (PluginConfig.m_bAlwaysFullToolbarWidth || ((pic.cy - DPISCALEY_S(6)) < rc.bottom))) {
urc->rcItem.bottom -= DPISCALEY_S(22);
- if (dat->bIsAutosizingInput) {
+ if (bIsAutosizingInput) {
urc->rcItem.left--;
urc->rcItem.top--;
}
}
- 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);
+ if (hwndContactPic) //if Panel control was created?
+ SetWindowPos(hwndContactPic, HWND_TOP, 1, ((urc->rcItem.bottom - urc->rcItem.top) - (pic.cy)) / 2 + 1, //resizes it
+ pic.cx - 2, pic.cy - 2, SWP_SHOWWINDOW);
return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
case IDC_SPLITTER:
urc->rcItem.right = urc->dlgNewSize.cx;
- urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
+ urc->rcItem.top -= splitterY - originalSplitterY;
urc->rcItem.bottom = urc->rcItem.top + 2;
OffsetRect(&urc->rcItem, 0, 1);
urc->rcItem.left = 0;
- if (dat->bUseOffset)
- urc->rcItem.right -= (dat->pic.cx); // + DPISCALEX(2));
+ if (bUseOffset)
+ urc->rcItem.right -= (pic.cx); // + DPISCALEX(2));
return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
case IDC_MESSAGE:
urc->rcItem.right = urc->dlgNewSize.cx;
- if (dat->bShowAvatar)
- urc->rcItem.right -= dat->pic.cx + 2;
- urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
- if (bBottomToolbar&&showToolbar)
+ if (bShowAvatar)
+ urc->rcItem.right -= pic.cx + 2;
+ urc->rcItem.top -= splitterY - originalSplitterY;
+ if (bBottomToolbar && bShowToolbar)
urc->rcItem.bottom -= DPISCALEY_S(22);
- if (dat->bIsAutosizingInput)
+ if (bIsAutosizingInput)
urc->rcItem.top -= DPISCALEY_S(1);
msgTop = urc->rcItem.top;
- msgBottom = urc->rcItem.bottom;
if (CSkin::m_skinEnabled) {
CSkinItem *item = &SkinItems[ID_EXTBKINPUTAREA];
if (!item->IGNORED) {
@@ -1052,8 +1464,8 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * case IDC_MULTISPLITTER:
if (bInfoPanel)
urc->rcItem.top += panelHeight;
- urc->rcItem.left -= dat->multiSplitterX;
- urc->rcItem.right -= dat->multiSplitterX;
+ urc->rcItem.left -= multiSplitterX;
+ urc->rcItem.right -= multiSplitterX;
urc->rcItem.bottom = rcLogBottom;
return RD_ANCHORX_RIGHT | RD_ANCHORY_HEIGHT;
@@ -1061,7 +1473,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc->rcItem.right = urc->dlgNewSize.cx - 50;
urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
urc->rcItem.top = msgTop - 16 - (bBottomToolbar ? 0 : 28);
- if (!showToolbar && !bBottomToolbar) {
+ if (!bShowToolbar && !bBottomToolbar) {
urc->rcItem.bottom += 21;
urc->rcItem.top += 21;
}
@@ -1072,7 +1484,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc->rcItem.top = msgTop - 18 - (bBottomToolbar ? 0 : 28);
urc->rcItem.right = urc->dlgNewSize.cx - 28;
urc->rcItem.left = urc->rcItem.right - 20;
- if (!showToolbar && !bBottomToolbar) {
+ if (!bShowToolbar && !bBottomToolbar) {
urc->rcItem.bottom += 21;
urc->rcItem.top += 21;
}
@@ -1083,7 +1495,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc->rcItem.top = msgTop - 18 - (bBottomToolbar ? 0 : 28);
urc->rcItem.right = urc->dlgNewSize.cx - 4;
urc->rcItem.left = urc->rcItem.right - 20;
- if (!showToolbar && !bBottomToolbar) {
+ if (!bShowToolbar && !bBottomToolbar) {
urc->rcItem.bottom += 21;
urc->rcItem.top += 21;
}
@@ -1095,11 +1507,11 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * case IDC_RETRY:
case IDC_CANCELSEND:
case IDC_MSGSENDLATER:
- if (fErrorState) {
- urc->rcItem.bottom = msgTop - 5 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
- urc->rcItem.top = msgTop - 25 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ if (bErrorState) {
+ urc->rcItem.bottom = msgTop - 5 - (bBottomToolbar ? 0 : 28) - ((bNotOnList || dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ urc->rcItem.top = msgTop - 25 - (bBottomToolbar ? 0 : 28) - ((bNotOnList || dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
}
- if (!showToolbar && !bBottomToolbar) {
+ if (!bShowToolbar && !bBottomToolbar) {
urc->rcItem.bottom += 21;
urc->rcItem.top += 21;
}
@@ -1107,11 +1519,11 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * case IDC_STATICTEXT:
case IDC_STATICERRORICON:
- if (fErrorState) {
- urc->rcItem.bottom = msgTop - 28 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
- urc->rcItem.top = msgTop - 45 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ if (bErrorState) {
+ urc->rcItem.bottom = msgTop - 28 - (bBottomToolbar ? 0 : 28) - ((bNotOnList || dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ urc->rcItem.top = msgTop - 45 - (bBottomToolbar ? 0 : 28) - ((bNotOnList || dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
}
- if (!showToolbar && !bBottomToolbar) {
+ if (!bShowToolbar && !bBottomToolbar) {
urc->rcItem.bottom += 21;
urc->rcItem.top += 21;
}
@@ -1120,319 +1532,15 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
}
-INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// dialog procedure
+
+INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- TContainerData *m_pContainer = 0;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- HWND hwndTab = GetParent(hwndDlg), hwndContainer;
POINT pt, tmp, cur;
RECT rc;
- TNewWindowData *newData;
-
- if (dat == 0) {
- if (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)
- return 0;
- hwndContainer = NULL;
- }
- else {
- m_pContainer = dat->pContainer;
- hwndContainer = m_pContainer->hwnd;
- }
switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- newData = (TNewWindowData*)lParam;
-
- dat = (TWindowData*)mir_calloc(sizeof(TWindowData));
- if (newData->iTabID >= 0) {
- dat->pContainer = newData->pContainer;
- m_pContainer = dat->pContainer;
- hwndContainer = m_pContainer->hwnd;
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
-
- if (Utils::rtf_ctable == 0)
- Utils::RTF_CTableInit();
-
- dat->dwFlags |= MWF_INITMODE;
- dat->bType = SESSIONTYPE_IM;
- dat->fInsertMode = FALSE;
- dat->fLimitedUpdate = false;
- dat->Panel = new CInfoPanel(dat);
-
- newData->item.lParam = (LPARAM)hwndDlg;
- TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item);
- dat->iTabID = newData->iTabID;
- dat->hwnd = hwndDlg;
-
- DM_ThemeChanged(dat);
-
- pszIDCSAVE_close = TranslateT("Close session");
- pszIDCSAVE_save = TranslateT("Save and close session");
-
- dat->hContact = newData->hContact;
- dat->cache = CContactCache::getContactCache(dat->hContact);
- dat->cache->updateNick();
- dat->cache->setWindowData(hwndDlg, dat);
- M.AddWindow(hwndDlg, dat->hContact);
- BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
- CProxyWindow::add(dat);
- dat->szProto = const_cast<char *>(dat->cache->getProto());
- dat->bIsMeta = dat->cache->isMeta();
- if (dat->bIsMeta)
- dat->cache->updateMeta();
-
- dat->cache->updateUIN();
-
- if (dat->hContact && dat->szProto != NULL) {
- dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- wcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
- }
- else dat->wStatus = ID_STATUS_OFFLINE;
-
- for (int i = 0; i < _countof(btnControls); i++)
- CustomizeButton(GetDlgItem(hwndDlg, btnControls[i]));
-
- GetMYUIN(dat);
- GetClientIcon(dat);
-
- CustomizeButton(CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
- hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL));
- dat->hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, L"Static", L"", SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndDlg, (HMENU)6000, NULL, NULL);
- mir_subclassWindow(dat->hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
-
- dat->bShowUIElements = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0;
- dat->sendMode |= dat->hContact == 0 ? SMODE_MULTIPLE : 0;
- dat->sendMode |= M.GetByte(dat->hContact, "no_ack", 0) ? SMODE_NOACK : 0;
-
- dat->hQueuedEvents = (MEVENT*)mir_calloc(sizeof(MEVENT)* EVENT_QUEUE_SIZE);
- dat->iEventQueueSize = EVENT_QUEUE_SIZE;
- dat->iCurrentQueueError = -1;
-
- // message history limit
- // hHistoryEvents holds up to n event handles
- dat->maxHistory = M.GetDword(dat->hContact, "maxhist", M.GetDword("maxhist", 0));
- dat->curHistory = 0;
- if (dat->maxHistory)
- dat->hHistoryEvents = (MEVENT*)mir_alloc(dat->maxHistory * sizeof(MEVENT));
- else
- dat->hHistoryEvents = NULL;
-
- if (dat->bIsMeta)
- SendMessage(hwndDlg, DM_UPDATEMETACONTACTINFO, 0, 0);
- else
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
- dat->bTabFlash = FALSE;
- dat->mayFlashTab = FALSE;
- GetMyNick(dat);
-
- dat->multiSplitterX = (int)M.GetDword(SRMSGMOD, "multisplit", 150);
- dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
- SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
- dat->iLastEventType = 0xffffffff;
-
- // load log option flags...
- dat->dwFlags = dat->pContainer->theme.dwFlags;
-
- // consider per-contact message setting overrides
- if (dat->hContact && M.GetDword(dat->hContact, "mwmask", 0))
- LoadLocalFlags(dat);
-
- DM_InitTip(dat);
- dat->Panel->getVisibility();
-
- dat->dwFlagsEx |= M.GetByte(dat->hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
- dat->bIsAutosizingInput = IsAutoSplitEnabled(dat);
- dat->iInputAreaHeight = -1;
- SetMessageLog(dat);
- if (dat->hContact)
- dat->Panel->loadHeight();
-
- dat->bShowAvatar = GetAvatarVisibility(hwndDlg, dat);
-
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, SW_HIDE);
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc);
- pt.y = (rc.top + rc.bottom) / 2;
- pt.x = 0;
- ScreenToClient(hwndDlg, &pt);
- dat->originalSplitterY = pt.y;
- if (dat->splitterY == -1)
- dat->splitterY = dat->originalSplitterY + 60;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
- dat->minEditBoxSize.cx = rc.right - rc.left;
- dat->minEditBoxSize.cy = rc.bottom - rc.top;
-
- BB_InitDlgButtons(dat);
- SendMessage(hwndDlg, WM_CBD_LOADICONS, 0, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_ADD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CANCELADD, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, CSkin::IsThemed(), 0);
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
-
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
-
- for (int i = 0; i < _countof(tooltips); i++)
- SendDlgItemMessage(hwndDlg, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE);
-
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
- TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
-
- SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Click for contact menu\nClick dropdown for window settings"), BATF_UNICODE);
-
- SetDlgItemText(hwndDlg, IDC_RETRY, TranslateT("Retry"));
- {
- UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
- for (int i = 0; i < _countof(_ctrls); i++) {
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
- }
- }
-
- SetDlgItemText(hwndDlg, IDC_CANCELSEND, TranslateT("Cancel"));
- SetDlgItemText(hwndDlg, IDC_MSGSENDLATER, TranslateT("Send later"));
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETUNDOLIMIT, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_LINK);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
-
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
-
- dat->bActualHistory = M.GetByte(dat->hContact, "ActualHistory", 0);
-
- /* OnO: higligh lines to their end */
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST);
-
- // add us to the tray list (if it exists)
- if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
- UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXLIMITTEXT, 0, 0x80000000);
-
- // subclassing stuff
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CONTACTPIC), AvatarSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), SplitterSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), SplitterSubclassProc);
-
- // load old messages from history (if wanted...)
- dat->cache->updateStats(TSessionStats::INIT_TIMER);
- if (dat->hContact) {
- FindFirstEvent(dat);
- dat->nMax = (int)dat->cache->getMaxMessageLength();
- }
- LoadContactAvatar(dat);
- SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- LoadOwnAvatar(dat);
-
- // restore saved msg if any...
- if (dat->hContact) {
- ptrW tszSavedMsg(db_get_wsa(dat->hContact, SRMSGMOD, "SavedMsg"));
- if (tszSavedMsg != 0) {
- SETTEXTEX stx = { ST_DEFAULT, 1200 };
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, tszSavedMsg);
- SendQueue::UpdateSaveAndSendButton(dat);
- if (m_pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
- }
- }
- if (newData->szInitialText) {
- if (newData->isWchar)
- SetDlgItemTextW(hwndDlg, IDC_MESSAGE, (wchar_t*)newData->szInitialText);
- else
- SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
- PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
- if (len)
- EnableSendButton(dat, TRUE);
- }
-
- for (MEVENT hdbEvent = db_event_last(dat->hContact); hdbEvent; hdbEvent = db_event_prev(dat->hContact, hdbEvent)) {
- DBEVENTINFO dbei = {};
- db_event_get(hdbEvent, &dbei);
- if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
- dat->lastMessage = dbei.timestamp;
- DM_UpdateLastMessage(dat);
- break;
- }
- }
-
- SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
- {
- WNDCLASS wndClass = { 0 };
- GetClassInfo(g_hInst, L"RICHEDIT50W", &wndClass);
- mir_subclassWindowFull(GetDlgItem(hwndDlg, IDC_LOG), MessageLogSubclassProc, wndClass.lpfnWndProc);
- }
-
- SetWindowPos(hwndDlg, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), newData->iActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
- LoadSplitter(dat);
- ShowPicture(dat, TRUE);
-
- if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED || !newData->iActivate || m_pContainer->dwFlags & CNT_DEFERREDTABSELECT) {
- dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
- SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
- dat->mayFlashTab = true;
-
- DBEVENTINFO dbei = { 0 };
- dbei.eventType = EVENTTYPE_MESSAGE;
- FlashOnClist(hwndDlg, dat, dat->hDbEventFirst, &dbei);
-
- SendMessage(hwndContainer, DM_SETICON, (WPARAM)dat, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
- m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE;
- dat->dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL;
- }
-
- if (newData->iActivate) {
- m_pContainer->hwndActive = hwndDlg;
- ShowWindow(hwndDlg, SW_SHOW);
- SetActiveWindow(hwndDlg);
- SetForegroundWindow(hwndDlg);
- }
- else if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
- dat->dwFlags |= MWF_DEFERREDSCROLL;
- ShowWindow(hwndDlg, SW_SHOWNOACTIVATE);
- m_pContainer->hwndActive = hwndDlg;
- m_pContainer->dwFlags |= CNT_DEFERREDCONFIGURE;
- }
- PostMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0);
-
- DM_RecalcPictureSize(dat);
- dat->dwLastActivity = GetTickCount() - 1000;
- m_pContainer->dwLastActivity = dat->dwLastActivity;
-
- if (dat->hwndHPP)
- mir_subclassWindow(dat->hwndHPP, HPPKFSubclassProc);
-
- dat->dwFlags &= ~MWF_INITMODE;
- TABSRMM_FireEvent(dat->hContact, hwndDlg, 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(dat->hContact, newData->hdbEvent, dbei.eventType, 0, 0, hwndDlg, dat->cache->getActiveProto());
- }
- if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
- m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
- m_pContainer->hwndActive = hwndDlg;
- return FALSE;
- }
- return newData->iActivate != 0;
-
case WM_ERASEBKGND:
RECT rcClient, rcWindow;
{
@@ -1441,7 +1549,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l HBITMAP hbm, hbmOld;
HANDLE hpb = 0;
- GetClientRect(hwndDlg, &rcClient);
+ GetClientRect(m_hwnd, &rcClient);
DWORD cx = rcClient.right - rcClient.left;
DWORD cy = rcClient.bottom - rcClient.top;
@@ -1460,19 +1568,19 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (CSkin::m_skinEnabled) {
UINT item_ids[2] = { ID_EXTBKHISTORY, ID_EXTBKINPUTAREA };
UINT ctl_ids[2] = { IDC_LOG, IDC_MESSAGE };
- BOOL isEditNotesReason = dat->fEditNotesActive;
- BOOL isSendLaterReason = (dat->sendMode & SMODE_SENDLATER);
- BOOL isMultipleReason = (dat->sendMode & SMODE_MULTIPLE || dat->sendMode & SMODE_CONTAINER);
+ BOOL isEditNotesReason = fEditNotesActive;
+ BOOL isSendLaterReason = (sendMode & SMODE_SENDLATER);
+ BOOL isMultipleReason = (sendMode & SMODE_MULTIPLE || sendMode & SMODE_CONTAINER);
- CSkin::SkinDrawBG(hwndDlg, hwndContainer, m_pContainer, &rcClient, hdcMem);
+ CSkin::SkinDrawBG(m_hwnd, pContainer->hwnd, pContainer, &rcClient, hdcMem);
for (int i = 0; i < 2; i++) {
CSkinItem *item = &SkinItems[item_ids[i]];
if (!item->IGNORED) {
- GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow);
+ GetWindowRect(GetDlgItem(m_hwnd, ctl_ids[i]), &rcWindow);
pt.x = rcWindow.left;
pt.y = rcWindow.top;
- ScreenToClient(hwndDlg, &pt);
+ ScreenToClient(m_hwnd, &pt);
rc.left = pt.x - item->MARGIN_LEFT;
rc.top = pt.y - item->MARGIN_TOP;
rc.right = rc.left + item->MARGIN_RIGHT + (rcWindow.right - rcWindow.left) + item->MARGIN_LEFT;
@@ -1491,22 +1599,22 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (M.isAero()) {
LONG temp = rcClient.bottom;
- rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5;
+ rcClient.bottom = Panel->isActive() ? Panel->getHeight() + 5 : 5;
FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
rcClient.bottom = temp;
}
}
// draw the (new) infopanel background. Use the gradient from the statusitem.
- GetClientRect(hwndDlg, &rc);
- dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
+ GetClientRect(m_hwnd, &rc);
+ Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
// draw aero related stuff
if (!CSkin::m_skinEnabled)
- CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
+ RenderToolbarBG(hdcMem, rcClient);
// render info panel fields
- dat->Panel->renderContent(hdcMem);
+ Panel->renderContent(hdcMem);
if (hpb)
CSkin::FinalizeBufferedPaint(hpb, &rcClient);
@@ -1516,125 +1624,114 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DeleteObject(hbm);
DeleteDC(hdcMem);
}
- if (!dat->fLimitedUpdate)
- SetAeroMargins(dat->pContainer);
+ if (!fLimitedUpdate)
+ SetAeroMargins(pContainer);
}
return 1;
- case WM_NCPAINT:
- return 0;
-
- case WM_PAINT:
- // in skinned mode only, draw the background elements for the 2 richedit controls
- // this allows border-less textboxes to appear "skinned" and blended with the background
- PAINTSTRUCT ps;
- BeginPaint(hwndDlg, &ps);
- EndPaint(hwndDlg, &ps);
- return 0;
-
case WM_SIZE:
- if (!IsIconic(hwndDlg)) {
- if (dat->ipFieldHeight == 0)
- dat->ipFieldHeight = CInfoPanel::m_ipConfig.height2;
-
- if (dat->pContainer->uChildMinHeight > 0 && HIWORD(lParam) >= dat->pContainer->uChildMinHeight) {
- if (dat->splitterY > HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT)) {
- dat->splitterY = HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT);
- dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
- DM_RecalcPictureSize(dat);
+ if (!IsIconic(m_hwnd)) {
+ if (ipFieldHeight == 0)
+ ipFieldHeight = CInfoPanel::m_ipConfig.height2;
+
+ if (pContainer->uChildMinHeight > 0 && HIWORD(lParam) >= pContainer->uChildMinHeight) {
+ if (splitterY > HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT)) {
+ splitterY = HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT);
+ dynaSplitter = splitterY - DPISCALEY_S(34);
+ DM_RecalcPictureSize();
}
- if (dat->splitterY < DPISCALEY_S(MINSPLITTERY))
- LoadSplitter(dat);
+ if (splitterY < DPISCALEY_S(MINSPLITTERY))
+ LoadSplitter();
}
- HBITMAP hbm = ((dat->Panel->isActive()) && m_pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
+ HBITMAP hbm = ((Panel->isActive()) && pContainer->avatarMode != 3) ? hOwnPic : (ace ? ace->hbmPic : PluginConfig.g_hbmUnknown);
if (hbm != 0) {
BITMAP bminfo;
GetObject(hbm, sizeof(bminfo), &bminfo);
- CalcDynamicAvatarSize(dat, &bminfo);
+ CalcDynamicAvatarSize(&bminfo);
}
- GetClientRect(hwndDlg, &rc);
+ GetClientRect(m_hwnd, &rc);
- Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_MSGSPLITNEW), MessageDialogResize, (LPARAM)dat);
+ CTabBaseDlg::DlgProc(uMsg, 0, 0); // call basic window resizer
- BB_SetButtonsPos(dat);
+ BB_SetButtonsPos();
// size info panel fields
- if (dat->Panel->isActive()) {
+ if (Panel->isActive()) {
LONG cx = rc.right;
- LONG panelHeight = dat->Panel->getHeight();
+ LONG panelHeight = Panel->getHeight();
- hbm = (m_pContainer->avatarMode == 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
+ hbm = (pContainer->avatarMode == 3) ? hOwnPic : (ace ? ace->hbmPic : PluginConfig.g_hbmUnknown);
double dHeight = 0, dWidth = 0;
Utils::scaleAvatarHeightLimited(hbm, dWidth, dHeight, panelHeight - 2);
- dat->iPanelAvatarX = (int)dWidth;
- dat->iPanelAvatarY = (int)dHeight;
+ iPanelAvatarX = (int)dWidth;
+ iPanelAvatarY = (int)dHeight;
rc.top = 1;
- rc.left = cx - dat->iPanelAvatarX;
+ rc.left = cx - iPanelAvatarX;
rc.bottom = panelHeight - (CSkin::m_bAvatarBorderType ? 2 : 0);
rc.right = cx;
- dat->rcPic = rc;
+ rcPic = rc;
- if (dat->bShowInfoAvatar) {
- SetWindowPos(dat->hwndPanelPicParent, HWND_TOP, rc.left - 2, rc.top, rc.right - rc.left, rc.bottom - rc.top + 1, 0);
- ShowWindow(dat->hwndPanelPicParent, (dat->iPanelAvatarX == 0) || !dat->Panel->isActive() ? SW_HIDE : SW_SHOW);
+ if (bShowInfoAvatar) {
+ SetWindowPos(hwndPanelPicParent, HWND_TOP, rc.left - 2, rc.top, rc.right - rc.left, rc.bottom - rc.top + 1, 0);
+ ShowWindow(hwndPanelPicParent, (iPanelAvatarX == 0) || !Panel->isActive() ? SW_HIDE : SW_SHOW);
}
else {
- ShowWindow(dat->hwndPanelPicParent, SW_HIDE);
- dat->iPanelAvatarX = dat->iPanelAvatarY = 0;
+ ShowWindow(hwndPanelPicParent, SW_HIDE);
+ iPanelAvatarX = iPanelAvatarY = 0;
}
- rc.right = cx - dat->iPanelAvatarX;
- rc.left = rc.right - dat->panelStatusCX;
+ rc.right = cx - iPanelAvatarX;
+ rc.left = rc.right - panelStatusCX;
rc.bottom = panelHeight - 3;
- rc.top = rc.bottom - dat->ipFieldHeight;
- dat->rcStatus = rc;
+ rc.top = rc.bottom - ipFieldHeight;
+ rcStatus = rc;
rc.left = CInfoPanel::LEFT_OFFSET_LOGO;
- rc.right = cx - dat->iPanelAvatarX - (panelHeight < CInfoPanel::DEGRADE_THRESHOLD ? (dat->rcStatus.right - dat->rcStatus.left) + 3 : 0);
- rc.bottom = panelHeight - (panelHeight >= CInfoPanel::DEGRADE_THRESHOLD ? dat->ipFieldHeight : 0) - 1;
+ rc.right = cx - iPanelAvatarX - (panelHeight < CInfoPanel::DEGRADE_THRESHOLD ? (rcStatus.right - rcStatus.left) + 3 : 0);
+ rc.bottom = panelHeight - (panelHeight >= CInfoPanel::DEGRADE_THRESHOLD ? ipFieldHeight : 0) - 1;
rc.top = 1;
- dat->rcNick = rc;
+ rcNick = rc;
rc.left = CInfoPanel::LEFT_OFFSET_LOGO;
- rc.right = cx - (dat->iPanelAvatarX + 2) - dat->panelStatusCX;
+ rc.right = cx - (iPanelAvatarX + 2) - panelStatusCX;
rc.bottom = panelHeight - 3;
- rc.top = rc.bottom - dat->ipFieldHeight;
- dat->rcUIN = rc;
+ rc.top = rc.bottom - ipFieldHeight;
+ rcUIN = rc;
- dat->Panel->Invalidate();
+ Panel->Invalidate();
}
- if (GetDlgItem(hwndDlg, IDC_CLIST) != 0) {
+ if (GetDlgItem(m_hwnd, IDC_CLIST) != 0) {
RECT rcLog;
- GetClientRect(hwndDlg, &rcClient);
- GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
+ GetClientRect(m_hwnd, &rcClient);
+ GetClientRect(m_log.GetHwnd(), &rcLog);
rc.top = 0;
rc.right = rcClient.right;
- rc.left = rcClient.right - dat->multiSplitterX;
+ rc.left = rcClient.right - multiSplitterX;
rc.bottom = rcLog.bottom;
- if (dat->Panel->isActive())
- rc.top += (dat->Panel->getHeight() + 1);
- MoveWindow(GetDlgItem(hwndDlg, IDC_CLIST), rc.left, rc.top, rc.right - rc.left, rcLog.bottom - rcLog.top, FALSE);
+ if (Panel->isActive())
+ rc.top += (Panel->getHeight() + 1);
+ MoveWindow(GetDlgItem(m_hwnd, IDC_CLIST), rc.left, rc.top, rc.right - rc.left, rcLog.bottom - rcLog.top, FALSE);
}
- if (dat->hwndIEView || dat->hwndHPP)
- ResizeIeView(dat);
+ if (hwndIEView || hwndHPP)
+ ResizeIeView();
- DetermineMinHeight(dat);
+ DetermineMinHeight();
}
- break;
+ return 0;
case WM_TIMECHANGE:
- PostMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
+ PostMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
break;
case WM_NOTIFY:
- if (dat != 0 && ((NMHDR*)lParam)->hwndFrom == dat->hwndTip) {
+ if (this != 0 && ((NMHDR*)lParam)->hwndFrom == hwndTip) {
if (((NMHDR*)lParam)->code == NM_CLICK)
- SendMessage(dat->hwndTip, TTM_TRACKACTIVATE, FALSE, 0);
+ SendMessage(hwndTip, TTM_TRACKACTIVATE, FALSE, 0);
break;
}
@@ -1648,118 +1745,118 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l WPARAM wp = ((MSGFILTER *)lParam)->wParam;
LPARAM lp = ((MSGFILTER *)lParam)->lParam;
CHARFORMAT2 cf2;
- BOOL isCtrl, isShift, isAlt;
- KbdState(dat, isShift, isCtrl, isAlt);
+ bool isCtrl, isShift, isAlt;
+ KbdState(isShift, isCtrl, isAlt);
MSG message;
- message.hwnd = hwndDlg;
+ message.hwnd = m_hwnd;
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();
+ if (!fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
+ pContainer->MenuBar->autoShow();
- return _dlgReturn(hwndDlg, 0);
+ return _dlgReturn(m_hwnd, 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;
+ fkeyProcessed = true;
switch (mim_hotkey_check) {
case TABSRMM_HK_SETUSERPREFS:
- CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
- return _dlgReturn(hwndDlg, 1);
+ CallService(MS_TABMSG_SETUSERPREFS, m_hContact, 0);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_NUDGE:
- SendNudge(dat);
- return _dlgReturn(hwndDlg, 1);
+ SendNudge();
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_SENDFILE:
- CallService(MS_FILE_SENDFILE, dat->hContact, 0);
- return _dlgReturn(hwndDlg, 1);
+ CallService(MS_FILE_SENDFILE, m_hContact, 0);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_QUOTEMSG:
- SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, WM_COMMAND, IDC_QUOTE, 0);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_USERMENU:
- SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOCOL, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, WM_COMMAND, IDC_PROTOCOL, 0);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_SENDMENU:
- SendMessage(hwndDlg, WM_COMMAND, IDC_SENDMENU, IDC_SENDMENU);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, WM_COMMAND, IDC_SENDMENU, IDC_SENDMENU);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_PROTOMENU:
- SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOMENU, IDC_PROTOMENU);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, WM_COMMAND, IDC_PROTOMENU, IDC_PROTOMENU);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_USERDETAILS:
- SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_EDITNOTES:
- PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
+ PostMessage(m_hwnd, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
+ return _dlgReturn(m_hwnd, 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 |
+ sendMode ^= SMODE_SENDLATER;
+ SetWindowPos(m_message.GetHwnd(), 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);
+ RedrawWindow(m_hwnd, 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);
+ return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_TOGGLERTL:
- dat->dwFlags ^= MWF_LOG_RTL;
+ 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);
+ DWORD dwMask = M.GetDword(m_hContact, "mwmask", 0);
+ DWORD dwFlags = M.GetDword(m_hContact, "mwflags", 0);
- if ((dwGlobal & MWF_LOG_RTL) != (dat->dwFlags & MWF_LOG_RTL)) {
+ if ((dwGlobal & MWF_LOG_RTL) != (dwFlags & MWF_LOG_RTL)) {
dwMask |= MWF_LOG_RTL;
- dwFlags |= (dat->dwFlags & MWF_LOG_RTL);
+ dwFlags |= (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);
+ db_set_dw(m_hContact, SRMSGMOD_T, "mwmask", dwMask);
+ db_set_dw(m_hContact, SRMSGMOD_T, "mwflags", dwFlags);
}
else {
- db_unset(dat->hContact, SRMSGMOD_T, "mwmask");
- db_unset(dat->hContact, SRMSGMOD_T, "mwflags");
+ db_unset(m_hContact, SRMSGMOD_T, "mwmask");
+ db_unset(m_hContact, SRMSGMOD_T, "mwflags");
}
- SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
+ SendMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ SendMessage(m_hwnd, DM_DEFERREDREMAKELOG, (WPARAM)m_hwnd, 0);
}
- return _dlgReturn(hwndDlg, 1);
+ return _dlgReturn(m_hwnd, 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));
+ sendMode ^= SMODE_MULTIPLE;
+ if (sendMode & SMODE_MULTIPLE)
+ DM_CreateClist();
+ else if (IsWindow(GetDlgItem(m_hwnd, IDC_CLIST)))
+ DestroyWindow(GetDlgItem(m_hwnd, IDC_CLIST));
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ HWND hwndEdit = m_message.GetHwnd();
SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(m_hwnd, 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));
+ DM_ScrollToBottom(this, 0, 0);
+ Utils::showDlgControl(m_hwnd, IDC_MULTISPLITTER, (sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_hwnd, IDC_CLIST, (sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ if (sendMode & SMODE_MULTIPLE)
+ SetFocus(GetDlgItem(m_hwnd, IDC_CLIST));
else
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
- return _dlgReturn(hwndDlg, 1);
+ SetFocus(m_message.GetHwnd());
+ RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ return _dlgReturn(m_hwnd, 1);
}
- if (DM_GenericHotkeysCheck(&message, dat)) {
- dat->fkeyProcessed = true;
- return _dlgReturn(hwndDlg, 1);
+ if (DM_GenericHotkeysCheck(&message, this)) {
+ fkeyProcessed = true;
+ return _dlgReturn(m_hwnd, 1);
}
}
if (wp == VK_BROWSER_BACK || wp == VK_BROWSER_FORWARD)
@@ -1769,10 +1866,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (isCtrl && !isShift && !isAlt) {
switch (wp) {
case 23: // ctrl - w
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
+ PostMessage(m_hwnd, WM_CLOSE, 1, 0);
break;
case 20: // ctrl - t
- PostMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 1);
+ PostMessage(m_hwnd, WM_COMMAND, IDC_TOGGLETOOLBAR, 1);
break;
}
return 1;
@@ -1780,112 +1877,112 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
if (msg == WM_KEYDOWN) {
if ((wp == VK_INSERT && isShift && !isCtrl) || (wp == 'V' && isCtrl && !isShift && !isAlt)) {
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ m_message.SendMsg(EM_PASTESPECIAL, CF_UNICODETEXT, 0);
_clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
+ return _dlgReturn(m_hwnd, 1);
}
if (isCtrl && isShift) {
if (wp == 0x9) { // ctrl-shift tab
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ SendMessage(m_hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0);
_clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
+ return _dlgReturn(m_hwnd, 1);
}
}
if (isCtrl && !isShift && !isAlt) {
if (wp == VK_TAB) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ SendMessage(m_hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
_clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_F4) {
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- return _dlgReturn(hwndDlg, 1);
+ PostMessage(m_hwnd, WM_CLOSE, 1, 0);
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_PRIOR) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_NEXT) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ return _dlgReturn(m_hwnd, 1);
}
}
}
if (msg == WM_SYSKEYDOWN && isAlt) {
if (wp == 0x52) {
- SendMessage(hwndDlg, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(m_hwnd, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_MULTIPLY) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
+ SetFocus(m_message.GetHwnd());
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_DIVIDE) {
- SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return _dlgReturn(hwndDlg, 1);
+ SetFocus(m_log.GetHwnd());
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_ADD) {
- SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(pContainer->hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ return _dlgReturn(m_hwnd, 1);
}
if (wp == VK_SUBTRACT) {
- SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return _dlgReturn(hwndDlg, 1);
+ SendMessage(pContainer->hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ return _dlgReturn(m_hwnd, 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..."));
+ return _dlgReturn(m_hwnd, 1);
+ if (dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
+ SendMessage(m_hwnd, DM_REPLAYQUEUE, 0, 0);
+ dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
+ Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, (bNotOnList || dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE);
+ if (!(dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ SetDlgItemText(m_hwnd, 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);
+ SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(this, 1, 1);
+ return _dlgReturn(m_hwnd, 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");
+ m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)"\t");
_clrMsgFilter(lParam);
if (((NMHDR*)lParam)->idFrom != IDC_MESSAGE)
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
+ SetFocus(m_message.GetHwnd());
+ return _dlgReturn(m_hwnd, 1);
}
else {
if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
- if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR))
- SetFocus(GetDlgItem(hwndDlg, IDOK));
+ if (GetSendButtonState(m_hwnd) != PBS_DISABLED && !(pContainer->dwFlags & CNT_HIDETOOLBAR))
+ SetFocus(GetDlgItem(m_hwnd, IDOK));
else
- SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return _dlgReturn(hwndDlg, 1);
+ SetFocus(m_log.GetHwnd());
+ return _dlgReturn(m_hwnd, 1);
}
if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
+ SetFocus(m_message.GetHwnd());
+ return _dlgReturn(m_hwnd, 1);
}
}
- return _dlgReturn(hwndDlg, 0);
+ return _dlgReturn(m_hwnd, 0);
}
if (msg == WM_MOUSEWHEEL && (((NMHDR*)lParam)->idFrom == IDC_LOG || ((NMHDR*)lParam)->idFrom == IDC_MESSAGE)) {
GetCursorPos(&pt);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
+ GetWindowRect(m_log.GetHwnd(), &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);
+ m_log.SendMsg(WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
else if (wDirection > 0)
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
+ m_log.SendMsg(WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
return 0;
}
return 0;
@@ -1895,56 +1992,56 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (msg == WM_CHAR && wp == 'c') {
if (isCtrl) {
- SendDlgItemMessage(hwndDlg, ((NMHDR*)lParam)->code, WM_COPY, 0, 0);
+ SendDlgItemMessage(m_hwnd, ((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);
+ int bBold = IsDlgButtonChecked(m_hwnd, IDC_FONTBOLD);
+ int bItalic = IsDlgButtonChecked(m_hwnd, IDC_FONTITALIC);
+ int bUnder = IsDlgButtonChecked(m_hwnd, IDC_FONTUNDERLINE);
+ int bStrikeout = IsDlgButtonChecked(m_hwnd, 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);
+ m_message.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
if (cf2.dwEffects & CFE_BOLD) {
if (bBold == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_FONTBOLD, BST_CHECKED);
}
else if (bBold == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_FONTBOLD, BST_UNCHECKED);
if (cf2.dwEffects & CFE_ITALIC) {
if (bItalic == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_FONTITALIC, BST_CHECKED);
}
else if (bItalic == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, 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);
+ CheckDlgButton(m_hwnd, IDC_FONTUNDERLINE, BST_CHECKED);
}
else if (bUnder == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_FONTUNDERLINE, BST_UNCHECKED);
if (cf2.dwEffects & CFE_STRIKEOUT) {
if (bStrikeout == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_FONTSTRIKEOUT, BST_CHECKED);
}
else if (bStrikeout == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
}
switch (msg) {
case WM_LBUTTONDOWN:
{
HCURSOR hCur = GetCursor();
- m_pContainer->MenuBar->Cancel();
+ 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);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
}
}
@@ -1958,7 +2055,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case WM_LBUTTONUP:
if (((NMHDR*)lParam)->idFrom == IDC_LOG && M.GetByte("autocopy", 1)) {
CHARRANGE cr;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&cr);
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&cr);
if (cr.cpMax == cr.cpMin)
break;
cr.cpMin = cr.cpMax;
@@ -1966,32 +2063,32 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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);
+ streamOut = Message_GetFromStream(m_log.GetHwnd(), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION);
else
- streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION);
+ streamOut = Message_GetFromStream(m_log.GetHwnd(), SF_TEXT | SFF_SELECTION);
if (streamOut) {
Utils::FilterEventMarkers(streamOut);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
mir_free(streamOut);
}
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ SetFocus(m_message.GetHwnd());
}
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"));
+ m_log.SendMsg(WM_COPY, 0, 0);
+ SetFocus(m_message.GetHwnd());
+ if (pContainer->hwndStatus)
+ SendMessage(pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)TranslateT("Selection copied to clipboard"));
}
}
break;
case WM_RBUTTONUP:
- return _dlgReturn(hwndDlg, 1);
+ return _dlgReturn(m_hwnd, 1);
case WM_MOUSEMOVE:
GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
+ DM_DismissTip(this, pt);
+ 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))
@@ -2002,146 +2099,103 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break;
case EN_REQUESTRESIZE:
- DM_HandleAutoSizeRequest(dat, (REQRESIZE *)lParam);
+ DM_HandleAutoSizeRequest(this, (REQRESIZE *)lParam);
break;
-
- case EN_LINK:
- ENLINK *pLink = (ENLINK*)lParam;
- switch (pLink->msg) {
- case WM_SETCURSOR:
- SetCursor(PluginConfig.hCurHyperlinkHand);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
-
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- ptrW tszUrl(Utils::extractURLFromRichEdit((ENLINK*)lParam, GetDlgItem(hwndDlg, IDC_LOG)));
- if (!IsStringValidLink(tszUrl))
- break;
-
- if (pLink->msg != WM_RBUTTONDOWN) {
- Utils_OpenUrlW(tszUrl);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- break;
- }
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hSubMenu = GetSubMenu(hMenu, 1);
- TranslateMenu(hSubMenu);
- pt.x = (short)LOWORD(pLink->lParam);
- pt.y = (short)HIWORD(pLink->lParam);
- ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case IDM_OPENNEW:
- Utils_OpenUrlW(tszUrl);
- break;
-
- case IDM_OPENEXISTING:
- Utils_OpenUrlW(tszUrl, false);
- break;
-
- case IDM_COPYLINK:
- Utils::CopyToClipBoard(tszUrl, hwndDlg);
- break;
- }
- DestroyMenu(hMenu);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
}
}
break;
case DM_TYPING:
{
- int preTyping = dat->nTypeSecs != 0;
- dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
+ int preTyping = nTypeSecs != 0;
+ nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
- if (dat->nTypeSecs)
- dat->bShowTyping = 0;
+ if (nTypeSecs)
+ bShowTyping = 0;
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, preTyping);
}
return TRUE;
case DM_UPDATEWINICON:
- if (dat->hXStatusIcon) {
- DestroyIcon(dat->hXStatusIcon);
- dat->hXStatusIcon = 0;
+ if (hXStatusIcon) {
+ DestroyIcon(hXStatusIcon);
+ hXStatusIcon = 0;
}
- if (LPCSTR szProto = dat->cache->getProto()) {
- dat->hTabIcon = dat->hTabStatusIcon = MY_GetContactIcon(dat, "MetaiconTab");
+ if (LPCSTR szProto = cache->getProto()) {
+ hTabIcon = hTabStatusIcon = GetMyContactIcon("MetaiconTab");
if (M.GetByte("use_xicons", 1))
- dat->hXStatusIcon = GetXStatusIcon(dat);
+ hXStatusIcon = GetXStatusIcon();
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONSETASDIMMED, (dat->dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : MY_GetContactIcon(dat, "MetaiconBar")));
+ SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BUTTONSETASDIMMED, (dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0);
+ SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(hXStatusIcon ? hXStatusIcon : GetMyContactIcon("MetaiconBar")));
- if (m_pContainer->hwndActive == hwndDlg)
- SendMessage(m_pContainer->hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
+ if (pContainer->hwndActive == m_hwnd)
+ SendMessage(pContainer->hwnd, DM_SETICON, (WPARAM)this, (LPARAM)(hXStatusIcon ? hXStatusIcon : hTabIcon));
- if (dat->pWnd)
- dat->pWnd->updateIcon(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon);
+ if (pWnd)
+ pWnd->updateIcon(hXStatusIcon ? hXStatusIcon : hTabIcon);
}
return 0;
// configures the toolbar only... if lParam != 0, then it also calls
// SetDialogToType() to reconfigure the message window
case DM_CONFIGURETOOLBAR:
- dat->bShowUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
+ bShowUIElements = pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
+ SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTER), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTER), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
if (lParam == 1) {
- GetSendFormat(dat);
- SetDialogToType(hwndDlg);
+ GetSendFormat();
+ SetDialogToType(m_hwnd);
}
if (lParam == 1) {
- DM_RecalcPictureSize(dat);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
+ DM_RecalcPictureSize();
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(this, 0, 1);
}
return 0;
case WM_CBD_LOADICONS:
for (int i = 0; i < _countof(buttonicons); i++) {
- SendDlgItemMessage(hwndDlg, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
- SendDlgItemMessage(hwndDlg, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
+ SendDlgItemMessage(m_hwnd, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
+ SendDlgItemMessage(m_hwnd, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)pContainer, 0);
}
- Srmm_UpdateToolbarIcons(hwndDlg);
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
+ Srmm_UpdateToolbarIcons(m_hwnd);
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
return 0;
case DM_OPTIONSAPPLIED:
- DM_OptionsApplied(dat, wParam, lParam);
+ DM_OptionsApplied(wParam, lParam);
return 0;
case DM_UPDATETITLE:
- DM_UpdateTitle(dat, wParam, lParam);
+ DM_UpdateTitle(wParam, lParam);
return 0;
case DM_UPDATESTATUSMSG:
- dat->Panel->Invalidate();
+ Panel->Invalidate();
return 0;
case DM_OWNNICKCHANGED:
- GetMyNick(dat);
+ GetMyNick();
return 0;
case DM_ADDDIVIDER:
- if (!(dat->dwFlags & MWF_DIVIDERSET) && PluginConfig.m_bUseDividers) {
- if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOG)) > 0) {
- dat->dwFlags |= MWF_DIVIDERWANTED;
- dat->dwFlags |= MWF_DIVIDERSET;
+ if (!(dwFlags & MWF_DIVIDERSET) && PluginConfig.m_bUseDividers) {
+ if (GetWindowTextLength(m_log.GetHwnd()) > 0) {
+ dwFlags |= MWF_DIVIDERWANTED;
+ dwFlags |= MWF_DIVIDERSET;
}
}
return 0;
case WM_SETFOCUS:
- MsgWindowUpdateState(dat, WM_SETFOCUS);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ MsgWindowUpdateState(WM_SETFOCUS);
+ SetFocus(m_message.GetHwnd());
return 1;
case WM_ACTIVATE:
@@ -2150,79 +2204,79 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l //fall through
case WM_MOUSEACTIVATE:
- MsgWindowUpdateState(dat, WM_ACTIVATE);
+ MsgWindowUpdateState(WM_ACTIVATE);
return 1;
case DM_UPDATEPICLAYOUT:
- LoadContactAvatar(dat);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ LoadContactAvatar();
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
return 0;
case DM_SPLITTERGLOBALEVENT:
- DM_SplitterGlobalEvent(dat, wParam, lParam);
+ DM_SplitterGlobalEvent(this, wParam, lParam);
return 0;
case DM_SPLITTERMOVED:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_MULTISPLITTER)) {
- GetClientRect(hwndDlg, &rc);
+ if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_MULTISPLITTER)) {
+ GetClientRect(m_hwnd, &rc);
pt.x = wParam;
pt.y = 0;
- ScreenToClient(hwndDlg, &pt);
- int oldSplitterX = dat->multiSplitterX;
- dat->multiSplitterX = rc.right - pt.x;
- if (dat->multiSplitterX < 25)
- dat->multiSplitterX = 25;
-
- if (dat->multiSplitterX > ((rc.right - rc.left) - 80))
- dat->multiSplitterX = oldSplitterX;
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
- }
- else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
- GetClientRect(hwndDlg, &rc);
- rc.top += (dat->Panel->isActive() ? dat->Panel->getHeight() + 40 : 30);
+ ScreenToClient(m_hwnd, &pt);
+ int oldSplitterX = multiSplitterX;
+ multiSplitterX = rc.right - pt.x;
+ if (multiSplitterX < 25)
+ multiSplitterX = 25;
+
+ if (multiSplitterX > ((rc.right - rc.left) - 80))
+ multiSplitterX = oldSplitterX;
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ }
+ else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTER)) {
+ GetClientRect(m_hwnd, &rc);
+ rc.top += (Panel->isActive() ? Panel->getHeight() + 40 : 30);
pt.x = 0;
pt.y = wParam;
- ScreenToClient(hwndDlg, &pt);
+ ScreenToClient(m_hwnd, &pt);
- int oldSplitterY = dat->splitterY;
- int oldDynaSplitter = dat->dynaSplitter;
+ int oldSplitterY = splitterY;
+ int oldDynaSplitter = dynaSplitter;
- dat->splitterY = rc.bottom - pt.y + DPISCALEY_S(23);
+ splitterY = rc.bottom - pt.y + DPISCALEY_S(23);
// attempt to fix splitter troubles..
// hardcoded limits... better solution is possible, but this works for now
int bottomtoolbarH = 0;
- if (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR)
+ if (pContainer->dwFlags & CNT_BOTTOMTOOLBAR)
bottomtoolbarH = 22;
- if (dat->splitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size
- dat->splitterY = (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH);
- dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
- DM_RecalcPictureSize(dat);
+ if (splitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size
+ splitterY = (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH);
+ dynaSplitter = splitterY - DPISCALEY_S(34);
+ DM_RecalcPictureSize();
}
- else if (dat->splitterY >(rc.bottom - rc.top)) {
- dat->splitterY = oldSplitterY;
- dat->dynaSplitter = oldDynaSplitter;
- DM_RecalcPictureSize(dat);
+ else if (splitterY >(rc.bottom - rc.top)) {
+ splitterY = oldSplitterY;
+ dynaSplitter = oldDynaSplitter;
+ DM_RecalcPictureSize();
}
else {
- dat->dynaSplitter = (rc.bottom - pt.y) - DPISCALEY_S(11);
- DM_RecalcPictureSize(dat);
+ dynaSplitter = (rc.bottom - pt.y) - DPISCALEY_S(11);
+ DM_RecalcPictureSize();
}
- CSkin::UpdateToolbarBG(dat);
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ UpdateToolbarBG();
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
- else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
- GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
+ else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_PANELSPLITTER)) {
+ GetClientRect(m_log.GetHwnd(), &rc);
POINT pnt = { 0, (int)wParam };
- ScreenToClient(hwndDlg, &pnt);
+ ScreenToClient(m_hwnd, &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);
+ Panel->setHeight(pnt.y + 2, true);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
+ RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
if (M.isAero())
- InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
+ InvalidateRect(GetParent(m_hwnd), NULL, FALSE);
}
break;
@@ -2231,54 +2285,54 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // from ourself. otherwise, the dm_remakelog will be deferred until next window
// activation (focus)
case DM_DEFERREDREMAKELOG:
- if ((HWND)wParam == hwndDlg)
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ if ((HWND)wParam == m_hwnd)
+ SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
else {
- if (M.GetByte(dat->hContact, "mwoverride", 0) == 0) {
- dat->dwFlags &= ~(MWF_LOG_ALL);
- dat->dwFlags |= (lParam & MWF_LOG_ALL);
- dat->dwFlags |= MWF_DEFERREDREMAKELOG;
+ if (M.GetByte(m_hContact, "mwoverride", 0) == 0) {
+ dwFlags &= ~(MWF_LOG_ALL);
+ dwFlags |= (lParam & MWF_LOG_ALL);
+ dwFlags |= MWF_DEFERREDREMAKELOG;
}
}
return 0;
case DM_FORCEDREMAKELOG:
- if ((HWND)wParam == hwndDlg)
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ if ((HWND)wParam == m_hwnd)
+ SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
else {
- dat->dwFlags &= ~(MWF_LOG_ALL);
- dat->dwFlags |= (lParam & MWF_LOG_ALL);
- dat->dwFlags |= MWF_DEFERREDREMAKELOG;
+ dwFlags &= ~(MWF_LOG_ALL);
+ dwFlags |= (lParam & MWF_LOG_ALL);
+ dwFlags |= MWF_DEFERREDREMAKELOG;
}
return 0;
case DM_REMAKELOG:
- dat->szMicroLf[0] = 0;
- dat->lastEventTime = 0;
- dat->iLastEventType = -1;
- StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0, NULL);
+ szMicroLf[0] = 0;
+ lastEventTime = 0;
+ iLastEventType = -1;
+ StreamInEvents(hDbEventFirst, -1, 0, NULL);
return 0;
case DM_APPENDMCEVENT:
- if (dat->hContact == db_mc_getMeta(wParam) && dat->hDbEventFirst == NULL) {
- dat->hDbEventFirst = lParam;
- SendMessage(dat->hwnd, DM_REMAKELOG, 0, 0);
+ if (m_hContact == db_mc_getMeta(wParam) && hDbEventFirst == NULL) {
+ hDbEventFirst = lParam;
+ SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
}
- else if (dat->hContact == wParam && db_mc_isSub(wParam) && db_event_getContact(lParam) != wParam)
- StreamInEvents(hwndDlg, lParam, 1, 1, NULL);
+ else if (m_hContact == wParam && db_mc_isSub(wParam) && db_event_getContact(lParam) != wParam)
+ StreamInEvents(lParam, 1, 1, NULL);
return 0;
case DM_APPENDTOLOG:
- StreamInEvents(hwndDlg, wParam, 1, 1, NULL);
+ StreamInEvents(wParam, 1, 1, NULL);
return 0;
case DM_REPLAYQUEUE: // replays queued events after the message log has been frozen for a while
- for (int i = 0; i < dat->iNextQueuedEvent; i++)
- if (dat->hQueuedEvents[i] != 0)
- StreamInEvents(hwndDlg, dat->hQueuedEvents[i], 1, 1, NULL);
+ for (int i = 0; i < iNextQueuedEvent; i++)
+ if (hQueuedEvents[i] != 0)
+ StreamInEvents(hQueuedEvents[i], 1, 1, NULL);
- dat->iNextQueuedEvent = 0;
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
+ iNextQueuedEvent = 0;
+ SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, bNotOnList ? TranslateT("Contact not on list. You may add it...") :
TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
return 0;
@@ -2286,12 +2340,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
IEVIEWWINDOW iew = { sizeof(iew) };
iew.iType = IEW_SCROLLBOTTOM;
- if (dat->hwndIEView) {
- iew.hwnd = dat->hwndIEView;
+ if (hwndIEView) {
+ iew.hwnd = hwndIEView;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);
}
- else if (dat->hwndHPP) {
- iew.hwnd = dat->hwndHPP;
+ else if (hwndHPP) {
+ iew.hwnd = hwndHPP;
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&iew);
}
}
@@ -2300,20 +2354,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case HM_DBEVENTADDED:
// this is called whenever a new event has been added to the database.
// this CAN be posted (some sanity checks required).
- if (dat && dat->hContact)
- DM_EventAdded(dat, dat->hContact, lParam);
+ if (this && m_hContact)
+ DM_EventAdded(this, m_hContact, lParam);
return 0;
case WM_TIMER:
// timer to control info panel hovering
if (wParam == TIMERID_AWAYMSG) {
- KillTimer(hwndDlg, wParam);
+ KillTimer(m_hwnd, wParam);
GetCursorPos(&pt);
- if (wParam == TIMERID_AWAYMSG && dat->Panel->hitTest(pt) != CInfoPanel::HTNIRVANA)
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, 0, 0);
+ if (wParam == TIMERID_AWAYMSG && Panel->hitTest(pt) != CInfoPanel::HTNIRVANA)
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, 0, 0);
else
- dat->dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER;
+ dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER;
break;
}
@@ -2323,23 +2377,23 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l int iIndex = wParam - TIMERID_MSGSEND;
if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
SendJob *job = sendQueue->getJobByIndex(iIndex);
- KillTimer(hwndDlg, wParam);
+ KillTimer(m_hwnd, wParam);
mir_snwprintf(job->szErrorMsg, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
job->iStatus = SendQueue::SQ_ERROR;
- if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
+ if (!nen_options.iNoSounds && !(pContainer->dwFlags & CNT_NOSOUND))
SkinPlaySound("SendError");
- if (!(dat->dwFlags & MWF_ERRORSTATE))
- sendQueue->handleError(dat, iIndex);
+ if (!(dwFlags & MWF_ERRORSTATE))
+ sendQueue->handleError(this, iIndex);
break;
}
}
else if (wParam == TIMERID_FLASHWND) {
- if (dat->mayFlashTab)
- FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, TRUE, dat->hTabIcon);
+ if (m_bCanFlashTab)
+ FlashTab(true);
break;
}
else if (wParam == TIMERID_TYPE) {
- DM_Typing(dat);
+ DM_Typing(this);
break;
}
break;
@@ -2348,32 +2402,32 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l switch (wParam) {
case MSGERROR_CANCEL:
case MSGERROR_SENDLATER:
- if (dat->dwFlags & MWF_ERRORSTATE) {
- dat->cache->saveHistory(0, 0);
+ if (dwFlags & MWF_ERRORSTATE) {
+ cache->saveHistory(0, 0);
if (wParam == MSGERROR_SENDLATER)
- sendQueue->doSendLater(dat->iCurrentQueueError, dat); // to be implemented at a later time
- dat->iOpenJobs--;
+ sendQueue->doSendLater(iCurrentQueueError, this); // to be implemented at a later time
+ iOpenJobs--;
sendQueue->dec();
- if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS)
- sendQueue->clearJob(dat->iCurrentQueueError);
- dat->iCurrentQueueError = -1;
- sendQueue->showErrorControls(dat, FALSE);
+ if (iCurrentQueueError >= 0 && iCurrentQueueError < SendQueue::NR_SENDJOBS)
+ sendQueue->clearJob(iCurrentQueueError);
+ iCurrentQueueError = -1;
+ sendQueue->showErrorControls(this, FALSE);
if (wParam != MSGERROR_CANCEL || (wParam == MSGERROR_CANCEL && lParam == 0))
- SetDlgItemText(hwndDlg, IDC_MESSAGE, L"");
- sendQueue->checkQueue(dat);
- int iNextFailed = sendQueue->findNextFailed(dat);
+ SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ sendQueue->checkQueue(this);
+ int iNextFailed = sendQueue->findNextFailed(this);
if (iNextFailed >= 0)
- sendQueue->handleError(dat, iNextFailed);
+ sendQueue->handleError(this, iNextFailed);
}
break;
case MSGERROR_RETRY:
- if (dat->dwFlags & MWF_ERRORSTATE) {
+ if (dwFlags & MWF_ERRORSTATE) {
int resent = 0;
- dat->cache->saveHistory(0, 0);
- if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS) {
- SendJob *job = sendQueue->getJobByIndex(dat->iCurrentQueueError);
+ cache->saveHistory(0, 0);
+ if (iCurrentQueueError >= 0 && iCurrentQueueError < SendQueue::NR_SENDJOBS) {
+ SendJob *job = sendQueue->getJobByIndex(iCurrentQueueError);
if (job->hSendId == 0 && job->hContact == 0)
break;
@@ -2382,36 +2436,36 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
if (resent) {
- SendJob *job = sendQueue->getJobByIndex(dat->iCurrentQueueError);
+ SendJob *job = sendQueue->getJobByIndex(iCurrentQueueError);
- SetTimer(hwndDlg, TIMERID_MSGSEND + dat->iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL);
+ SetTimer(m_hwnd, TIMERID_MSGSEND + iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL);
job->iStatus = SendQueue::SQ_INPROGRESS;
- dat->iCurrentQueueError = -1;
- sendQueue->showErrorControls(dat, FALSE);
- SetDlgItemText(hwndDlg, IDC_MESSAGE, L"");
- sendQueue->checkQueue(dat);
+ iCurrentQueueError = -1;
+ sendQueue->showErrorControls(this, FALSE);
+ SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ sendQueue->checkQueue(this);
- int iNextFailed = sendQueue->findNextFailed(dat);
+ int iNextFailed = sendQueue->findNextFailed(this);
if (iNextFailed >= 0)
- sendQueue->handleError(dat, iNextFailed);
+ sendQueue->handleError(this, iNextFailed);
}
}
}
break;
case DM_SELECTTAB:
- SendMessage(hwndContainer, DM_SELECTTAB, wParam, lParam); // pass the msg to our container
+ SendMessage(pContainer->hwnd, DM_SELECTTAB, wParam, lParam); // pass the msg to our container
return 0;
case DM_SETLOCALE:
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
+ if (dwFlags & MWF_WASBACKGROUNDCREATE)
break;
- if (m_pContainer->hwndActive == hwndDlg && PluginConfig.m_bAutoLocaleSupport && hwndContainer == GetForegroundWindow() && hwndContainer == GetActiveWindow()) {
+ if (pContainer->hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && pContainer->hwnd == GetForegroundWindow() && pContainer->hwnd == GetActiveWindow()) {
if (lParam)
- dat->hkl = (HKL)lParam;
+ hkl = (HKL)lParam;
- if (dat->hkl)
- ActivateKeyboardLayout(dat->hkl, 0);
+ if (hkl)
+ ActivateKeyboardLayout(hkl, 0);
}
return 0;
@@ -2422,7 +2476,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
DWORD *pdw = (DWORD *)lParam;
if (pdw)
- *pdw = dat->dwTickLastEvent;
+ *pdw = dwTickLastEvent;
}
return 0;
@@ -2430,7 +2484,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
TContainerData **pc = (TContainerData **)lParam;
if (pc)
- *pc = m_pContainer;
+ *pc = pContainer;
}
return 0;
@@ -2438,74 +2492,74 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
MCONTACT *phContact = (MCONTACT*)lParam;
if (phContact)
- *phContact = dat->hContact;
+ *phContact = m_hContact;
}
return 0;
case DM_UPDATELASTMESSAGE:
- DM_UpdateLastMessage(dat);
+ DM_UpdateLastMessage(this);
return 0;
case DM_SAVESIZE:
- if (dat->dwFlags & MWF_NEEDCHECKSIZE)
+ if (dwFlags & MWF_NEEDCHECKSIZE)
lParam = 0;
- dat->dwFlags &= ~MWF_NEEDCHECKSIZE;
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
- dat->dwFlags &= ~MWF_INITMODE;
- if (dat->lastMessage)
- DM_UpdateLastMessage(dat);
+ dwFlags &= ~MWF_NEEDCHECKSIZE;
+ if (dwFlags & MWF_WASBACKGROUNDCREATE) {
+ dwFlags &= ~MWF_INITMODE;
+ if (lastMessage)
+ DM_UpdateLastMessage(this);
}
- SendMessage(hwndContainer, 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);
- PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0);
+ SendMessage(pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
+ MoveWindow(m_hwnd, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE);
+ if (dwFlags & MWF_WASBACKGROUNDCREATE) {
+ dwFlags &= ~MWF_WASBACKGROUNDCREATE;
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0);
if (PluginConfig.m_bAutoLocaleSupport) {
- if (dat->hkl == 0)
- DM_LoadLocale(dat);
+ if (hkl == 0)
+ DM_LoadLocale(this);
else
- PostMessage(hwndDlg, DM_SETLOCALE, 0, 0);
+ PostMessage(m_hwnd, DM_SETLOCALE, 0, 0);
}
- if (dat->hwndIEView != 0)
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- if (dat->pContainer->dwFlags & CNT_SIDEBAR)
- dat->pContainer->SideBar->Layout();
+ if (hwndIEView != 0)
+ SetFocus(m_message.GetHwnd());
+ if (pContainer->dwFlags & CNT_SIDEBAR)
+ pContainer->SideBar->Layout();
}
else {
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
if (lParam == 0)
- DM_ScrollToBottom(dat, 0, 1);
+ DM_ScrollToBottom(this, 0, 1);
}
return 0;
case DM_CHECKSIZE:
- dat->dwFlags |= MWF_NEEDCHECKSIZE;
+ dwFlags |= MWF_NEEDCHECKSIZE;
return 0;
// sent by the message input area hotkeys. just pass it to our container
case DM_QUERYPENDING:
- SendMessage(hwndContainer, DM_QUERYPENDING, wParam, lParam);
+ SendMessage(pContainer->hwnd, DM_QUERYPENDING, wParam, lParam);
return 0;
case WM_LBUTTONDOWN:
GetCursorPos(&tmp);
cur.x = (SHORT)tmp.x;
cur.y = (SHORT)tmp.y;
- if (!dat->Panel->isHovered())
- SendMessage(hwndContainer, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur)));
+ if (!Panel->isHovered())
+ SendMessage(pContainer->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur)));
break;
case WM_LBUTTONUP:
GetCursorPos(&tmp);
- if (dat->Panel->isHovered())
- dat->Panel->handleClick(tmp);
+ if (Panel->isHovered())
+ Panel->handleClick(tmp);
else {
cur.x = (SHORT)tmp.x;
cur.y = (SHORT)tmp.y;
- SendMessage(hwndContainer, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur)));
+ SendMessage(pContainer->hwnd, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur)));
}
break;
@@ -2514,29 +2568,30 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l RECT rcPicture, rcPanelNick = { 0 };
int menuID = 0;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), &rcPicture);
+ GetWindowRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), &rcPicture);
rcPanelNick.left = rcPanelNick.right - 30;
GetCursorPos(&pt);
- if (dat->Panel->invokeConfigDialog(pt))
+ if (Panel->invokeConfigDialog(pt))
break;
if (PtInRect(&rcPicture, pt))
menuID = MENU_PICMENU;
- if ((menuID == MENU_PICMENU && ((dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown) || dat->hOwnPic) && dat->bShowAvatar != 0)) {
+ if ((menuID == MENU_PICMENU && ((ace ? ace->hbmPic : PluginConfig.g_hbmUnknown) || hOwnPic) && bShowAvatar != 0)) {
HMENU submenu = GetSubMenu(PluginConfig.g_hMenuContext, 1);
GetCursorPos(&pt);
- MsgWindowUpdateMenu(dat, submenu, menuID);
- int iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- MsgWindowMenuHandler(dat, iSelection, menuID);
+ MsgWindowUpdateMenu(submenu, menuID);
+
+ int iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL);
+ MsgWindowMenuHandler(iSelection, menuID);
break;
}
HMENU subMenu = GetSubMenu(PluginConfig.g_hMenuContext, 0);
- MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
+ MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT);
- int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL);
if (iSelection >= IDM_CONTAINERMENU) {
char szIndex[10];
char *szKey = "TAB_ContainersW";
@@ -2545,24 +2600,24 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (iSelection - IDM_CONTAINERMENU >= 0) {
ptrW val(db_get_wsa(NULL, szKey, szIndex));
if (val)
- SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)val);
+ SendMessage(m_hwnd, DM_CONTAINERSELECTED, 0, (LPARAM)val);
}
break;
}
- MsgWindowMenuHandler(dat, iSelection, MENU_TABCONTEXT);
+ MsgWindowMenuHandler(iSelection, MENU_TABCONTEXT);
}
break;
case WM_MOUSEMOVE:
GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
+ DM_DismissTip(this, pt);
+ Panel->trackMouse(pt);
break;
case WM_MEASUREITEM:
{
LPMEASUREITEMSTRUCT lpmi = (LPMEASUREITEMSTRUCT)lParam;
- if (dat->Panel->isHovered()) {
+ if (Panel->isHovered()) {
lpmi->itemHeight = 0;
lpmi->itemWidth = 6;
return TRUE;
@@ -2571,36 +2626,36 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l return Menu_MeasureItem(lParam);
case WM_NCHITTEST:
- SendMessage(hwndContainer, WM_NCHITTEST, wParam, lParam);
+ SendMessage(pContainer->hwnd, WM_NCHITTEST, wParam, lParam);
break;
case WM_DRAWITEM:
- return MsgWindowDrawHandler(wParam, lParam, dat);
+ return MsgWindowDrawHandler(wParam, lParam);
case WM_APPCOMMAND:
{
DWORD cmd = GET_APPCOMMAND_LPARAM(lParam);
if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) {
- SendMessage(hwndContainer, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
+ SendMessage(pContainer->hwnd, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
return 1;
}
}
break;
case WM_COMMAND:
- if (!dat)
+ if (!this)
break;
// custom button handling
if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(dat->hContact, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
+ Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0);
break;
}
switch (LOWORD(wParam)) {
case IDOK:
- if (dat->fEditNotesActive) {
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_PIC, (LPARAM)TranslateT("You are editing the user notes. Click the button again or use the hotkey (default: Alt-N) to save the notes and return to normal messaging mode"));
+ if (fEditNotesActive) {
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_PIC, (LPARAM)TranslateT("You are editing the user notes. Click the button again or use the hotkey (default: Alt-N) to save the notes and return to normal messaging mode"));
return 0;
}
else {
@@ -2610,14 +2665,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l fi.chrg.cpMin = 0;
fi.chrg.cpMax = -1;
fi.lpstrText = "{";
- int final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? dat->SendFormat : 0;
+ int final_sendformat = SendDlgItemMessageA(m_hwnd, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? SendFormat : 0;
fi.lpstrText = "}";
- final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
+ final_sendformat = SendDlgItemMessageA(m_hwnd, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
- if (GetSendButtonState(hwndDlg) == PBS_DISABLED)
+ if (GetSendButtonState(m_hwnd) == PBS_DISABLED)
break;
- ptrA streamOut(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), final_sendformat ? 0 : SF_TEXT));
+ ptrA streamOut(Message_GetFromStream(m_message.GetHwnd(), final_sendformat ? 0 : SF_TEXT));
if (streamOut == NULL)
break;
@@ -2626,14 +2681,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break;
if (final_sendformat)
- DoRtfToTags(dat, decoded, _countof(rtfDefColors), rtfDefColors);
+ DoRtfToTags(decoded, _countof(rtfDefColors), rtfDefColors);
decoded.TrimRight();
T2Utf utfResult(decoded);
size_t memRequired = mir_strlen(utfResult) + 1;
// try to detect RTL
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ HWND hwndEdit = m_message.GetHwnd();
SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0);
PARAFORMAT2 pf2;
@@ -2652,29 +2707,29 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendMessage(hwndEdit, EM_SETSEL, -1, -1);
InvalidateRect(hwndEdit, NULL, FALSE);
- if (memRequired > dat->iSendBufferSize) {
- dat->sendBuffer = (char *)mir_realloc(dat->sendBuffer, memRequired);
- dat->iSendBufferSize = memRequired;
+ if (memRequired > iSendBufferSize) {
+ sendBuffer = (char *)mir_realloc(sendBuffer, memRequired);
+ iSendBufferSize = memRequired;
}
- memcpy(dat->sendBuffer, (char*)utfResult, memRequired);
+ memcpy(sendBuffer, (char*)utfResult, memRequired);
- if (memRequired == 0 || dat->sendBuffer[0] == 0)
+ if (memRequired == 0 || sendBuffer[0] == 0)
break;
- if (dat->sendMode & SMODE_CONTAINER && m_pContainer->hwndActive == hwndDlg && GetForegroundWindow() == hwndContainer) {
- int tabCount = TabCtrl_GetItemCount(hwndTab);
- ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->SendFormat ? 0 : SF_TEXT));
+ if (sendMode & SMODE_CONTAINER && pContainer->hwndActive == m_hwnd && GetForegroundWindow() == pContainer->hwnd) {
+ int tabCount = TabCtrl_GetItemCount(m_hwndParent);
+ ptrA szFromStream(Message_GetFromStream(m_message.GetHwnd(), SendFormat ? 0 : SF_TEXT));
TCITEM tci = { 0 };
tci.mask = TCIF_PARAM;
for (int i = 0; i < tabCount; i++) {
- TabCtrl_GetItem(hwndTab, i, &tci);
+ TabCtrl_GetItem(m_hwndParent, i, &tci);
// get the contact from the tabs lparam which hopefully is the tabs hwnd so we can get its userdata.... hopefully
HWND contacthwnd = (HWND)tci.lParam;
if (IsWindow(contacthwnd)) {
// if the contact hwnd is the current contact then ignore it and let the normal code deal with the msg
- if (contacthwnd != hwndDlg) {
+ if (contacthwnd != m_hwnd) {
SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
// send the buffer to the contacts msg typing area
SendDlgItemMessage(contacthwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szFromStream);
@@ -2684,16 +2739,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
}
// END /all /MOD
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
+ if (nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_SEND);
+ DeletePopupsForContact(m_hContact, PU_REMOVE_ON_SEND);
if (M.GetByte("allow_sendhook", 0)) {
- int result = TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
+ int result = TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
if (result)
return TRUE;
}
- sendQueue->addTo(dat, memRequired, flags);
+ sendQueue->addTo(this, memRequired, flags);
}
return TRUE;
@@ -2703,40 +2758,40 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SETTEXTEX stx = { ST_SELECTION, 1200 };
MEVENT hDBEvent = 0;
- if (dat->hwndIEView || dat->hwndHPP) { // IEView quoting support..
+ if (hwndIEView || hwndHPP) { // IEView quoting support..
wchar_t *selected = 0;
IEVIEWEVENT event = { sizeof(event) };
- event.hContact = dat->hContact;
+ event.hContact = m_hContact;
event.dwFlags = 0;
event.iType = IEE_GET_SELECTION;
- if (dat->hwndIEView) {
- event.hwnd = dat->hwndIEView;
+ if (hwndIEView) {
+ event.hwnd = hwndIEView;
selected = (wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
}
else {
- event.hwnd = dat->hwndHPP;
+ event.hwnd = hwndHPP;
selected = (wchar_t*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
}
if (selected != NULL) {
ptrW szQuoted(QuoteText(selected));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
break;
}
else {
- hDBEvent = db_event_last(dat->hContact);
+ hDBEvent = db_event_last(m_hContact);
goto quote_from_last;
}
}
- hDBEvent = dat->hDbEventLast;
+ hDBEvent = hDbEventLast;
quote_from_last:
if (hDBEvent == NULL)
break;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel);
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin == sel.cpMax) {
DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDBEvent);
@@ -2772,72 +2827,72 @@ quote_from_last: }
if (szConverted != NULL) {
ptrW szQuoted(QuoteText(szConverted));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ m_message.SendMsg(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));
+ ptrA szFromStream(Message_GetFromStream(m_log.GetHwnd(), SF_TEXT | SFF_SELECTION));
ptrW converted(mir_utf8decodeW(szFromStream));
Utils::FilterEventMarkers(converted);
ptrW szQuoted(QuoteText(converted));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
}
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ SetFocus(m_message.GetHwnd());
}
break;
case IDC_ADD:
{
ADDCONTACTSTRUCT acs = { 0 };
- acs.hContact = dat->hContact;
+ acs.hContact = m_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, _countof(addControls), SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)m_hwnd, (LPARAM)&acs);
+ if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) {
+ bNotOnList = FALSE;
+ ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_HIDE);
+ if (!(dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_HIDE);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
}
break;
case IDC_CANCELADD:
- dat->bNotOnList = FALSE;
- ShowMultipleControls(hwndDlg, addControls, _countof(addControls), SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ bNotOnList = FALSE;
+ ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_HIDE);
+ if (!(dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_HIDE);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
break;
case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
- if (m_pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
- dat->dwFlags |= MWF_NEEDHISTORYSAVE;
- dat->dwLastActivity = GetTickCount();
- m_pContainer->dwLastActivity = dat->dwLastActivity;
- SendQueue::UpdateSaveAndSendButton(dat);
+ if (pContainer->hwndActive == m_hwnd)
+ UpdateReadChars();
+ dwFlags |= MWF_NEEDHISTORYSAVE;
+ dwLastActivity = GetTickCount();
+ pContainer->dwLastActivity = dwLastActivity;
+ SendQueue::UpdateSaveAndSendButton(this);
if (!(GetKeyState(VK_CONTROL) & 0x8000)) {
- dat->nLastTyping = GetTickCount();
- if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE))) {
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_OFF) {
- if (!(dat->dwFlags & MWF_INITMODE))
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_ON);
+ nLastTyping = GetTickCount();
+ if (GetWindowTextLength(m_message.GetHwnd())) {
+ if (nTypeMode == PROTOTYPE_SELFTYPING_OFF) {
+ if (!(dwFlags & MWF_INITMODE))
+ DM_NotifyTyping(PROTOTYPE_SELFTYPING_ON);
}
}
- else if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
+ else if (nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
}
}
break;
default:
- Utils::CmdDispatcher(Utils::CMD_MSGDIALOG, hwndDlg, LOWORD(wParam), wParam, lParam, dat, m_pContainer);
+ Utils::CmdDispatcher(Utils::CMD_MSGDIALOG, m_hwnd, LOWORD(wParam), wParam, lParam, this, pContainer);
break;
}
break;
@@ -2846,7 +2901,7 @@ quote_from_last: {
DWORD idFrom = GetDlgCtrlID((HWND)wParam);
if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(dat->hContact, idFrom, (HWND)wParam, 1);
+ Srmm_ClickToolbarIcon(m_hContact, idFrom, (HWND)wParam, 1);
break;
}
}
@@ -2861,11 +2916,11 @@ quote_from_last: // 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);
+ sendQueue->ackMessage(this, wParam, lParam);
return 0;
case DM_ACTIVATEME:
- ActivateExistingTab(m_pContainer, hwndDlg);
+ ActivateExistingTab(pContainer, m_hwnd);
return 0;
// sent by the select container dialog box when a container was selected...
@@ -2876,168 +2931,167 @@ quote_from_last: if (!mir_wstrcmp(szNewName, TranslateT("Default container")))
szNewName = CGlobals::m_default_container_name;
- int iOldItems = TabCtrl_GetItemCount(hwndTab);
- if (!wcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
+ int iOldItems = TabCtrl_GetItemCount(m_hwndParent);
+ if (!wcsncmp(pContainer->szName, szNewName, CONTAINER_NAMELEN))
break;
TContainerData *pNewContainer = FindContainerByName(szNewName);
if (pNewContainer == NULL)
- if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == NULL)
break;
- db_set_ws(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
- dat->fIsReattach = TRUE;
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, dat->hContact);
+ db_set_ws(m_hContact, SRMSGMOD_T, "containerW", szNewName);
+ fIsReattach = TRUE;
+ PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, m_hContact);
if (iOldItems > 1) // there were more than 1 tab, container is still valid
- SendMessage(m_pContainer->hwndActive, WM_SIZE, 0, 0);
+ SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
SetForegroundWindow(pNewContainer->hwnd);
SetActiveWindow(pNewContainer->hwnd);
}
break;
case DM_STATUSBARCHANGED:
- UpdateStatusBar(dat);
+ UpdateStatusBar();
return 0;
case DM_UINTOCLIPBOARD:
- Utils::CopyToClipBoard(dat->cache->getUIN(), hwndDlg);
+ Utils::CopyToClipBoard(cache->getUIN(), m_hwnd);
return 0;
// broadcasted when GLOBAL info panel setting changes
case DM_SETINFOPANEL:
- CInfoPanel::setPanelHandler(dat, wParam, lParam);
+ CInfoPanel::setPanelHandler(this, wParam, lParam);
return 0;
// show the balloon tooltip control.
// wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
// lParam == new text to show
case DM_ACTIVATETOOLTIP:
- if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
+ if (IsIconic(pContainer->hwnd) || pContainer->hwndActive != m_hwnd)
break;
- dat->Panel->showTip(wParam, lParam);
+ Panel->showTip(wParam, lParam);
break;
case WM_NEXTDLGCTL:
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
+ if (dwFlags & MWF_WASBACKGROUNDCREATE)
return 1;
break;
// save the contents of the log as rtf file
case DM_SAVEMESSAGELOG:
- DM_SaveLogAsRTF(dat);
+ DM_SaveLogAsRTF(this);
return 0;
case DM_CHECKAUTOHIDE:
- DM_CheckAutoHide(dat, wParam, lParam);
+ DM_CheckAutoHide(this, wParam, lParam);
return 0;
case DM_IEVIEWOPTIONSCHANGED:
- if (dat->hwndIEView)
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ if (hwndIEView)
+ SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
break;
case DM_SMILEYOPTIONSCHANGED:
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
break;
case DM_MYAVATARCHANGED:
{
- const char *szProto = dat->cache->getActiveProto();
+ const char *szProto = cache->getActiveProto();
if (!mir_strcmp((char *)wParam, szProto) && mir_strlen(szProto) == mir_strlen((char *)wParam))
- LoadOwnAvatar(dat);
+ LoadOwnAvatar();
}
break;
case DM_GETWINDOWSTATE:
{
UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(hwndDlg))
+ if (IsWindowVisible(m_hwnd))
state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == hwndContainer)
+ if (GetForegroundWindow() == pContainer->hwnd)
state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(hwndContainer))
+ if (IsIconic(pContainer->hwnd))
state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state);
}
return TRUE;
case DM_CLIENTCHANGED:
- GetClientIcon(dat);
- if (dat->hClientIcon && dat->Panel->isActive())
- InvalidateRect(hwndDlg, NULL, TRUE);
+ GetClientIcon();
+ if (hClientIcon && Panel->isActive())
+ InvalidateRect(m_hwnd, NULL, TRUE);
return 0;
case DM_UPDATEUIN:
- if (dat->Panel->isActive())
- dat->Panel->Invalidate();
- if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR)
- UpdateStatusBar(dat);
+ if (Panel->isActive())
+ Panel->Invalidate();
+ if (pContainer->dwFlags & CNT_UINSTATUSBAR)
+ UpdateStatusBar();
return 0;
case DM_REMOVEPOPUPS:
- DeletePopupsForContact(dat->hContact, (DWORD)wParam);
+ DeletePopupsForContact(m_hContact, (DWORD)wParam);
return 0;
case EM_THEMECHANGED:
- DM_FreeTheme(dat);
- return DM_ThemeChanged(dat);
+ DM_FreeTheme();
+ DM_ThemeChanged();
+ return 0;
case DM_PLAYINCOMINGSOUND:
- if (!dat)
- return 0;
- PlayIncomingSound(dat);
+ PlayIncomingSound();
return 0;
case DM_REFRESHTABINDEX:
- dat->iTabID = GetTabIndexFromHWND(GetParent(hwndDlg), hwndDlg);
+ iTabID = GetTabIndexFromHWND(GetParent(m_hwnd), m_hwnd);
return 0;
case DM_STATUSICONCHANGE:
- if (m_pContainer->hwndStatus) {
- SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0);
- SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0);
- InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE);
+ if (pContainer->hwndStatus) {
+ SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
+ SendMessage(pContainer->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0);
+ InvalidateRect(pContainer->hwndStatus, NULL, TRUE);
}
return 0;
case WM_CBD_UPDATED:
if (lParam)
- CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam);
+ CB_ChangeButton((CustomButtonData*)lParam);
else
- BB_InitDlgButtons(dat);
+ BB_InitDlgButtons();
- BB_SetButtonsPos(dat);
+ BB_SetButtonsPos();
return 0;
case WM_CBD_REMOVED:
if (lParam)
- CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam);
+ CB_DestroyButton((DWORD)wParam, (DWORD)lParam);
else
- CB_DestroyAllButtons(hwndDlg);
+ CB_DestroyAllButtons();
return 0;
case WM_DROPFILES:
{
BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000;
if (!not_sending) {
- const char *szProto = dat->cache->getActiveProto();
+ const char *szProto = 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) {
+ if (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."));
+ SendMessage(m_hwnd, 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) {
+ if (m_hContact != NULL) {
wchar_t szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
@@ -3048,7 +3102,7 @@ quote_from_last: }
if (!not_sending)
- CallService(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
+ CallService(MS_FILE_SENDSPECIFICFILEST, m_hContact, (LPARAM)ppFiles);
else {
if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
for (i = 0; i < totalCount; i++) {
@@ -3057,8 +3111,8 @@ quote_from_last: mir_free(szFileName);
}
char *szHTTPText = "DEBUG";
- SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ SendDlgItemMessageA(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
+ SetFocus(m_message.GetHwnd());
}
}
for (i = 0; ppFiles[i]; i++)
@@ -3072,233 +3126,96 @@ quote_from_last: {
int *uOpen = (int*)lParam;
if (uOpen)
- *uOpen += dat->iOpenJobs;
+ *uOpen += iOpenJobs;
}
return 0;
case WM_CLOSE:
// esc handles error controls if we are in error state (error controls visible)
- if (wParam == 0 && lParam == 0 && dat->dwFlags & MWF_ERRORSTATE) {
- SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
+ if (wParam == 0 && lParam == 0 && dwFlags & MWF_ERRORSTATE) {
+ SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
return TRUE;
}
if (wParam == 0 && lParam == 0) {
if (PluginConfig.m_EscapeCloses == 1) {
- SendMessage(hwndContainer, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
return TRUE;
}
else if (PluginConfig.m_bHideOnClose && PluginConfig.m_EscapeCloses == 2) {
- ShowWindow(hwndContainer, SW_HIDE);
+ ShowWindow(pContainer->hwnd, SW_HIDE);
return TRUE;
}
- _dlgReturn(hwndDlg, TRUE);
+ _dlgReturn(m_hwnd, TRUE);
}
- if (dat) {
- TContainerData *pContainer = dat->pContainer;
- if (dat->iOpenJobs > 0 && lParam != 2) {
- if (dat->dwFlags & MWF_ERRORSTATE) {
- SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 1);
- }
- else {
- if (dat->dwFlagsEx & MWF_EX_WARNCLOSE)
- return TRUE;
- dat->dwFlagsEx |= MWF_EX_WARNCLOSE;
- LRESULT result = SendQueue::WarnPendingJobs(0);
- dat->dwFlagsEx &= ~MWF_EX_WARNCLOSE;
- if (result == IDNO)
- return TRUE;
- }
+ if (iOpenJobs > 0 && lParam != 2) {
+ if (dwFlags & MWF_ERRORSTATE) {
+ SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_CANCEL, 1);
}
- int iTabs = TabCtrl_GetItemCount(hwndTab);
+ else {
+ if (dwFlagsEx & MWF_EX_WARNCLOSE)
+ return TRUE;
+
+ dwFlagsEx |= MWF_EX_WARNCLOSE;
+ LRESULT result = SendQueue::WarnPendingJobs(0);
+ dwFlagsEx &= ~MWF_EX_WARNCLOSE;
+ if (result == IDNO)
+ return TRUE;
+ }
+ }
+ {
+ int iTabs = TabCtrl_GetItemCount(m_hwndParent);
if (iTabs == 1) {
- PostMessage(hwndContainer, WM_CLOSE, 0, 1);
+ PostMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
return 1;
}
- m_pContainer->iChilds--;
- int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ pContainer->iChilds--;
// after closing a tab, we need to activate the tab to the left side of
// the previously open tab.
// normally, this tab has the same index after the deletion of the formerly active tab
// unless, of course, we closed the last (rightmost) tab.
- if (!m_pContainer->bDontSmartClose && iTabs > 1 && lParam != 3) {
+ if (!pContainer->bDontSmartClose && iTabs > 1 && lParam != 3) {
+ int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd);
if (i == iTabs - 1)
i--;
else
i++;
- TabCtrl_SetCurSel(hwndTab, i);
+ TabCtrl_SetCurSel(m_hwndParent, i);
TCITEM item = { 0 };
item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
+ TabCtrl_GetItem(m_hwndParent, i, &item); // retrieve dialog hwnd for the now active tab...
- m_pContainer->hwndActive = (HWND)item.lParam;
+ pContainer->hwndActive = (HWND)item.lParam;
- SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
- SetWindowPos(m_pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
+ SendMessage(pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
+ SetWindowPos(pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
ShowWindow((HWND)item.lParam, SW_SHOW);
- SetForegroundWindow(m_pContainer->hwndActive);
- SetFocus(m_pContainer->hwndActive);
- SendMessage(hwndContainer, WM_SIZE, 0, 0);
- }
-
- DestroyWindow(hwndDlg);
- SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
- }
- break;
-
- case WM_DESTROY:
- if (!dat)
- break;
-
- if (dat->hwndContactPic)
- DestroyWindow(dat->hwndContactPic);
-
- if (dat->hwndPanelPic)
- DestroyWindow(dat->hwndPanelPic);
-
- if (dat->hClientIcon)
- DestroyIcon(dat->hClientIcon);
-
- if (dat->hwndPanelPicParent)
- DestroyWindow(dat->hwndPanelPicParent);
-
- if (dat->cache->isValid()) { // not valid means the contact was deleted
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
- AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getActiveProto(), dat->szStatus, dat->wStatus,
- Skin_LoadProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
- if (dat->hContact) {
- if (!dat->fEditNotesActive) {
- char *msg = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), SF_TEXT);
- if (msg) {
- db_set_utf(dat->hContact, SRMSGMOD, "SavedMsg", msg);
- mir_free(msg);
- }
- else db_unset(dat->hContact, SRMSGMOD, "SavedMsg");
- }
- else SendMessage(hwndDlg, WM_COMMAND, IDC_PIC, 0);
- }
- }
-
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
-
- DM_FreeTheme(dat);
-
- mir_free(dat->sendBuffer);
- mir_free(dat->hHistoryEvents);
-
- // search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
- // messages in the queue as they can be acked later
- {
- SendJob *jobs = sendQueue->getJobByIndex(0);
-
- for (int i = 0; i < SendQueue::NR_SENDJOBS; i++) {
- if (jobs[i].hContact == dat->hContact) {
- if (jobs[i].iStatus > (unsigned)SendQueue::SQ_INPROGRESS)
- sendQueue->clearJob(i);
-
- // unfinished jobs which did not yet return anything are kept in the queue.
- // the hwndOwner is set to 0 because the window handle is now no longer valid.
- // Response for such a job is still silently handled by AckMessage() (sendqueue.c)
- if (jobs[i].iStatus == (unsigned)SendQueue::SQ_INPROGRESS)
- jobs[i].hOwnerWnd = 0;
- }
+ SetForegroundWindow(pContainer->hwndActive);
+ SetFocus(pContainer->hwndActive);
}
}
- mir_free(dat->hQueuedEvents);
-
- if (dat->hSmileyIcon)
- DestroyIcon(dat->hSmileyIcon);
-
- if (dat->hXStatusIcon)
- DestroyIcon(dat->hXStatusIcon);
-
- if (dat->hwndTip)
- DestroyWindow(dat->hwndTip);
-
- if (dat->hTaskbarIcon)
- DestroyIcon(dat->hTaskbarIcon);
-
- UpdateTrayMenuState(dat, FALSE); // remove me from the tray menu (if still there)
- if (PluginConfig.g_hMenuTrayUnread)
- DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, MF_BYCOMMAND);
- M.RemoveWindow(hwndDlg);
-
- if (dat->cache->isValid())
- db_set_dw(0, SRMSGMOD, "multisplit", dat->multiSplitterX);
-
- {
- int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
- if (i >= 0) {
- SendMessage(hwndTab, WM_USER + 100, 0, 0); // remove tooltip
- TabCtrl_DeleteItem(hwndTab, i);
- BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
- dat->iTabID = -1;
- }
- }
-
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
-
- // clean up IEView and H++ log windows
- if (dat->hwndIEView != 0) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = dat->hwndIEView;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- }
- if (dat->hwndHPP) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = dat->hwndHPP;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- }
- if (dat->pWnd) {
- delete dat->pWnd;
- dat->pWnd = 0;
- }
- if (dat->sbCustom) {
- delete dat->sbCustom;
- dat->sbCustom = 0;
- }
+ SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
break;
case WM_DWMCOMPOSITIONCHANGED:
- BB_RefreshTheme(dat);
- memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
- CProxyWindow::verify(dat);
+ BB_RefreshTheme();
+ memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
+ CProxyWindow::verify(this);
break;
case DM_FORCEREDRAW:
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
+ RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
return 0;
case DM_CHECKINFOTIP:
- dat->Panel->hideTip(reinterpret_cast<HWND>(lParam));
+ Panel->hideTip(reinterpret_cast<HWND>(lParam));
return 0;
-
- case WM_NCDESTROY:
- if (dat) {
- memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
- PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1);
- if (m_pContainer->dwFlags & CNT_SIDEBAR)
- m_pContainer->SideBar->removeSession(dat);
- dat->cache->setWindowData();
- if (dat->cache->isValid() && !dat->fIsReattach && dat->hContact && M.GetByte("deletetemp", 0))
- if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
- db_delete_contact(dat->hContact);
-
- delete dat->Panel;
- mir_free(dat);
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
}
- return FALSE;
+
+ return CTabBaseDlg::DlgProc(uMsg, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index b34c26cd99..c24c71a8d8 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -71,7 +71,7 @@ bool TSAPI IsCustomEvent(int eventType) // be saved to the contacts db record (if so, the container will try to open the tab
// at the saved position later)
-void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fSavePos)
+void TSAPI RearrangeTab(HWND hwndDlg, const CTabBaseDlg *dat, int iMode, BOOL fSavePos)
{
if (dat == NULL || !IsWindow(hwndDlg))
return;
@@ -93,7 +93,7 @@ void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fS BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0);
ActivateTabFromHWND(hwndTab, hwndDlg);
if (fSavePos)
- db_set_dw(dat->hContact, SRMSGMOD_T, "tabindex", newIndex * 100);
+ db_set_dw(dat->m_hContact, SRMSGMOD_T, "tabindex", newIndex * 100);
}
}
@@ -127,7 +127,7 @@ static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lP // takes hbm (bitmap handle) and bool isOwnPic (1 == save the picture as your own avatar)
// requires AVS and ADVAIMG services (Miranda 0.7+)
-static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic)
+static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic)
{
wchar_t szFinalFilename[MAX_PATH];
time_t t = time(NULL);
@@ -195,74 +195,72 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic) // flash a tab icon if mode = true, otherwise restore default icon
// store flashing state into bState
-void TSAPI FlashTab(TWindowData *dat, HWND hwndTab, int iTabindex, BOOL *bState, BOOL mode, HICON origImage)
+void CTabBaseDlg::FlashTab(bool bInvertMode)
{
- if (mode)
- *bState = !(*bState);
- else
- dat->hTabIcon = origImage;
+ if (bInvertMode)
+ m_bTabFlash = !m_bTabFlash;
TCITEM item = { 0 };
item.mask = TCIF_IMAGE;
- TabCtrl_SetItem(hwndTab, iTabindex, &item);
- if (dat->pContainer->dwFlags & CNT_SIDEBAR)
- dat->pContainer->SideBar->updateSession(dat);
+ TabCtrl_SetItem(m_hwndParent, iTabID, &item);
+ if (pContainer->dwFlags & CNT_SIDEBAR)
+ pContainer->SideBar->updateSession(this);
}
/////////////////////////////////////////////////////////////////////////////////////////
// calculates avatar layouting, based on splitter position to find the optimal size
// for the avatar w/o disturbing the toolbar too much.
-void TSAPI CalcDynamicAvatarSize(TWindowData *dat, BITMAP *bminfo)
+void CTabBaseDlg::CalcDynamicAvatarSize(BITMAP *bminfo)
{
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE || dat->pContainer->dwFlags & CNT_DEFERREDCONFIGURE || dat->pContainer->dwFlags & CNT_CREATE_MINIMIZED || IsIconic(dat->pContainer->hwnd))
+ if (dwFlags & MWF_WASBACKGROUNDCREATE || pContainer->dwFlags & CNT_DEFERREDCONFIGURE || pContainer->dwFlags & CNT_CREATE_MINIMIZED || IsIconic(pContainer->hwnd))
return; // at this stage, the layout is not yet ready...
RECT rc;
- GetClientRect(dat->hwnd, &rc);
+ GetClientRect(GetHwnd(), &rc);
- BOOL bBottomToolBar = dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR;
- BOOL bToolBar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- int iSplitOffset = dat->bIsAutosizingInput ? 1 : 0;
+ BOOL bBottomToolBar = pContainer->dwFlags & CNT_BOTTOMTOOLBAR;
+ BOOL bToolBar = pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
+ int iSplitOffset = bIsAutosizingInput ? 1 : 0;
double picAspect = (bminfo->bmWidth == 0 || bminfo->bmHeight == 0) ? 1.0 : (double)(bminfo->bmWidth / (double)bminfo->bmHeight);
- double picProjectedWidth = (double)((dat->dynaSplitter - ((bBottomToolBar && bToolBar) ? DPISCALEX_S(24) : 0) + ((dat->bShowUIElements) ? DPISCALEX_S(28) : DPISCALEX_S(2)))) * picAspect;
+ double picProjectedWidth = (double)((dynaSplitter - ((bBottomToolBar && bToolBar) ? DPISCALEX_S(24) : 0) + ((bShowUIElements) ? DPISCALEX_S(28) : DPISCALEX_S(2)))) * picAspect;
- if ((rc.right - (int)picProjectedWidth) > (dat->iButtonBarReallyNeeds) && !PluginConfig.m_bAlwaysFullToolbarWidth && bToolBar)
- dat->iRealAvatarHeight = dat->dynaSplitter + 3 + (dat->bShowUIElements ? DPISCALEY_S(28) : DPISCALEY_S(2));
+ if ((rc.right - (int)picProjectedWidth) > (iButtonBarReallyNeeds) && !PluginConfig.m_bAlwaysFullToolbarWidth && bToolBar)
+ iRealAvatarHeight = dynaSplitter + 3 + (bShowUIElements ? DPISCALEY_S(28) : DPISCALEY_S(2));
else
- dat->iRealAvatarHeight = dat->dynaSplitter + DPISCALEY_S(6) + DPISCALEY_S(iSplitOffset);
+ iRealAvatarHeight = dynaSplitter + DPISCALEY_S(6) + DPISCALEY_S(iSplitOffset);
- dat->iRealAvatarHeight -= ((bBottomToolBar&&bToolBar) ? DPISCALEY_S(22) : 0);
+ iRealAvatarHeight -= ((bBottomToolBar&&bToolBar) ? DPISCALEY_S(22) : 0);
if (PluginConfig.m_LimitStaticAvatarHeight > 0)
- dat->iRealAvatarHeight = min(dat->iRealAvatarHeight, PluginConfig.m_LimitStaticAvatarHeight);
+ iRealAvatarHeight = min(iRealAvatarHeight, PluginConfig.m_LimitStaticAvatarHeight);
- if (M.GetByte(dat->hContact, "dontscaleavatars", M.GetByte("dontscaleavatars", 0)))
- dat->iRealAvatarHeight = min(bminfo->bmHeight, dat->iRealAvatarHeight);
+ if (M.GetByte(m_hContact, "dontscaleavatars", M.GetByte("dontscaleavatars", 0)))
+ iRealAvatarHeight = min(bminfo->bmHeight, iRealAvatarHeight);
- double aspect = (bminfo->bmHeight != 0) ? (double)dat->iRealAvatarHeight / (double)bminfo->bmHeight : 1.0;
+ double aspect = (bminfo->bmHeight != 0) ? (double)iRealAvatarHeight / (double)bminfo->bmHeight : 1.0;
double newWidth = (double)bminfo->bmWidth * aspect;
if (newWidth > (double)(rc.right) * 0.8)
newWidth = (double)(rc.right) * 0.8;
- dat->pic.cy = dat->iRealAvatarHeight + 2;
- dat->pic.cx = (int)newWidth + 2;
+ pic.cy = iRealAvatarHeight + 2;
+ pic.cx = (int)newWidth + 2;
}
-int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID)
+int CTabBaseDlg::MsgWindowUpdateMenu(HMENU submenu, int menuID)
{
- bool bInfoPanel = dat->Panel->isActive();
+ bool bInfoPanel = Panel->isActive();
if (menuID == MENU_TABCONTEXT) {
- EnableMenuItem(submenu, ID_TABMENU_LEAVECHATROOM, (dat->bType == SESSIONTYPE_CHAT && ProtoServiceExists(dat->szProto, PS_LEAVECHAT)) ? MF_ENABLED : MF_DISABLED);
+ EnableMenuItem(submenu, ID_TABMENU_LEAVECHATROOM, (bType == SESSIONTYPE_CHAT && ProtoServiceExists(szProto, PS_LEAVECHAT)) ? MF_ENABLED : MF_DISABLED);
EnableMenuItem(submenu, ID_TABMENU_ATTACHTOCONTAINER, (M.GetByte("useclistgroups", 0) || M.GetByte("singlewinmode", 0)) ? MF_GRAYED : MF_ENABLED);
- EnableMenuItem(submenu, ID_TABMENU_CLEARSAVEDTABPOSITION, (M.GetDword(dat->hContact, "tabindex", -1) != -1) ? MF_ENABLED : MF_GRAYED);
+ EnableMenuItem(submenu, ID_TABMENU_CLEARSAVEDTABPOSITION, (M.GetDword(m_hContact, "tabindex", -1) != -1) ? MF_ENABLED : MF_GRAYED);
}
else if (menuID == MENU_PICMENU) {
wchar_t *szText = NULL;
- char avOverride = (char)M.GetByte(dat->hContact, "hideavatar", -1);
+ char avOverride = (char)M.GetByte(m_hContact, "hideavatar", -1);
HMENU visMenu = GetSubMenu(submenu, 0);
- BOOL picValid = bInfoPanel ? (dat->hOwnPic != 0) : (dat->ace && dat->ace->hbmPic && dat->ace->hbmPic != PluginConfig.g_hbmUnknown);
+ BOOL picValid = bInfoPanel ? (hOwnPic != 0) : (ace && ace->hbmPic && ace->hbmPic != PluginConfig.g_hbmUnknown);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -282,7 +280,7 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID) }
else {
EnableMenuItem(submenu, 0, MF_BYPOSITION | MF_GRAYED);
- EnableMenuItem(submenu, ID_PICMENU_SETTINGS, MF_BYCOMMAND | ((ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0)) ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(submenu, ID_PICMENU_SETTINGS, MF_BYCOMMAND | ((ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(cache->getActiveProto()), 0)) ? MF_ENABLED : MF_GRAYED));
szText = TranslateT("Set your avatar...");
}
mii.dwTypeData = szText;
@@ -291,53 +289,47 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID) }
else if (menuID == MENU_PANELPICMENU) {
HMENU visMenu = GetSubMenu(submenu, 0);
- char avOverride = (char)M.GetByte(dat->hContact, "hideavatar", -1);
+ char avOverride = (char)M.GetByte(m_hContact, "hideavatar", -1);
CheckMenuItem(visMenu, ID_VISIBILITY_DEFAULT, MF_BYCOMMAND | (avOverride == -1 ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(visMenu, ID_VISIBILITY_HIDDENFORTHISCONTACT, MF_BYCOMMAND | (avOverride == 0 ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(visMenu, ID_VISIBILITY_VISIBLEFORTHISCONTACT, MF_BYCOMMAND | (avOverride == 1 ? MF_CHECKED : MF_UNCHECKED));
EnableMenuItem(submenu, ID_PICMENU_SETTINGS, MF_BYCOMMAND | (ServiceExists(MS_AV_GETAVATARBITMAP) ? MF_ENABLED : MF_GRAYED));
- EnableMenuItem(submenu, ID_PANELPICMENU_SAVETHISPICTUREAS, MF_BYCOMMAND | ((dat->ace && dat->ace->hbmPic && dat->ace->hbmPic != PluginConfig.g_hbmUnknown) ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(submenu, ID_PANELPICMENU_SAVETHISPICTUREAS, MF_BYCOMMAND | ((ace && ace->hbmPic && ace->hbmPic != PluginConfig.g_hbmUnknown) ? MF_ENABLED : MF_GRAYED));
}
return 0;
}
-int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
+int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId)
{
- if (dat == 0)
- return 0;
-
- HWND hwndDlg = dat->hwnd;
-
if (menuId == MENU_PICMENU || menuId == MENU_PANELPICMENU || menuId == MENU_TABCONTEXT) {
switch (selection) {
case ID_TABMENU_ATTACHTOCONTAINER:
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)hwndDlg);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), m_hwnd, SelectContainerDlgProc, (LPARAM)m_hwnd);
return 1;
case ID_TABMENU_CONTAINEROPTIONS:
- if (dat->pContainer->hWndOptions == 0)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)dat->pContainer);
+ if (pContainer->hWndOptions == 0)
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_hwnd, DlgProcContainerOptions, (LPARAM)pContainer);
return 1;
case ID_TABMENU_CLOSECONTAINER:
- SendMessage(dat->pContainer->hwnd, WM_CLOSE, 0, 0);
+ SendMessage(pContainer->hwnd, WM_CLOSE, 0, 0);
return 1;
case ID_TABMENU_CLOSETAB:
- SendMessage(hwndDlg, WM_CLOSE, 1, 0);
+ SendMessage(m_hwnd, WM_CLOSE, 1, 0);
return 1;
case ID_TABMENU_SAVETABPOSITION:
- db_set_dw(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
+ db_set_dw(m_hContact, SRMSGMOD_T, "tabindex", iTabID * 100);
break;
case ID_TABMENU_CLEARSAVEDTABPOSITION:
- db_unset(dat->hContact, SRMSGMOD_T, "tabindex");
+ db_unset(m_hContact, SRMSGMOD_T, "tabindex");
break;
case ID_TABMENU_LEAVECHATROOM:
- if (dat && dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = dat->si;
- if (si != NULL && dat->hContact != NULL) {
- char *szProto = GetContactProto(dat->hContact);
+ if (bType == SESSIONTYPE_CHAT) {
+ if (si != NULL && m_hContact != NULL) {
+ char *szProto = GetContactProto(m_hContact);
if (szProto)
- CallProtoService(szProto, PS_LEAVECHAT, dat->hContact, 0);
+ CallProtoService(szProto, PS_LEAVECHAT, m_hContact, 0);
}
}
return 1;
@@ -353,12 +345,12 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) avOverrideMode = 1;
else
avOverrideMode = 0;
- db_set_b(dat->hContact, SRMSGMOD_T, "hideavatar", avOverrideMode);
+ db_set_b(m_hContact, SRMSGMOD_T, "hideavatar", avOverrideMode);
}
- ShowPicture(dat, FALSE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
+ ShowPicture(false);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(this, 0, 1);
return 1;
case ID_PICMENU_ALWAYSKEEPTHEBUTTONBARATFULLWIDTH:
@@ -368,31 +360,27 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) break;
case ID_PICMENU_SAVETHISPICTUREAS:
- if (dat->Panel->isActive()) {
- if (dat)
- SaveAvatarToFile(dat, dat->hOwnPic, 1);
- }
- else {
- if (dat && dat->ace)
- SaveAvatarToFile(dat, dat->ace->hbmPic, 0);
- }
+ if (Panel->isActive())
+ SaveAvatarToFile(this, hOwnPic, 1);
+ else if (ace)
+ SaveAvatarToFile(this, ace->hbmPic, 0);
break;
case ID_PANELPICMENU_SAVETHISPICTUREAS:
- if (dat && dat->ace)
- SaveAvatarToFile(dat, dat->ace->hbmPic, 0);
+ if (ace)
+ SaveAvatarToFile(this, ace->hbmPic, 0);
break;
case ID_PICMENU_SETTINGS:
if (menuId == MENU_PANELPICMENU)
- CallService(MS_AV_CONTACTOPTIONS, dat->hContact, 0);
+ CallService(MS_AV_CONTACTOPTIONS, m_hContact, 0);
else if (menuId == MENU_PICMENU) {
- if (dat->Panel->isActive()) {
- if (ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0))
- CallService(MS_AV_SETMYAVATARW, (WPARAM)(dat->cache->getActiveProto()), 0);
+ if (Panel->isActive()) {
+ if (ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(cache->getActiveProto()), 0))
+ CallService(MS_AV_SETMYAVATARW, (WPARAM)(cache->getActiveProto()), 0);
}
else
- CallService(MS_AV_CONTACTOPTIONS, dat->hContact, 0);
+ CallService(MS_AV_CONTACTOPTIONS, m_hContact, 0);
}
return 1;
}
@@ -404,7 +392,7 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) return 1;
case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
- CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
+ CallService(MS_TABMSG_SETUSERPREFS, m_hContact, 0);
return 1;
}
}
@@ -415,73 +403,73 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) // update the status bar field which displays the number of characters in the input area
// and various indicators (caps lock, num lock, insert mode).
-void TSAPI UpdateReadChars(const TWindowData *dat)
+void CTabBaseDlg::UpdateReadChars() const
{
- if (dat && (dat->pContainer->hwndStatus && dat->pContainer->hwndActive == dat->hwnd)) {
- wchar_t buf[128];
- int len;
-
- if (dat->bType == SESSIONTYPE_CHAT)
- len = GetWindowTextLength(GetDlgItem(dat->hwnd, IDC_CHAT_MESSAGE));
- else {
- // retrieve text length in UTF8 bytes, because this is the relevant length for most protocols
- GETTEXTLENGTHEX gtxl = { 0 };
- gtxl.codepage = CP_UTF8;
- gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
+ if (!pContainer->hwndStatus || pContainer->hwndActive != m_hwnd)
+ return;
- len = SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
- }
+ int len;
+ if (bType == SESSIONTYPE_CHAT)
+ len = GetWindowTextLength(m_message.GetHwnd());
+ else {
+ // retrieve text length in UTF8 bytes, because this is the relevant length for most protocols
+ GETTEXTLENGTHEX gtxl = { 0 };
+ gtxl.codepage = CP_UTF8;
+ gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- BOOL fCaps = (GetKeyState(VK_CAPITAL) & 1);
- BOOL fNum = (GetKeyState(VK_NUMLOCK) & 1);
-
- wchar_t szBuf[20]; szBuf[0] = 0;
- if (dat->fInsertMode)
- mir_wstrcat(szBuf, L"O");
- if (fCaps)
- mir_wstrcat(szBuf, L"C");
- if (fNum)
- mir_wstrcat(szBuf, L"N");
- if (dat->fInsertMode || fCaps || fNum)
- mir_wstrcat(szBuf, L" | ");
-
- mir_snwprintf(buf, L"%s%s %d/%d", szBuf, dat->lcID, dat->iOpenJobs, len);
- SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 1, (LPARAM)buf);
- if (PluginConfig.m_visualMessageSizeIndicator)
- InvalidateRect(dat->pContainer->hwndStatus, NULL, FALSE);
+ len = m_message.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
}
+
+ BOOL fCaps = (GetKeyState(VK_CAPITAL) & 1);
+ BOOL fNum = (GetKeyState(VK_NUMLOCK) & 1);
+
+ wchar_t szBuf[20]; szBuf[0] = 0;
+ if (fInsertMode)
+ mir_wstrcat(szBuf, L"O");
+ if (fCaps)
+ mir_wstrcat(szBuf, L"C");
+ if (fNum)
+ mir_wstrcat(szBuf, L"N");
+ if (fInsertMode || fCaps || fNum)
+ mir_wstrcat(szBuf, L" | ");
+
+ wchar_t buf[128];
+ mir_snwprintf(buf, L"%s%s %d/%d", szBuf, lcID, iOpenJobs, len);
+ SendMessage(pContainer->hwndStatus, SB_SETTEXT, 1, (LPARAM)buf);
+ if (PluginConfig.m_visualMessageSizeIndicator)
+ InvalidateRect(pContainer->hwndStatus, NULL, FALSE);
}
/////////////////////////////////////////////////////////////////////////////////////////
// update all status bar fields and force a redraw of the status bar.
-void TSAPI UpdateStatusBar(const TWindowData *dat)
+void CTabBaseDlg::UpdateStatusBar() const
{
- if (dat && dat->pContainer->hwndStatus && dat->pContainer->hwndActive == dat->hwnd) {
- if (dat->bType == SESSIONTYPE_IM) {
- if (dat->szStatusBar[0]) {
- SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]);
- SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar);
+ if (pContainer->hwndStatus && pContainer->hwndActive == m_hwnd) {
+ if (bType == SESSIONTYPE_IM) {
+ if (szStatusBar[0]) {
+ SendMessage(pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]);
+ SendMessage(pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szStatusBar);
}
- else if (dat->sbCustom) {
- SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon);
- SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->sbCustom->tszText);
+ else if (sbCustom) {
+ SendMessage(pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)sbCustom->hIcon);
+ SendMessage(pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)sbCustom->tszText);
}
else {
- SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
- DM_UpdateLastMessage(dat);
+ SendMessage(pContainer->hwndStatus, SB_SETICON, 0, 0);
+ DM_UpdateLastMessage(this);
}
}
else {
- if (dat->sbCustom) {
- SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon);
- SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->sbCustom->tszText);
+ if (sbCustom) {
+ SendMessage(pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)sbCustom->hIcon);
+ SendMessage(pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)sbCustom->tszText);
}
- else SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
+ else SendMessage(pContainer->hwndStatus, SB_SETICON, 0, 0);
}
- UpdateReadChars(dat);
- InvalidateRect(dat->pContainer->hwndStatus, NULL, TRUE);
- SendMessage(dat->pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)dat);
+ UpdateReadChars();
+ InvalidateRect(pContainer->hwndStatus, NULL, TRUE);
+ SendMessage(pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)this);
}
}
@@ -492,7 +480,7 @@ void TSAPI UpdateStatusBar(const TWindowData *dat) // NOT used for typing notification feedback as this is handled directly from the
// MTN handler.
-void TSAPI HandleIconFeedback(TWindowData *dat, HICON iIcon)
+void TSAPI HandleIconFeedback(CTabBaseDlg *dat, HICON iIcon)
{
TCITEM item = { 0 };
@@ -519,14 +507,14 @@ void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam) {
if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED) {
HWND hwndDlg = GetParent(hwnd);
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ CTabBaseDlg *dat = (CTabBaseDlg*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!dat)
return;
dat->ace = Utils::loadAvatarFromAVS(dat->cache->getActiveContact());
- GetAvatarVisibility(hwndDlg, dat);
- ShowPicture(dat, TRUE);
+ dat->GetAvatarVisibility();
+ dat->ShowPicture(true);
if (dat->Panel->isActive())
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
@@ -536,87 +524,87 @@ void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam) // retrieve the visiblity of the avatar window, depending on the global setting
// and local mode
-bool TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat)
+bool CTabBaseDlg::GetAvatarVisibility()
{
- BYTE bAvatarMode = dat->pContainer->avatarMode;
- BYTE bOwnAvatarMode = dat->pContainer->ownAvatarMode;
- char hideOverride = (char)M.GetByte(dat->hContact, "hideavatar", -1);
+ BYTE bAvatarMode = pContainer->avatarMode;
+ BYTE bOwnAvatarMode = pContainer->ownAvatarMode;
+ char hideOverride = (char)M.GetByte(m_hContact, "hideavatar", -1);
// infopanel visible, consider own avatar display
- dat->bShowAvatar = false;
+ bShowAvatar = false;
- if (dat->Panel->isActive() && bAvatarMode != 3) {
+ if (Panel->isActive() && bAvatarMode != 3) {
if (!bOwnAvatarMode) {
- dat->bShowAvatar = (dat->hOwnPic && dat->hOwnPic != PluginConfig.g_hbmUnknown);
- if (!dat->hwndContactPic)
- dat->hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(hwndDlg, IDC_CONTACTPIC), (HMENU)0, NULL, NULL);
+ bShowAvatar = (hOwnPic && hOwnPic != PluginConfig.g_hbmUnknown);
+ if (!hwndContactPic)
+ hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, NULL, NULL);
}
switch (bAvatarMode) {
case 2:
- dat->bShowInfoAvatar = false;
+ bShowInfoAvatar = false;
break;
case 0:
- dat->bShowInfoAvatar = true;
+ bShowInfoAvatar = true;
case 1:
- HBITMAP hbm = ((dat->ace && !(dat->ace->dwFlags & AVS_HIDEONCLIST)) ? dat->ace->hbmPic : 0);
+ HBITMAP hbm = ((ace && !(ace->dwFlags & AVS_HIDEONCLIST)) ? ace->hbmPic : 0);
if (hbm == NULL && !bAvatarMode) {
- dat->bShowInfoAvatar = false;
+ bShowInfoAvatar = false;
break;
}
- if (!dat->hwndPanelPic) {
- dat->hwndPanelPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, dat->hwndPanelPicParent, (HMENU)7000, NULL, NULL);
- if (dat->hwndPanelPic)
- SendMessage(dat->hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, TRUE);
+ if (!hwndPanelPic) {
+ hwndPanelPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndPanelPicParent, (HMENU)7000, NULL, NULL);
+ if (hwndPanelPic)
+ SendMessage(hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, TRUE);
}
if (bAvatarMode != 0)
- dat->bShowInfoAvatar = (hbm && hbm != PluginConfig.g_hbmUnknown);
+ bShowInfoAvatar = (hbm && hbm != PluginConfig.g_hbmUnknown);
break;
}
- if (dat->bShowInfoAvatar)
- dat->bShowInfoAvatar = hideOverride == 0 ? false : dat->bShowInfoAvatar;
+ if (bShowInfoAvatar)
+ bShowInfoAvatar = hideOverride == 0 ? false : bShowInfoAvatar;
else
- dat->bShowInfoAvatar = hideOverride == 1 ? true : dat->bShowInfoAvatar;
+ bShowInfoAvatar = hideOverride == 1 ? true : bShowInfoAvatar;
- Utils::setAvatarContact(dat->hwndPanelPic, dat->hContact);
- SendMessage(dat->hwndContactPic, AVATAR_SETPROTOCOL, 0, (LPARAM)dat->cache->getActiveProto());
+ Utils::setAvatarContact(hwndPanelPic, m_hContact);
+ SendMessage(hwndContactPic, AVATAR_SETPROTOCOL, 0, (LPARAM)cache->getActiveProto());
}
else {
- dat->bShowInfoAvatar = false;
+ bShowInfoAvatar = false;
switch (bAvatarMode) {
case 0: // globally on
- dat->bShowAvatar = true;
+ bShowAvatar = true;
LBL_Check:
- if (!dat->hwndContactPic)
- dat->hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(hwndDlg, IDC_CONTACTPIC), (HMENU)0, NULL, NULL);
+ if (!hwndContactPic)
+ hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, NULL, NULL);
break;
case 2: // globally OFF
- dat->bShowAvatar = false;
+ bShowAvatar = false;
break;
case 3: // on, if present
case 1:
- HBITMAP hbm = (dat->ace && !(dat->ace->dwFlags & AVS_HIDEONCLIST)) ? dat->ace->hbmPic : 0;
- dat->bShowAvatar = (hbm && hbm != PluginConfig.g_hbmUnknown);
+ HBITMAP hbm = (ace && !(ace->dwFlags & AVS_HIDEONCLIST)) ? ace->hbmPic : 0;
+ bShowAvatar = (hbm && hbm != PluginConfig.g_hbmUnknown);
goto LBL_Check;
}
- if (dat->bShowAvatar)
- dat->bShowAvatar = hideOverride == 0 ? 0 : dat->bShowAvatar;
+ if (bShowAvatar)
+ bShowAvatar = hideOverride == 0 ? 0 : bShowAvatar;
else
- dat->bShowAvatar = hideOverride == 1 ? 1 : dat->bShowAvatar;
+ bShowAvatar = hideOverride == 1 ? 1 : bShowAvatar;
// reloads avatars
- if (dat->hwndPanelPic) { // shows contact or user picture, depending on panel visibility
- SendMessage(dat->hwndContactPic, AVATAR_SETPROTOCOL, 0, (LPARAM)dat->cache->getActiveProto());
- Utils::setAvatarContact(dat->hwndPanelPic, dat->hContact);
+ if (hwndPanelPic) { // shows contact or user picture, depending on panel visibility
+ SendMessage(hwndContactPic, AVATAR_SETPROTOCOL, 0, (LPARAM)cache->getActiveProto());
+ Utils::setAvatarContact(hwndPanelPic, m_hContact);
}
- else Utils::setAvatarContact(dat->hwndContactPic, dat->hContact);
+ else Utils::setAvatarContact(hwndContactPic, m_hContact);
}
- return dat->bShowAvatar;
+ return bShowAvatar;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -691,71 +679,65 @@ wchar_t* TSAPI QuoteText(const wchar_t *text) return strout;
}
-void TSAPI AdjustBottomAvatarDisplay(TWindowData *dat)
+void CTabBaseDlg::AdjustBottomAvatarDisplay()
{
- if (!dat)
- return;
-
- HWND hwndDlg = dat->hwnd;
- dat->bShowAvatar = GetAvatarVisibility(hwndDlg, dat);
+ GetAvatarVisibility();
- bool bInfoPanel = dat->Panel->isActive();
- HBITMAP hbm = (bInfoPanel && dat->pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
+ bool bInfoPanel = Panel->isActive();
+ HBITMAP hbm = (bInfoPanel && pContainer->avatarMode != 3) ? hOwnPic : (ace ? ace->hbmPic : PluginConfig.g_hbmUnknown);
if (hbm) {
- if (dat->dynaSplitter == 0 || dat->splitterY == 0)
- LoadSplitter(dat);
- dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
- DM_RecalcPictureSize(dat);
- Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->bShowAvatar ? SW_SHOW : SW_HIDE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), NULL, TRUE);
+ if (dynaSplitter == 0 || splitterY == 0)
+ LoadSplitter();
+ dynaSplitter = splitterY - DPISCALEY_S(34);
+ DM_RecalcPictureSize();
+ Utils::showDlgControl(m_hwnd, IDC_CONTACTPIC, bShowAvatar ? SW_SHOW : SW_HIDE);
+ InvalidateRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), NULL, TRUE);
}
else {
- Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->bShowAvatar ? SW_SHOW : SW_HIDE);
- dat->pic.cy = dat->pic.cx = DPISCALEY_S(60);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), NULL, TRUE);
+ Utils::showDlgControl(m_hwnd, IDC_CONTACTPIC, bShowAvatar ? SW_SHOW : SW_HIDE);
+ pic.cy = pic.cx = DPISCALEY_S(60);
+ InvalidateRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), NULL, TRUE);
}
}
-void TSAPI ShowPicture(TWindowData *dat, BOOL showNewPic)
+void CTabBaseDlg::ShowPicture(bool showNewPic)
{
- HWND hwndDlg = dat->hwnd;
-
- if (!dat->Panel->isActive())
- dat->pic.cy = dat->pic.cx = DPISCALEY_S(60);
+ if (!Panel->isActive())
+ pic.cy = pic.cx = DPISCALEY_S(60);
if (showNewPic) {
- if (dat->Panel->isActive() && dat->pContainer->avatarMode != 3) {
- if (!dat->hwndPanelPic) {
- InvalidateRect(dat->hwnd, NULL, TRUE);
- UpdateWindow(dat->hwnd);
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ if (Panel->isActive() && pContainer->avatarMode != 3) {
+ if (!hwndPanelPic) {
+ InvalidateRect(m_hwnd, NULL, TRUE);
+ UpdateWindow(m_hwnd);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
return;
}
- AdjustBottomAvatarDisplay(dat);
+ AdjustBottomAvatarDisplay();
}
else {
- dat->bShowAvatar = dat->bShowAvatar ? 0 : 1;
- db_set_b(dat->hContact, SRMSGMOD_T, "MOD_ShowPic", (BYTE)dat->bShowAvatar);
+ bShowAvatar = !bShowAvatar;
+ db_set_b(m_hContact, SRMSGMOD_T, "MOD_ShowPic", bShowAvatar);
}
RECT rc;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), &rc);
- if (dat->minEditBoxSize.cy + DPISCALEY_S(3) > dat->splitterY)
- SendMessage(hwndDlg, DM_SPLITTERMOVED, (WPARAM)rc.bottom - dat->minEditBoxSize.cy, (LPARAM)GetDlgItem(hwndDlg, IDC_SPLITTER));
+ GetWindowRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), &rc);
+ if (minEditBoxSize.cy + DPISCALEY_S(3) > splitterY)
+ SendMessage(m_hwnd, DM_SPLITTERMOVED, (WPARAM)rc.bottom - minEditBoxSize.cy, (LPARAM)GetDlgItem(m_hwnd, IDC_SPLITTER));
if (!showNewPic)
- SetDialogToType(hwndDlg);
+ SetDialogToType(m_hwnd);
else
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
-void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, MEVENT hEvent, DBEVENTINFO *dbei)
+void CTabBaseDlg::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei)
{
- dat->dwTickLastEvent = GetTickCount();
+ dwTickLastEvent = GetTickCount();
- if ((GetForegroundWindow() != dat->pContainer->hwnd || dat->pContainer->hwndActive != hwndDlg) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE) {
- dat->dwUnread++;
- UpdateTrayMenu(dat, (WORD)(dat->cache->getActiveStatus()), dat->cache->getActiveProto(), dat->szStatus, dat->hContact, 0L);
+ if ((GetForegroundWindow() != pContainer->hwnd || pContainer->hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE) {
+ dwUnread++;
+ UpdateTrayMenu(this, (WORD)(cache->getActiveStatus()), cache->getActiveProto(), szStatus, m_hContact, 0);
if (nen_options.bTraySupport)
return;
}
@@ -765,16 +747,16 @@ void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, MEVENT hEvent, DBEVENTIN if (!PluginConfig.m_bFlashOnClist)
return;
- if ((GetForegroundWindow() != dat->pContainer->hwnd || dat->pContainer->hwndActive != hwndDlg) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !(dat->dwFlagsEx & MWF_SHOW_FLASHCLIST)) {
+ if ((GetForegroundWindow() != pContainer->hwnd || pContainer->hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !(dwFlagsEx & MWF_SHOW_FLASHCLIST)) {
CLISTEVENT cle = {};
- cle.hContact = (MCONTACT)dat->hContact;
+ cle.hContact = m_hContact;
cle.hDbEvent = hEvent;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
pcli->pfnAddEvent(&cle);
- dat->dwFlagsEx |= MWF_SHOW_FLASHCLIST;
- dat->hFlashingEvent = hEvent;
+ dwFlagsEx |= MWF_SHOW_FLASHCLIST;
+ hFlashingEvent = hEvent;
}
}
@@ -875,13 +857,13 @@ static int GetRtfIndex(int iCol, int iCount, int *pIndex) // convert rich edit code to bbcode (if wanted). Otherwise, strip all RTF formatting
// tags and return plain text
-BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMStringW &pszText, int iNumColors, COLORREF *pColors)
+BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors) const
{
if (pszText.IsEmpty())
return FALSE;
// used to filter out attributes which are already set for the default message input area font
- LOGFONTA lf = dat->pContainer->theme.logFonts[MSGFONTID_MESSAGEAREA];
+ LOGFONTA lf = pContainer->theme.logFonts[MSGFONTID_MESSAGEAREA];
// create an index of colors in the module and map them to
// corresponding colors in the RTF color table
@@ -917,7 +899,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMStringW &pszText, int iNumColor int iCol = _wtoi(p + 3);
int iInd = GetRtfIndex(iCol, iNumColors, pIndex);
- if (iCol && dat->bType != SESSIONTYPE_CHAT)
+ if (iCol && bType != SESSIONTYPE_CHAT)
res.AppendFormat((iInd > 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_ctable[iInd - 1].szName);
bInsideColor = iInd > 0;
@@ -953,19 +935,19 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMStringW &pszText, int iNumColor }
else if (!wcsncmp(p, L"\\b", 2)) { //bold
if (!(lf.lfWeight == FW_BOLD)) // only allow bold if the font itself isn't a bold one, otherwise just strip it..
- if (dat->SendFormat)
+ if (SendFormat)
res.Append((p[2] != '0') ? L"[b]" : L"[/b]");
}
else if (!wcsncmp(p, L"\\i", 2)) { // italics
- if (!lf.lfItalic && dat->SendFormat)
+ if (!lf.lfItalic && SendFormat)
res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
}
else if (!wcsncmp(p, L"\\strike", 7)) { // strike-out
- if (!lf.lfStrikeOut && dat->SendFormat)
+ if (!lf.lfStrikeOut && SendFormat)
res.Append((p[7] != '0') ? L"[s]" : L"[/s]");
}
else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
- if (!lf.lfUnderline && dat->SendFormat) {
+ if (!lf.lfUnderline && SendFormat) {
if (p[3] == 0 || wcschr(tszRtfBreaks, p[3])) {
res.Append(L"[u]");
bInsideUl = true;
@@ -1016,7 +998,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMStringW &pszText, int iNumColor }
}
- if (bInsideColor && dat->bType != SESSIONTYPE_CHAT)
+ if (bInsideColor && bType != SESSIONTYPE_CHAT)
res.Append(L"[/color]");
if (bInsideUl)
res.Append(L"[/u]");
@@ -1029,15 +1011,17 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMStringW &pszText, int iNumColor // retrieve both buddys and my own UIN for a message session and store them in the message window *dat
// respects metacontacts and uses the current protocol if the contact is a MC
-void TSAPI GetMYUIN(TWindowData *dat)
+void CTabBaseDlg::GetMYUIN()
{
- ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, NULL, dat->cache->getActiveProto()));
+ ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, NULL, cache->getActiveProto()));
if (uid != NULL)
- wcsncpy_s(dat->myUin, uid, _TRUNCATE);
+ wcsncpy_s(myUin, uid, _TRUNCATE);
else
- dat->myUin[0] = 0;
+ myUin[0] = 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int g_IEViewAvail = -1;
static int g_HPPAvail = -1;
@@ -1063,12 +1047,13 @@ UINT TSAPI GetIEViewMode(MCONTACT hContact) return iWantHPP ? WANT_HPP_LOG : (iWantIEView ? WANT_IEVIEW_LOG : 0);
}
-void TSAPI SetMessageLog(TWindowData *dat)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CTabBaseDlg::SetMessageLog()
{
- HWND hwndDlg = dat->hwnd;
- unsigned int iLogMode = GetIEViewMode(dat->hContact);
+ unsigned int iLogMode = GetIEViewMode(m_hContact);
- if (iLogMode == WANT_IEVIEW_LOG && dat->hwndIEView == 0) {
+ if (iLogMode == WANT_IEVIEW_LOG && hwndIEView == 0) {
IEVIEWWINDOW ieWindow;
memset(&ieWindow, 0, sizeof(ieWindow));
@@ -1076,43 +1061,43 @@ void TSAPI SetMessageLog(TWindowData *dat) ieWindow.iType = IEW_CREATE;
ieWindow.dwFlags = 0;
ieWindow.dwMode = IEWM_TABSRMM;
- ieWindow.parent = hwndDlg;
+ ieWindow.parent = m_hwnd;
ieWindow.x = 0;
ieWindow.y = 0;
ieWindow.cx = 200;
ieWindow.cy = 200;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- dat->hwndIEView = ieWindow.hwnd;
- Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE);
- Utils::enableDlgControl(hwndDlg, IDC_LOG, false);
+ hwndIEView = ieWindow.hwnd;
+ Utils::showDlgControl(m_hwnd, IDC_LOG, SW_HIDE);
+ Utils::enableDlgControl(m_hwnd, IDC_LOG, false);
}
- else if (iLogMode == WANT_HPP_LOG && dat->hwndHPP == 0) {
+ else if (iLogMode == WANT_HPP_LOG && hwndHPP == 0) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_CREATE;
ieWindow.dwFlags = 0;
ieWindow.dwMode = IEWM_TABSRMM;
- ieWindow.parent = hwndDlg;
+ ieWindow.parent = m_hwnd;
ieWindow.x = 0;
ieWindow.y = 0;
ieWindow.cx = 10;
ieWindow.cy = 10;
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- dat->hwndHPP = ieWindow.hwnd;
- Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE);
- Utils::enableDlgControl(hwndDlg, IDC_LOG, false);
+ hwndHPP = ieWindow.hwnd;
+ Utils::showDlgControl(m_hwnd, IDC_LOG, SW_HIDE);
+ Utils::enableDlgControl(m_hwnd, IDC_LOG, false);
}
}
-void TSAPI FindFirstEvent(TWindowData *dat)
+void CTabBaseDlg::FindFirstEvent()
{
- int historyMode = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_LOADHISTORY, -1);
+ int historyMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_LOADHISTORY, -1);
if (historyMode == -1)
historyMode = (int)M.GetByte(SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
- dat->hDbEventFirst = db_event_firstUnread(dat->hContact);
+ hDbEventFirst = db_event_firstUnread(m_hContact);
- if (dat->bActualHistory)
+ if (bActualHistory)
historyMode = LOADHISTORY_COUNT;
switch (historyMode) {
@@ -1122,21 +1107,21 @@ void TSAPI FindFirstEvent(TWindowData *dat) {
DBEVENTINFO dbei = {};
// ability to load only current session's history
- if (dat->bActualHistory)
- i = dat->cache->getSessionMsgCount();
+ if (bActualHistory)
+ i = cache->getSessionMsgCount();
else
i = db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT);
for (; i > 0; i--) {
- if (dat->hDbEventFirst == NULL)
- hPrevEvent = db_event_last(dat->hContact);
+ if (hDbEventFirst == NULL)
+ hPrevEvent = db_event_last(m_hContact);
else
- hPrevEvent = db_event_prev(dat->hContact, dat->hDbEventFirst);
+ hPrevEvent = db_event_prev(m_hContact, hDbEventFirst);
if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
- dat->hDbEventFirst = hPrevEvent;
- db_event_get(dat->hDbEventFirst, &dbei);
+ hDbEventFirst = hPrevEvent;
+ db_event_get(hDbEventFirst, &dbei);
if (!DbEventIsShown(&dbei))
i++;
}
@@ -1145,73 +1130,73 @@ void TSAPI FindFirstEvent(TWindowData *dat) case LOADHISTORY_TIME:
DBEVENTINFO dbei = {};
- if (dat->hDbEventFirst == NULL)
+ if (hDbEventFirst == NULL)
dbei.timestamp = time(NULL);
else
- db_event_get(dat->hDbEventFirst, &dbei);
+ db_event_get(hDbEventFirst, &dbei);
DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;) {
- if (dat->hDbEventFirst == NULL)
- hPrevEvent = db_event_last(dat->hContact);
+ if (hDbEventFirst == NULL)
+ hPrevEvent = db_event_last(m_hContact);
else
- hPrevEvent = db_event_prev(dat->hContact, dat->hDbEventFirst);
+ hPrevEvent = db_event_prev(m_hContact, hDbEventFirst);
if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
db_event_get(hPrevEvent, &dbei);
if (dbei.timestamp < firstTime)
break;
- dat->hDbEventFirst = hPrevEvent;
+ hDbEventFirst = hPrevEvent;
}
break;
}
}
-void TSAPI SaveSplitter(TWindowData *dat)
+void CTabBaseDlg::SaveSplitter()
{
// group chats save their normal splitter position independently
- if (dat->bType == SESSIONTYPE_CHAT || dat->bIsAutosizingInput)
+ if (bType == SESSIONTYPE_CHAT || bIsAutosizingInput)
return;
- if (dat->splitterY < DPISCALEY_S(MINSPLITTERY) || dat->splitterY < 0)
- dat->splitterY = DPISCALEY_S(MINSPLITTERY);
+ if (splitterY < DPISCALEY_S(MINSPLITTERY) || splitterY < 0)
+ splitterY = DPISCALEY_S(MINSPLITTERY);
- if (dat->dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE)
- db_set_dw(dat->hContact, SRMSGMOD_T, "splitsplity", dat->splitterY);
+ if (dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE)
+ db_set_dw(m_hContact, SRMSGMOD_T, "splitsplity", splitterY);
else {
- if (dat->pContainer->settings->fPrivate)
- dat->pContainer->settings->splitterPos = dat->splitterY;
+ if (pContainer->settings->fPrivate)
+ pContainer->settings->splitterPos = splitterY;
else
- db_set_dw(0, SRMSGMOD_T, "splitsplity", dat->splitterY);
+ db_set_dw(0, SRMSGMOD_T, "splitsplity", splitterY);
}
}
-void TSAPI LoadSplitter(TWindowData *dat)
+void CTabBaseDlg::LoadSplitter()
{
- if (dat->bIsAutosizingInput) {
- dat->splitterY = GetDefaultMinimumInputHeight(dat);
+ if (bIsAutosizingInput) {
+ splitterY = GetDefaultMinimumInputHeight();
return;
}
- if (!(dat->dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE))
- if (!dat->pContainer->settings->fPrivate)
- dat->splitterY = (int)M.GetDword("splitsplity", (DWORD)60);
+ if (!(dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE)) {
+ if (!pContainer->settings->fPrivate)
+ splitterY = (int)M.GetDword("splitsplity", (DWORD)60);
else
- dat->splitterY = dat->pContainer->settings->splitterPos;
- else
- dat->splitterY = (int)M.GetDword(dat->hContact, "splitsplity", M.GetDword("splitsplity", (DWORD)70));
+ splitterY = pContainer->settings->splitterPos;
+ }
+ else splitterY = (int)M.GetDword(m_hContact, "splitsplity", M.GetDword("splitsplity", (DWORD)70));
- if (dat->splitterY < MINSPLITTERY || dat->splitterY < 0)
- dat->splitterY = 150;
+ if (splitterY < MINSPLITTERY || splitterY < 0)
+ splitterY = 150;
}
-void TSAPI PlayIncomingSound(const TWindowData *dat)
+void CTabBaseDlg::PlayIncomingSound() const
{
- int iPlay = Utils::mustPlaySound(dat);
+ int iPlay = Utils::mustPlaySound(this);
if (iPlay) {
- if (GetForegroundWindow() == dat->pContainer->hwnd && dat->pContainer->hwndActive == dat->hwnd)
+ if (GetForegroundWindow() == pContainer->hwnd && pContainer->hwndActive == m_hwnd)
SkinPlaySound("RecvMsgActive");
else
SkinPlaySound("RecvMsgInactive");
@@ -1224,16 +1209,16 @@ void TSAPI PlayIncomingSound(const TWindowData *dat) static UINT controls[] = { IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTSTRIKEOUT };
-void TSAPI GetSendFormat(TWindowData *dat)
+void CTabBaseDlg::GetSendFormat()
{
- dat->SendFormat = M.GetDword(dat->hContact, "sendformat", PluginConfig.m_SendFormat);
- if (dat->SendFormat == -1) // per contact override to disable it..
- dat->SendFormat = 0;
- else if (dat->SendFormat == 0)
- dat->SendFormat = PluginConfig.m_SendFormat ? 1 : 0;
+ SendFormat = M.GetDword(m_hContact, "sendformat", PluginConfig.m_SendFormat);
+ if (SendFormat == -1) // per contact override to disable it..
+ SendFormat = 0;
+ else if (SendFormat == 0)
+ SendFormat = PluginConfig.m_SendFormat ? 1 : 0;
for (int i = 0; i < _countof(controls); i++)
- Utils::enableDlgControl(dat->hwnd, controls[i], dat->SendFormat != 0);
+ Utils::enableDlgControl(m_hwnd, controls[i], SendFormat != 0);
return;
}
@@ -1243,7 +1228,7 @@ void TSAPI GetSendFormat(TWindowData *dat) //
// GetLocaleInfo() should no longer be used on Vista and later
-void TSAPI GetLocaleID(TWindowData *dat, const wchar_t *szKLName)
+void CTabBaseDlg::GetLocaleID(const wchar_t *szKLName)
{
wchar_t szLI[256], *stopped = NULL;
USHORT langID;
@@ -1256,7 +1241,7 @@ void TSAPI GetLocaleID(TWindowData *dat, const wchar_t *szKLName) memset(&pf2, 0, sizeof(PARAFORMAT2));
langID = (USHORT)wcstol(szKLName, &stopped, 16);
- dat->lcid = MAKELCID(langID, 0);
+ lcid = MAKELCID(langID, 0);
/*
* Vista+: read ISO locale names from the registry
*/
@@ -1281,117 +1266,100 @@ void TSAPI GetLocaleID(TWindowData *dat, const wchar_t *szKLName) szLI[1] = towupper(szLI[1]);
}
else {
- GetLocaleInfo(dat->lcid, LOCALE_SISO639LANGNAME, szLI, 10);
+ GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, szLI, 10);
wcsupr(szLI);
}
- fLocaleNotSet = (dat->lcID[0] == 0 && dat->lcID[1] == 0);
- mir_snwprintf(dat->lcID, szLI);
- GetStringTypeA(dat->lcid, CT_CTYPE2, (char*)szTest, 3, wCtype2);
+ fLocaleNotSet = (lcID[0] == 0 && lcID[1] == 0);
+ mir_snwprintf(lcID, szLI);
+ GetStringTypeA(lcid, CT_CTYPE2, (char*)szTest, 3, wCtype2);
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_RTLPARA;
- SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
- if (Utils::FindRTLLocale(dat) && fLocaleNotSet) {
+ m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
+ if (Utils::FindRTLLocale(this) && fLocaleNotSet) {
if (wCtype2[0] == C2_RIGHTTOLEFT || wCtype2[1] == C2_RIGHTTOLEFT || wCtype2[2] == C2_RIGHTTOLEFT) {
memset(&pf2, 0, sizeof(pf2));
pf2.dwMask = PFM_RTLPARA;
pf2.cbSize = sizeof(pf2);
pf2.wEffects = PFE_RTLPARA;
- SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
}
else {
memset(&pf2, 0, sizeof(pf2));
pf2.dwMask = PFM_RTLPARA;
pf2.cbSize = sizeof(pf2);
pf2.wEffects = 0;
- SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
}
- SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
+ m_message.SendMsg(EM_SETLANGOPTIONS, 0, m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
}
}
-void TSAPI LoadContactAvatar(TWindowData *dat)
+void CTabBaseDlg::LoadContactAvatar()
{
- if (dat == NULL) return;
-
- dat->ace = Utils::loadAvatarFromAVS(dat->bIsMeta ? db_mc_getSrmmSub(dat->hContact) : dat->hContact);
+ ace = Utils::loadAvatarFromAVS(bIsMeta ? db_mc_getSrmmSub(m_hContact) : m_hContact);
BITMAP bm;
- if (dat->ace && dat->ace->hbmPic)
- GetObject(dat->ace->hbmPic, sizeof(bm), &bm);
- else if (dat->ace == NULL)
+ if (ace && ace->hbmPic)
+ GetObject(ace->hbmPic, sizeof(bm), &bm);
+ else if (ace == NULL)
GetObject(PluginConfig.g_hbmUnknown, sizeof(bm), &bm);
else
return;
- AdjustBottomAvatarDisplay(dat);
- CalcDynamicAvatarSize(dat, &bm);
+ AdjustBottomAvatarDisplay();
+ CalcDynamicAvatarSize(&bm);
- if (!dat->Panel->isActive() || dat->pContainer->avatarMode == 3) {
- dat->iRealAvatarHeight = 0;
- PostMessage(dat->hwnd, WM_SIZE, 0, 0);
+ if (!Panel->isActive() || pContainer->avatarMode == 3) {
+ iRealAvatarHeight = 0;
+ PostMessage(m_hwnd, WM_SIZE, 0, 0);
}
- else if (dat->Panel->isActive())
- GetAvatarVisibility(dat->hwnd, dat);
+ else if (Panel->isActive())
+ GetAvatarVisibility();
}
-void TSAPI LoadOwnAvatar(TWindowData *dat)
+void CTabBaseDlg::LoadOwnAvatar()
{
- AVATARCACHEENTRY *ace = NULL;
-
if (ServiceExists(MS_AV_GETMYAVATAR))
- ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)(dat->cache->getActiveProto()));
+ ownAce = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)(cache->getActiveProto()));
+ else
+ ownAce = nullptr;
- if (ace) {
- dat->hOwnPic = ace->hbmPic;
- dat->ownAce = ace;
- }
- else {
- dat->hOwnPic = PluginConfig.g_hbmUnknown;
- dat->ownAce = NULL;
- }
- if (dat->Panel->isActive() && dat->pContainer->avatarMode != 3) {
+ if (ownAce)
+ hOwnPic = ownAce->hbmPic;
+ else
+ hOwnPic = PluginConfig.g_hbmUnknown;
+
+ if (Panel->isActive() && pContainer->avatarMode != 3) {
BITMAP bm;
- dat->iRealAvatarHeight = 0;
- AdjustBottomAvatarDisplay(dat);
- GetObject(dat->hOwnPic, sizeof(bm), &bm);
- CalcDynamicAvatarSize(dat, &bm);
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ iRealAvatarHeight = 0;
+ AdjustBottomAvatarDisplay();
+ GetObject(hOwnPic, sizeof(bm), &bm);
+ CalcDynamicAvatarSize(&bm);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
}
-void TSAPI LoadTimeZone(TWindowData *dat)
-{
- if (dat)
- dat->hTimeZone = TimeZone_CreateByContact(dat->hContact, 0, TZF_KNOWNONLY);
-}
-
// paste contents of the clipboard into the message input area and send it immediately
-void TSAPI HandlePasteAndSend(const TWindowData *dat)
+void CTabBaseDlg::HandlePasteAndSend()
{
- UINT ctrlID = dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE;
-
+ // is feature disabled?
if (!PluginConfig.m_PasteAndSend) {
- SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, ctrlID, (LPARAM)TranslateT("The 'paste and send' feature is disabled. You can enable it on the 'General' options page in the 'Sending messages' section"));
- return; // feature disabled
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("The 'paste and send' feature is disabled. You can enable it on the 'General' options page in the 'Sending messages' section"));
+ return;
}
- SendDlgItemMessage(dat->hwnd, ctrlID, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
- if (GetWindowTextLength(GetDlgItem(dat->hwnd, ctrlID)) > 0)
- SendMessage(dat->hwnd, WM_COMMAND, IDOK, 0);
+ m_message.SendMsg(EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ if (GetWindowTextLength(m_message.GetHwnd()) > 0)
+ SendMessage(m_hwnd, WM_COMMAND, IDOK, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
// draw various elements of the message window, like avatar(s), info panel fields
// and the color formatting menu
-int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat)
+int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam)
{
- if (!dat)
- return 0;
-
- HWND hwndDlg = dat->hwnd;
-
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->CtlType == ODT_MENU && dis->hwndItem == (HWND)GetSubMenu(PluginConfig.g_hMenuContext, 7)) {
RECT rc = { 0 };
@@ -1441,19 +1409,19 @@ int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat) return TRUE;
}
- HBITMAP hbmAvatar = dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown;
- if ((dis->hwndItem == GetDlgItem(hwndDlg, IDC_CONTACTPIC) && dat->bShowAvatar) || (dis->hwndItem == hwndDlg && dat->Panel->isActive())) {
+ HBITMAP hbmAvatar = ace ? ace->hbmPic : PluginConfig.g_hbmUnknown;
+ if ((dis->hwndItem == GetDlgItem(m_hwnd, IDC_CONTACTPIC) && bShowAvatar) || (dis->hwndItem == m_hwnd && Panel->isActive())) {
if (hbmAvatar == NULL)
return TRUE;
int top, cx, cy;
RECT rcClient, rcFrame;
- bool bPanelPic = dis->hwndItem == hwndDlg;
- if (bPanelPic && !dat->bShowInfoAvatar)
+ bool bPanelPic = (dis->hwndItem == m_hwnd);
+ if (bPanelPic && !bShowInfoAvatar)
return TRUE;
RECT rc;
- GetClientRect(hwndDlg, &rc);
+ GetClientRect(m_hwnd, &rc);
if (bPanelPic) {
rcClient = dis->rcItem;
cx = (rcClient.right - rcClient.left);
@@ -1479,10 +1447,10 @@ int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat) rcFrame = rcClient;
if (!bPanelPic) {
- top = (cy - dat->pic.cy) / 2;
- RECT rcEdge = { 0, top, dat->pic.cx, top + dat->pic.cy };
+ top = (cy - pic.cy) / 2;
+ RECT rcEdge = { 0, top, pic.cx, top + pic.cy };
if (CSkin::m_skinEnabled)
- CSkin::SkinDrawBG(dis->hwndItem, dat->pContainer->hwnd, dat->pContainer, &dis->rcItem, hdcDraw);
+ CSkin::SkinDrawBG(dis->hwndItem, pContainer->hwnd, pContainer, &dis->rcItem, hdcDraw);
else if (PluginConfig.m_fillColor) {
HBRUSH br = CreateSolidBrush(PluginConfig.m_fillColor);
FillRect(hdcDraw, &rcFrame, br);
@@ -1522,22 +1490,22 @@ int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat) bool bBorder = (CSkin::m_bAvatarBorderType ? true : false);
int border_off = bBorder ? 1 : 0;
- int iMaxHeight = dat->iPanelAvatarY - (bBorder ? 2 : 0);
- int iMaxWidth = dat->iPanelAvatarX - (bBorder ? 2 : 0);
+ int iMaxHeight = iPanelAvatarY - (bBorder ? 2 : 0);
+ int iMaxWidth = iPanelAvatarX - (bBorder ? 2 : 0);
rcFrame.left = rcFrame.top = 0;
rcFrame.right = (rcClient.right - rcClient.left);
rcFrame.bottom = (rcClient.bottom - rcClient.top);
- rcFrame.left = rcFrame.right - (LONG)dat->iPanelAvatarX;
- rcFrame.bottom = (LONG)dat->iPanelAvatarY;
+ rcFrame.left = rcFrame.right - (LONG)iPanelAvatarX;
+ rcFrame.bottom = (LONG)iPanelAvatarY;
int height_off = (cy - iMaxHeight - (bBorder ? 2 : 0)) / 2;
rcFrame.top += height_off;
rcFrame.bottom += height_off;
- SendMessage(dat->hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, bAero ? TRUE : FALSE);
- SetWindowPos(dat->hwndPanelPic, HWND_TOP, rcFrame.left + border_off, rcFrame.top + border_off,
+ SendMessage(hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, bAero ? TRUE : FALSE);
+ SetWindowPos(hwndPanelPic, HWND_TOP, rcFrame.left + border_off, rcFrame.top + border_off,
iMaxWidth, iMaxHeight, SWP_SHOWWINDOW | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOSENDCHANGING);
}
@@ -1550,11 +1518,11 @@ int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat) return TRUE;
}
- if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_STATICTEXT) || dis->hwndItem == GetDlgItem(hwndDlg, IDC_LOGFROZENTEXT)) {
+ if (dis->hwndItem == GetDlgItem(m_hwnd, IDC_STATICTEXT) || dis->hwndItem == GetDlgItem(m_hwnd, IDC_LOGFROZENTEXT)) {
wchar_t szWindowText[256];
if (CSkin::m_skinEnabled) {
SetTextColor(dis->hDC, CSkin::m_DefaultFontColor);
- CSkin::SkinDrawBG(dis->hwndItem, dat->pContainer->hwnd, dat->pContainer, &dis->rcItem, dis->hDC);
+ CSkin::SkinDrawBG(dis->hwndItem, pContainer->hwnd, pContainer, &dis->rcItem, dis->hDC);
}
else {
SetTextColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
@@ -1567,9 +1535,9 @@ int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat) return TRUE;
}
- if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_STATICERRORICON)) {
+ if (dis->hwndItem == GetDlgItem(m_hwnd, IDC_STATICERRORICON)) {
if (CSkin::m_skinEnabled)
- CSkin::SkinDrawBG(dis->hwndItem, dat->pContainer->hwnd, dat->pContainer, &dis->rcItem, dis->hDC);
+ CSkin::SkinDrawBG(dis->hwndItem, pContainer->hwnd, pContainer, &dis->rcItem, dis->hDC);
else
CSkin::FillBack(dis->hDC, &dis->rcItem);
DrawIconEx(dis->hDC, (dis->rcItem.right - dis->rcItem.left) / 2 - 8, (dis->rcItem.bottom - dis->rcItem.top) / 2 - 8,
@@ -1577,7 +1545,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat) return TRUE;
}
- if (dis->CtlType == ODT_MENU && dat->Panel->isHovered()) {
+ if (dis->CtlType == ODT_MENU && Panel->isHovered()) {
DrawMenuItem(dis, (HICON)dis->itemData, 0);
return TRUE;
}
@@ -1652,16 +1620,16 @@ void TSAPI LoadOverrideTheme(TContainerData *pContainer) LoadThemeDefaults(pContainer);
}
-HICON TSAPI GetXStatusIcon(const TWindowData *dat)
+HICON CTabBaseDlg::GetXStatusIcon() const
{
- BYTE xStatus = dat->cache->getXStatusId();
+ BYTE xStatus = cache->getXStatusId();
if (xStatus == 0)
return NULL;
- if (!ProtoServiceExists(dat->cache->getActiveProto(), PS_GETCUSTOMSTATUSICON))
+ if (!ProtoServiceExists(cache->getActiveProto(), PS_GETCUSTOMSTATUSICON))
return NULL;
- return (HICON)(CallProtoService(dat->cache->getActiveProto(), PS_GETCUSTOMSTATUSICON, xStatus, 0));
+ return (HICON)(CallProtoService(cache->getActiveProto(), PS_GETCUSTOMSTATUSICON, xStatus, 0));
}
LRESULT TSAPI GetSendButtonState(HWND hwnd)
@@ -1674,100 +1642,98 @@ LRESULT TSAPI GetSendButtonState(HWND hwnd) return 0;
}
-void TSAPI EnableSendButton(const TWindowData *dat, int iMode)
+void CTabBaseDlg::EnableSendButton(bool bMode) const
{
- SendDlgItemMessage(dat->hwnd, IDOK, BUTTONSETASNORMAL, iMode, 0);
- SendDlgItemMessage(dat->hwnd, IDC_PIC, BUTTONSETASNORMAL, dat->fEditNotesActive ? TRUE : (!iMode && dat->iOpenJobs == 0) ? TRUE : FALSE, 0);
-
- HWND hwndOK = GetDlgItem(GetParent(GetParent(dat->hwnd)), IDOK);
+ SendDlgItemMessage(m_hwnd, IDOK, BUTTONSETASNORMAL, bMode, 0);
+ SendDlgItemMessage(m_hwnd, IDC_PIC, BUTTONSETASNORMAL, fEditNotesActive ? TRUE : (!bMode && iOpenJobs == 0) ? TRUE : FALSE, 0);
+ HWND hwndOK = GetDlgItem(GetParent(GetParent(m_hwnd)), IDOK);
if (IsWindow(hwndOK))
- SendMessage(hwndOK, BUTTONSETASNORMAL, iMode, 0);
+ SendMessage(hwndOK, BUTTONSETASNORMAL, bMode, 0);
}
-void TSAPI SendNudge(const TWindowData *dat)
+void CTabBaseDlg::SendNudge() const
{
- if (ProtoServiceExists(dat->cache->getActiveProto(), PS_SEND_NUDGE) && ServiceExists(MS_NUDGE_SEND))
- CallService(MS_NUDGE_SEND, (WPARAM)dat->cache->getActiveContact(), 0);
+ if (ProtoServiceExists(cache->getActiveProto(), PS_SEND_NUDGE) && ServiceExists(MS_NUDGE_SEND))
+ CallService(MS_NUDGE_SEND, cache->getActiveContact(), 0);
else
- SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE,
- (LPARAM)TranslateT("Either the nudge plugin is not installed or the contact's protocol does not support sending a nudge event."));
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE,
+ (LPARAM)TranslateT("Either the nudge plugin is not installed or the contact's protocol does not support sending a nudge event."));
}
-void TSAPI GetClientIcon(TWindowData *dat)
+void CTabBaseDlg::GetClientIcon()
{
- if (dat->hClientIcon)
- DestroyIcon(dat->hClientIcon);
+ if (hClientIcon)
+ DestroyIcon(hClientIcon);
- dat->hClientIcon = 0;
+ hClientIcon = nullptr;
if (ServiceExists(MS_FP_GETCLIENTICONT)) {
- ptrW tszMirver(db_get_wsa(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "MirVer"));
+ ptrW tszMirver(db_get_wsa(cache->getActiveContact(), cache->getActiveProto(), "MirVer"));
if (tszMirver)
- dat->hClientIcon = Finger_GetClientIcon(tszMirver, 1);
+ hClientIcon = Finger_GetClientIcon(tszMirver, 1);
}
}
-void TSAPI GetMyNick(TWindowData *dat)
+void CTabBaseDlg::GetMyNick()
{
- ptrW tszNick(Contact_GetInfo(CNF_NICK, NULL, dat->cache->getActiveProto()));
+ ptrW tszNick(Contact_GetInfo(CNF_NICK, NULL, cache->getActiveProto()));
if (tszNick != NULL) {
if (mir_wstrlen(tszNick) == 0 || !mir_wstrcmp(tszNick, TranslateT("'(Unknown contact)'")))
- wcsncpy_s(dat->szMyNickname, (dat->myUin[0] ? dat->myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE);
+ wcsncpy_s(szMyNickname, (myUin[0] ? myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE);
else
- wcsncpy_s(dat->szMyNickname, tszNick, _TRUNCATE);
+ wcsncpy_s(szMyNickname, tszNick, _TRUNCATE);
}
- else wcsncpy_s(dat->szMyNickname, L"<undef>", _TRUNCATE); // same here
+ else wcsncpy_s(szMyNickname, L"<undef>", _TRUNCATE); // same here
}
-HICON TSAPI MY_GetContactIcon(const TWindowData *dat, LPCSTR szSetting)
+HICON CTabBaseDlg::GetMyContactIcon(LPCSTR szSetting)
{
int bUseMeta = (szSetting == NULL) ? false : M.GetByte(szSetting, mir_strcmp(szSetting, "MetaiconTab") == 0);
if (bUseMeta)
- return Skin_LoadProtoIcon(dat->cache->getProto(), dat->cache->getStatus());
- return Skin_LoadProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus());
+ return Skin_LoadProtoIcon(cache->getProto(), cache->getStatus());
+ return Skin_LoadProtoIcon(cache->getActiveProto(), cache->getActiveStatus());
}
/////////////////////////////////////////////////////////////////////////////////////////
// read keyboard state and return the state of the modifier keys
-void TSAPI KbdState(TWindowData *dat, BOOL& isShift, BOOL& isControl, BOOL& isAlt)
+void CTabBaseDlg::KbdState(bool &isShift, bool &isControl, bool &isAlt)
{
- GetKeyboardState(dat->kstate);
- isShift = (dat->kstate[VK_SHIFT] & 0x80);
- isControl = (dat->kstate[VK_CONTROL] & 0x80);
- isAlt = (dat->kstate[VK_MENU] & 0x80);
+ GetKeyboardState(kstate);
+ isShift = (kstate[VK_SHIFT] & 0x80) != 0;
+ isControl = (kstate[VK_CONTROL] & 0x80) != 0;
+ isAlt = (kstate[VK_MENU] & 0x80) != 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
// clear the message log
// code needs to distuingish between IM and MUC sessions.
-void TSAPI ClearLog(TWindowData *dat)
+void CTabBaseDlg::ClearLog()
{
- if (dat && dat->bType == SESSIONTYPE_IM) {
- if (dat->hwndIEView || dat->hwndHPP) {
+ if (bType == SESSIONTYPE_IM) {
+ if (hwndIEView || hwndHPP) {
IEVIEWEVENT event;
event.cbSize = sizeof(IEVIEWEVENT);
event.iType = IEE_CLEAR_LOG;
- event.dwFlags = (dat->dwFlags & MWF_LOG_RTL) ? IEEF_RTL : 0;
- event.hContact = dat->hContact;
- if (dat->hwndIEView) {
- event.hwnd = dat->hwndIEView;
+ event.dwFlags = (dwFlags & MWF_LOG_RTL) ? IEEF_RTL : 0;
+ event.hContact = m_hContact;
+ if (hwndIEView) {
+ event.hwnd = hwndIEView;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
}
else {
- event.hwnd = dat->hwndHPP;
+ event.hwnd = hwndHPP;
CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
}
}
- SetDlgItemText(dat->hwnd, IDC_LOG, L"");
- dat->hDbEventFirst = NULL;
+ m_log.SetText(L"");
+ hDbEventFirst = 0;
}
- else if (dat && dat->bType == SESSIONTYPE_CHAT && dat->si) {
- SESSION_INFO *si = dat->si;
- SESSION_INFO* s = pci->SM_FindSession(si->ptszID, si->pszModule);
+ else if (bType == SESSIONTYPE_CHAT && si) {
+ SESSION_INFO *s = pci->SM_FindSession(si->ptszID, si->pszModule);
if (s) {
- SetDlgItemText(dat->hwnd, IDC_CHAT_LOG, L"");
+ m_log.SetText(L"");
pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
s->iEventCount = 0;
s->LastTime = 0;
@@ -1775,7 +1741,7 @@ void TSAPI ClearLog(TWindowData *dat) si->LastTime = 0;
si->pLog = s->pLog;
si->pLogEnd = s->pLogEnd;
- PostMessage(dat->hwnd, WM_MOUSEACTIVATE, 0, 0);
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
}
}
@@ -1787,55 +1753,51 @@ void TSAPI ClearLog(TWindowData *dat) // the container will use this in its WM_GETMINMAXINFO handler to set
// minimum tracking height.
-void TSAPI DetermineMinHeight(TWindowData *dat)
+void CTabBaseDlg::DetermineMinHeight()
{
- if (!dat)
- return;
-
RECT rc;
- LONG height = (dat->Panel->isActive() ? dat->Panel->getHeight() + 2 : 0);
- if (!(dat->pContainer->dwFlags & CNT_HIDETOOLBAR))
+ LONG height = (Panel->isActive() ? Panel->getHeight() + 2 : 0);
+ if (!(pContainer->dwFlags & CNT_HIDETOOLBAR))
height += DPISCALEY_S(24); // toolbar
- GetClientRect(GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE), &rc);
+ GetClientRect(m_message.GetHwnd(), &rc);
height += rc.bottom; // input area
height += 40; // min space for log area and some padding
- dat->pContainer->uChildMinHeight = height;
+ pContainer->uChildMinHeight = height;
}
-bool TSAPI IsAutoSplitEnabled(const TWindowData *dat)
+bool CTabBaseDlg::IsAutoSplitEnabled() const
{
- return((dat && (dat->pContainer->dwFlags & CNT_AUTOSPLITTER) && !(dat->dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE)) ? true : false);
+ return (pContainer->dwFlags & CNT_AUTOSPLITTER) && !(dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE);
}
-LONG TSAPI GetDefaultMinimumInputHeight(const TWindowData *dat)
+LONG CTabBaseDlg::GetDefaultMinimumInputHeight() const
{
- LONG height = MINSPLITTERY;
+ LONG height;
- if (dat) {
- if (dat->bType == SESSIONTYPE_IM)
- height = ((dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46));
- else
- height = ((dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(22 + 46) : DPISCALEY_S(46)) - DPISCALEY_S(23);
+ if (bType == SESSIONTYPE_IM)
+ height = ((pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46));
+ else
+ height = ((pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(22 + 46) : DPISCALEY_S(46)) - DPISCALEY_S(23);
- if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKINPUTAREA].IGNORED)
- height += (SkinItems[ID_EXTBKINPUTAREA].MARGIN_BOTTOM + SkinItems[ID_EXTBKINPUTAREA].MARGIN_TOP - 2);
- }
- return(height);
+ if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKINPUTAREA].IGNORED)
+ height += (SkinItems[ID_EXTBKINPUTAREA].MARGIN_BOTTOM + SkinItems[ID_EXTBKINPUTAREA].MARGIN_TOP - 2);
+
+ return height;
}
static LIST<wchar_t> vTempFilenames(5);
// send a pasted bitmap by file transfer.
-void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp)
+void CTabBaseDlg::SendHBitmapAsFile(HBITMAP hbmp) const
{
- const wchar_t* mirandatempdir = L"Miranda";
- const wchar_t* filenametemplate = L"\\clp-%Y%m%d-%H%M%S0.jpg";
- wchar_t filename[MAX_PATH];
- size_t tempdirlen = GetTempPath(MAX_PATH, filename);
- bool fSend = true;
+ const wchar_t *mirandatempdir = L"Miranda";
+ const wchar_t *filenametemplate = L"\\clp-%Y%m%d-%H%M%S0.jpg";
+ wchar_t filename[MAX_PATH];
+ size_t tempdirlen = GetTempPath(MAX_PATH, filename);
+ bool fSend = true;
- const char *szProto = dat->cache->getActiveProto();
+ const char *szProto = cache->getActiveProto();
WORD wMyStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
DWORD protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
@@ -1847,13 +1809,13 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp) if (!(protoCaps & PF1_FILESEND))
fSend = false;
- if ((ID_STATUS_OFFLINE == wMyStatus) || (ID_STATUS_OFFLINE == dat->cache->getActiveStatus() && !(typeCaps & PF4_OFFLINEFILES)))
+ if ((ID_STATUS_OFFLINE == wMyStatus) || (ID_STATUS_OFFLINE == cache->getActiveStatus() && !(typeCaps & PF4_OFFLINEFILES)))
fSend = false;
- if (protoCaps & PF1_VISLIST && db_get_w(dat->cache->getActiveContact(), szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ if (protoCaps & PF1_VISLIST && db_get_w(cache->getActiveContact(), szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
fSend = false;
- if (protoCaps & PF1_INVISLIST && wMyStatus == ID_STATUS_INVISIBLE && db_get_w(dat->cache->getActiveContact(), szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ if (protoCaps & PF1_INVISLIST && wMyStatus == ID_STATUS_INVISIBLE && db_get_w(cache->getActiveContact(), szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
fSend = false;
if (!fSend) {
@@ -1921,7 +1883,7 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp) wchar_t* _t = mir_wstrdup(filename);
vTempFilenames.insert(_t);
- CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM)dat->cache->getActiveContact(), (LPARAM)ppFiles);
+ CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM)cache->getActiveContact(), (LPARAM)ppFiles);
mir_free(ppFiles[0]);
mir_free(ppFiles);
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 01f7399bd8..32ca9e0631 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -30,61 +30,21 @@ #define WANT_IEVIEW_LOG 1
#define WANT_HPP_LOG 2
-void TSAPI CalcDynamicAvatarSize(TWindowData *dat, BITMAP *bminfo);
-char* TSAPI GetCurrentMetaContactProto(TWindowData *dat);
-int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID);
-int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId);
-bool TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat);
void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam);
-void TSAPI UpdateStatusBar(const TWindowData *dat);
int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact);
wchar_t* TSAPI QuoteText(const wchar_t *text);
-void TSAPI UpdateReadChars(const TWindowData *dat);
-void TSAPI ShowPicture(TWindowData *dat, BOOL showNewPic);
-void TSAPI AdjustBottomAvatarDisplay(TWindowData *dat);
void TSAPI SetDialogToType(HWND hwndDlg);
-void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, MEVENT hEvent, DBEVENTINFO *dbei);
char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags = 0);
-BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMStringW &pszText, int iNumColors, COLORREF *pColors);
-void TSAPI GetMYUIN(TWindowData *dat);
-void TSAPI SetMessageLog(TWindowData *dat);
-void TSAPI SwitchMessageLog(TWindowData *dat, int iMode);
UINT TSAPI GetIEViewMode(MCONTACT hContact);
-void TSAPI FindFirstEvent(TWindowData *dat);
-void TSAPI SaveSplitter(TWindowData *dat);
-void TSAPI LoadSplitter(TWindowData *dat);
-void TSAPI PlayIncomingSound(const TWindowData *dat);
-void TSAPI GetSendFormat(TWindowData *dat);
-void TSAPI GetLocaleID(TWindowData *dat, const wchar_t *szKLName);
-void TSAPI LoadOwnAvatar(TWindowData *dat);
-void TSAPI LoadContactAvatar(TWindowData *dat);
-void TSAPI LoadTimeZone(TWindowData *dat);
-void TSAPI HandlePasteAndSend(const TWindowData *dat);
-int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat);
void TSAPI LoadOverrideTheme(TContainerData *pContainer);
void TSAPI LoadThemeDefaults(TContainerData *pContainer);
int TSAPI CutContactName(const wchar_t *szold, wchar_t *sznew, size_t size);
-void TSAPI SendNudge(const TWindowData *dat);
-void TSAPI EnableSendButton(const TWindowData *dat, int iMode);
LRESULT TSAPI GetSendButtonState(HWND hwnd);
-HICON TSAPI GetXStatusIcon(const TWindowData *dat);
-void TSAPI FlashTab(TWindowData *dat, HWND hwndTab, int iTabindex, BOOL *bState, BOOL mode, HICON origImage);
-void TSAPI GetClientIcon(TWindowData *dat);
-void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fSavePos);
-void TSAPI GetCachedStatusMsg(TWindowData *dat);
+void TSAPI RearrangeTab(HWND hwndDlg, const CTabBaseDlg *dat, int iMode, BOOL fSavePos);
bool TSAPI IsStatusEvent(int eventType);
bool TSAPI IsCustomEvent(int eventType);
-void TSAPI GetMyNick(TWindowData *dat);
-HICON TSAPI MY_GetContactIcon(const TWindowData *dat, LPCSTR szSetting);
-void TSAPI CheckAndDestroyIEView(TWindowData *dat);
-void TSAPI KbdState(TWindowData *dat, BOOL& isShift, BOOL& isControl, BOOL& isAlt);
-void TSAPI ClearLog(TWindowData *dat);
-bool TSAPI IsAutoSplitEnabled(const TWindowData *dat);
-LONG TSAPI GetDefaultMinimumInputHeight(const TWindowData *dat);
-void TSAPI DetermineMinHeight(TWindowData *dat);
void TSAPI CleanTempFiles();
-void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp);
extern INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index f87e1e4c40..340ea4651a 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -93,7 +93,7 @@ struct LogStreamData { int eventsToInsert;
int isEmpty;
int isAppend;
- TWindowData *dlgDat;
+ CSrmmWindow *dlgDat;
DBEVENTINFO *dbei;
};
@@ -323,7 +323,7 @@ static int AppendUnicodeToBuffer(CMStringA &str, const wchar_t *line, int mode) /////////////////////////////////////////////////////////////////////////////////////////
-static void Build_RTF_Header(CMStringA &str, TWindowData *dat)
+static void Build_RTF_Header(CMStringA &str, CSrmmWindow *dat)
{
int i;
LOGFONTA *logFonts = dat->pContainer->theme.logFonts;
@@ -381,14 +381,14 @@ static void Build_RTF_Header(CMStringA &str, TWindowData *dat) }
// mir_free() the return value
-static char* CreateRTFHeader(TWindowData *dat)
+static char* CreateRTFHeader(CSrmmWindow *dat)
{
CMStringA str;
Build_RTF_Header(str, dat);
return str.Detach();
}
-static void AppendTimeStamp(wchar_t *szFinalTimestamp, int isSent, CMStringA &str, int skipFont, TWindowData *dat, int iFontIDOffset)
+static void AppendTimeStamp(wchar_t *szFinalTimestamp, int isSent, CMStringA &str, int skipFont, CSrmmWindow *dat, int iFontIDOffset)
{
if (skipFont)
AppendUnicodeToBuffer(str, szFinalTimestamp, MAKELONG(isSent, dat->bIsHistory));
@@ -443,7 +443,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && (et->flags & DETF_MSGWINDOW);
}
-static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, MEVENT hDbEvent, LogStreamData *streamData)
+static char* Template_CreateRTFFromDbEvent(CSrmmWindow *dat, MCONTACT hContact, MEVENT hDbEvent, LogStreamData *streamData)
{
HANDLE hTimeZone = NULL;
BOOL skipToNext = FALSE, skipFont = FALSE;
@@ -1074,7 +1074,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG return 0;
}
-static void SetupLogFormatting(TWindowData *dat)
+static void SetupLogFormatting(CSrmmWindow *dat)
{
if (dat->hHistoryEvents)
strncpy_s(dat->szMicroLf, "\\v\\cf%d \\ ~-+%d+-~\\v0 ", _TRUNCATE);
@@ -1082,7 +1082,7 @@ static void SetupLogFormatting(TWindowData *dat) mir_snprintf(dat->szMicroLf, "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT));
}
-static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppend, BOOL isSent)
+static void ReplaceIcons(HWND hwndDlg, CSrmmWindow *dat, LONG startAt, int fAppend, BOOL isSent)
{
wchar_t trbuffer[40];
TEXTRANGE tr;
@@ -1204,15 +1204,14 @@ static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppe }
}
-void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s)
+void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s)
{
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE oldSel, sel;
// calc time limit for grouping
- HWND hwndrtf = dat->hwndIEView ? dat->hwndIWebBrowserControl : GetDlgItem(hwndDlg, IDC_LOG);
+ HWND hwndrtf = hwndIEView ? hwndIWebBrowserControl : m_log.GetHwnd();
- rtfFonts = dat->pContainer->theme.rtfFonts ? dat->pContainer->theme.rtfFonts : &(rtfFontsGlobal[0][0]);
+ rtfFonts = pContainer->theme.rtfFonts ? pContainer->theme.rtfFonts : &(rtfFontsGlobal[0][0]);
time_t now = time(NULL);
struct tm tm_now = *localtime(&now);
@@ -1220,22 +1219,22 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
today = mktime(&tm_today);
- if (dat->hwndIEView != NULL || dat->hwndHPP != NULL) {
+ if (hwndIEView != NULL || hwndHPP != NULL) {
const char *pszService;
IEVIEWEVENT event = { 0 };
event.cbSize = sizeof(IEVIEWEVENT);
- event.hContact = dat->hContact;
- if (dat->hwndIEView != NULL) {
- event.pszProto = dat->szProto;
- event.hwnd = dat->hwndIEView;
+ event.hContact = m_hContact;
+ if (hwndIEView != NULL) {
+ event.pszProto = szProto;
+ event.hwnd = hwndIEView;
pszService = MS_IEVIEW_EVENT;
}
else {
- event.hwnd = dat->hwndHPP;
+ event.hwnd = hwndHPP;
pszService = MS_HPP_EG_EVENT;
}
- if (dat->dwFlags & MWF_LOG_RTL)
+ if (dwFlags & MWF_LOG_RTL)
event.dwFlags = IEEF_RTL;
if (!fAppend) {
@@ -1251,7 +1250,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp evData.dwFlags = IEEDF_SENT;
else {
evData.dwFlags = IEEDF_UNICODE_NICK;
- evData.ptszNick = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ evData.ptszNick = pcli->pfnGetContactDisplayName(m_hContact, 0);
}
switch (dbei_s->eventType) {
case EVENTTYPE_STATUSCHANGE: evData.iType = IEED_EVENT_STATUSCHANGE; break;
@@ -1270,30 +1269,30 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp }
event.count = count;
CallService(pszService, 0, (LPARAM)&event);
- DM_ScrollToBottom(dat, 0, 0);
+ DM_ScrollToBottom(this, 0, 0);
if (fAppend && hDbEventFirst)
- dat->hDbEventLast = hDbEventFirst;
+ hDbEventLast = hDbEventFirst;
else
- dat->hDbEventLast = db_event_last(dat->hContact);
+ hDbEventLast = db_event_last(m_hContact);
return;
}
// separator strings used for grid lines, message separation and so on...
- dat->clr_added = FALSE;
+ clr_added = FALSE;
- if (dat->szMicroLf[0] == 0)
- SetupLogFormatting(dat);
+ if (szMicroLf[0] == 0)
+ SetupLogFormatting(this);
- szYourName = const_cast<wchar_t *>(dat->cache->getNick());
- szMyName = dat->szMyNickname;
+ szYourName = const_cast<wchar_t *>(cache->getNick());
+ szMyName = szMyNickname;
SendMessage(hwndrtf, EM_HIDESELECTION, TRUE, 0);
SendMessage(hwndrtf, EM_EXGETSEL, 0, (LPARAM)&oldSel);
LogStreamData streamData = { 0 };
- streamData.hContact = dat->hContact;
+ streamData.hContact = m_hContact;
streamData.hDbEvent = hDbEventFirst;
- streamData.dlgDat = dat;
+ streamData.dlgDat = this;
streamData.eventsToInsert = count;
streamData.isEmpty = fAppend ? GetWindowTextLength(hwndrtf) == 0 : 1;
streamData.dbei = dbei_s;
@@ -1318,7 +1317,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp sel.cpMax = GetWindowTextLength(hwndrtf);
SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&sel);
startAt = 0;
- dat->isAutoRTL = 0;
+ isAutoRTL = 0;
}
// begin to draw
@@ -1327,13 +1326,13 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp SendMessage(hwndrtf, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream);
SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&oldSel);
SendMessage(hwndrtf, EM_HIDESELECTION, FALSE, 0);
- dat->hDbEventLast = streamData.hDbEventLast;
+ hDbEventLast = streamData.hDbEventLast;
- if (dat->isAutoRTL & 1)
- SendMessage(hwndrtf, EM_SETBKGNDCOLOR, 0, (LOWORD(dat->iLastEventType) & DBEF_SENT) ? (fAppend ? dat->pContainer->theme.outbg : dat->pContainer->theme.oldoutbg) :
- (fAppend ? dat->pContainer->theme.inbg : dat->pContainer->theme.oldinbg));
+ if (isAutoRTL & 1)
+ SendMessage(hwndrtf, EM_SETBKGNDCOLOR, 0, (LOWORD(iLastEventType) & DBEF_SENT) ? (fAppend ? pContainer->theme.outbg : pContainer->theme.oldoutbg) :
+ (fAppend ? pContainer->theme.inbg : pContainer->theme.oldinbg));
- if (!(dat->isAutoRTL & 1)) {
+ if (!(isAutoRTL & 1)) {
GETTEXTLENGTHEX gtxl = { 0 };
gtxl.codepage = 1200;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
@@ -1342,7 +1341,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp sel.cpMin = sel.cpMax - 1;
SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&sel);
SendMessage(hwndrtf, EM_REPLACESEL, FALSE, (LPARAM)L"");
- dat->isAutoRTL |= 2;
+ isAutoRTL |= 2;
}
BOOL isSent;
@@ -1354,18 +1353,18 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp isSent = (dbei.flags & DBEF_SENT) != 0;
}
- ReplaceIcons(hwndDlg, dat, startAt, fAppend, isSent);
- dat->clr_added = FALSE;
+ ReplaceIcons(m_hwnd, this, startAt, fAppend, isSent);
+ clr_added = FALSE;
- if (dat->hwndIEView == NULL && dat->hwndHPP == NULL) {
+ if (hwndIEView == NULL && hwndHPP == NULL) {
int len = GetWindowTextLength(hwndrtf);
SendMessage(hwndrtf, EM_SETSEL, len - 1, len - 1);
}
- DM_ScrollToBottom(dat, 0, 0);
+ DM_ScrollToBottom(this, 0, 0);
SendMessage(hwndrtf, WM_SETREDRAW, TRUE, 0);
InvalidateRect(hwndrtf, NULL, FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_QUOTE), dat->hDbEventLast != NULL);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_QUOTE), hDbEventLast != NULL);
mir_free(streamData.buffer);
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index bfec1df09f..834e6becd5 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -115,9 +115,28 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) }
/////////////////////////////////////////////////////////////////////////////////////////
+// basic window class
+
+CTabBaseDlg::CTabBaseDlg(TNewWindowData *pData, int iResource)
+ : CSrmmBaseDialog(g_hInst, iResource),
+ m_log(this, IDC_LOG),
+ m_message(this, IDC_MESSAGE),
+ newData(pData),
+
+ pContainer(pData->pContainer),
+ m_hContact(pData->hContact)
+{
+ m_pLog = &m_log;
+ m_pEntry = &m_message;
+
+ m_autoClose = 0;
+ m_forceResizable = true;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// service function. Sets a status bar text for a contact
-static void SetStatusTextWorker(TWindowData *dat, StatusTextData *st)
+static void SetStatusTextWorker(CTabBaseDlg *dat, StatusTextData *st)
{
if (!dat)
return;
@@ -131,7 +150,7 @@ static void SetStatusTextWorker(TWindowData *dat, StatusTextData *st) if (st != NULL && st->cbSize == sizeof(StatusTextData))
dat->sbCustom = new StatusTextData(*st);
- UpdateStatusBar(dat);
+ dat->UpdateStatusBar();
}
static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
@@ -140,11 +159,11 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) if (si == NULL) {
HWND hwnd = M.FindWindow(hContact);
if (hwnd != NULL)
- SetStatusTextWorker((TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
+ SetStatusTextWorker((CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
if (hContact = db_mc_getMeta(hContact))
if (hwnd = M.FindWindow(hContact))
- SetStatusTextWorker((TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
+ SetStatusTextWorker((CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
}
else SetStatusTextWorker(si->dat, (StatusTextData*)lParam);
@@ -189,7 +208,7 @@ static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam) if (hwndTarget == 0)
return 0;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndTarget, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndTarget, GWLP_USERDATA);
return (dat) ? dat->dwFlags : 0;
}
@@ -417,7 +436,7 @@ int MyAvatarChanged(WPARAM wParam, LPARAM lParam) int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
{
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndChild, GWLP_USERDATA); // needed to obtain the hContact for the message window
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndChild, GWLP_USERDATA); // needed to obtain the hContact for the message window
if (!dat || !pContainer)
return FALSE;
@@ -428,7 +447,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); // just select the tab and let WM_NOTIFY do the rest
}
if (dat->bType == SESSIONTYPE_IM)
- SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
+ SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->m_hContact, 0);
if (IsIconic(pContainer->hwnd)) {
SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(pContainer->hwnd);
@@ -527,9 +546,9 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &item);
HWND hwnd = (HWND)item.lParam;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat) {
- int relPos = M.GetDword(dat->hContact, "tabindex", i * 100);
+ int relPos = M.GetDword(dat->m_hContact, "tabindex", i * 100);
if (iTabIndex_wanted <= relPos)
pContainer->iTabIndex = i;
}
@@ -547,14 +566,16 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, pContainer->iChilds++;
newData.bWantPopup = bWantPopup;
newData.hdbEvent = hdbEvent;
- HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSPLITNEW), hwndTab, DlgProcMessage, (LPARAM)&newData);
+
+ CSrmmWindow *pWindow = new CSrmmWindow(&newData);
+ pWindow->SetParent(hwndTab);
+ pWindow->Show();
+ HWND hwndNew = pWindow->GetHwnd();
// switchbar support
- if (pContainer->dwFlags & CNT_SIDEBAR) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndNew, GWLP_USERDATA);
- if (dat)
- pContainer->SideBar->addSession(dat, pContainer->iTabIndex);
- }
+ if (pContainer->dwFlags & CNT_SIDEBAR)
+ pContainer->SideBar->addSession(pWindow, pContainer->iTabIndex);
+
SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
// if the container is minimized, then pop it up...
@@ -663,7 +684,7 @@ int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned if (hContact == NULL || hwnd == NULL)
return 0;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat == NULL)
return 0;
BYTE bType = dat->bType;
@@ -678,8 +699,8 @@ int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
}
else {
- mwe.hwndInput = GetDlgItem(hwnd, IDC_CHAT_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_CHAT_LOG);
+ mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
+ mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
}
if (type == MSG_WINDOW_EVT_CUSTOM) {
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index d00fcfb84e..ae449daad9 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -229,19 +229,50 @@ struct TContainerData struct SESSION_INFO;
-struct TWindowData
+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
{
- UINT cbSize;
+
+protected:
+ CCtrlEdit m_log, m_message;
+ TNewWindowData *newData;
+
+ void DM_UpdateTitle(WPARAM wParam, LPARAM lParam);
+
+ void DetermineMinHeight();
+ void FindFirstEvent();
+ void GetSendFormat();
+ bool IsAutoSplitEnabled() const;
+ void LoadContactAvatar();
+ void LoadOwnAvatar();
+ void ResizeIeView();
+
+public:
BYTE bType;
- TContainerData *pContainer; // parent container description structure
- HWND hwnd;
DWORD dwFlags;
DWORD dwFlagsEx;
- MCONTACT hContact;
+ MCONTACT m_hContact;
char *szProto;
wchar_t szMyNickname[130];
wchar_t szStatusBar[100];
- StatusTextData *sbCustom;
wchar_t newtitle[130]; // tab title...
wchar_t szStatus[50];
WORD wStatus;
@@ -250,14 +281,15 @@ struct TWindowData int iSendLength; // message length in utf-8 octets
HICON hTabIcon, hTabStatusIcon, hXStatusIcon, hClientIcon, hTaskbarIcon;
HICON iFlashIcon;
- BOOL mayFlashTab;
- BOOL bTabFlash;
+ bool m_bCanFlashTab, m_bTabFlash;
HWND hwndIEView, hwndIWebBrowserControl, hwndHPP;
HWND hwndContactPic, hwndPanelPic, hwndPanelPicParent;
UINT bbLSideWidth, bbRSideWidth;
BYTE kstate[256];
SESSION_INFO *si;
+ StatusTextData *sbCustom;
+ TContainerData *pContainer; // parent container description structure
RECT rcNick, rcUIN, rcStatus, rcPic;
MEVENT hDbEventFirst, hDbEventLast;
@@ -324,16 +356,111 @@ struct TWindowData CContactCache *cache;
CProxyWindow *pWnd; // proxy window object (win7+, for taskbar support).
// ALWAYS check this pointer before using it, it is not guaranteed to exist.
+
+ bool bIsAutosizingInput;
+ bool fLimitedUpdate;
DWORD iSplitterSaved;
- BYTE bWasDeleted;
+ LONG iInputAreaHeight;
BOOL bActualHistory;
POINT ptTipActivation;
- LONG iInputAreaHeight;
- bool bIsAutosizingInput;
- bool fLimitedUpdate;
// Used for history in chats.
char *enteredText;
+
+public:
+ CTabBaseDlg(TNewWindowData*, int);
+
+ HWND DM_CreateClist();
+ void DM_InitTip();
+ void DM_NotifyTyping(int mode);
+ void DM_RecalcPictureSize();
+
+ void DM_FreeTheme();
+ void DM_ThemeChanged();
+
+ void BB_InitDlgButtons();
+ void BB_RefreshTheme();
+ BOOL BB_SetButtonsPos();
+ void BB_RedrawButtons();
+ void DM_SetDBButtonStates();
+
+ void CB_DestroyAllButtons();
+ void CB_DestroyButton(DWORD dwButtonCID, DWORD dwFlags);
+ void CB_ChangeButton(CustomButtonData *cbd);
+
+ void AdjustBottomAvatarDisplay();
+ void CalcDynamicAvatarSize(BITMAP *bminfo);
+ void ClearLog();
+ BOOL DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors) const;
+ void EnableSendButton(bool bMode) const;
+ void FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei);
+ void FlashTab(bool bInvertMode);
+ bool GetAvatarVisibility();
+ void GetClientIcon();
+ LONG GetDefaultMinimumInputHeight() const;
+ void GetLocaleID(const wchar_t *szKLName);
+ HICON GetMyContactIcon(LPCSTR szSetting);
+ void GetMYUIN();
+ void GetMyNick();
+ HICON GetXStatusIcon() const;
+ void HandlePasteAndSend();
+ void KbdState(bool &isShift, bool &isControl, bool &isAlt);
+ int LoadLocalFlags();
+ void LoadSplitter();
+ void PlayIncomingSound() const;
+ void SendHBitmapAsFile(HBITMAP hbmp) const;
+ void SaveSplitter();
+ void SendNudge() const;
+ void SetMessageLog();
+ void ShowPicture(bool showNewPic);
+ void UpdateReadChars() const;
+ void UpdateStatusBar() const;
+
+ int MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam);
+ int MsgWindowUpdateMenu(HMENU submenu, int menuID);
+ int MsgWindowMenuHandler(int selection, int menuId);
+
+ void RenderToolbarBG(HDC hdc, const RECT &rcWindow) const;
+ void UpdateToolbarBG();
+};
+
+class CSrmmWindow : public CTabBaseDlg, public MZeroedObject
+{
+ void DM_OptionsApplied(WPARAM wParam, LPARAM lParam);
+ void MsgWindowUpdateState(UINT msg);
+
+public:
+ int msgTop, rcLogBottom;
+
+public:
+ CSrmmWindow(TNewWindowData*);
+
+ virtual void OnInitDialog() override;
+ virtual void OnDestroy() override;
+
+ virtual int Resizer(UTILRESIZECONTROL *urc) override;
+
+ virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+
+ void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s);
+};
+
+class CChatRoomDlg : public CTabBaseDlg, public MZeroedObject
+{
+ bool m_bWasDeleted;
+
+public:
+ CChatRoomDlg(TNewWindowData*);
+
+ virtual void OnInitDialog() override;
+ virtual void OnDestroy() override;
+
+ virtual int Resizer(UTILRESIZECONTROL *urc) override;
+
+ virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+
+ void StreamInEvents(LOGINFO* lin, SESSION_INFO *si, bool bRedraw);
+ void UpdateWindowState(UINT msg);
};
#define MESSAGE_WINDOW_DATA_SIZE offsetof(_MessageWindowData, hdbEventFirst);
@@ -406,25 +533,6 @@ struct TIconDescW #define MIN_PANELHEIGHT 20
-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;
-};
-
// flags for the container dwFlags
#define CNT_MOUSEDOWN 1
#define CNT_NOTITLE 2
@@ -789,8 +897,8 @@ struct SIDEBARITEM { DWORD dwFlags;
HICON *hIcon, *hIconPressed, *hIconHover;
wchar_t *szName;
- void(*pfnAction)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
- void(*pfnCallback)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
+ void(*pfnAction)(ButtonItem *item, HWND hwndDlg, CSrmmWindow *dat, HWND hwndItem);
+ void(*pfnCallback)(ButtonItem *item, HWND hwndDlg, CSrmmWindow *dat, HWND hwndItem);
wchar_t *tszTip;
};
@@ -955,8 +1063,8 @@ int SI_InitStatusIcons(); int SI_DeinitStatusIcons();
int GetStatusIconsCount();
-void DrawStatusIcons(TWindowData *dat, HDC hdc, const RECT &r, int gap);
-void CheckStatusIconClick(TWindowData *dat, POINT pt, const RECT &rc, int gap, int code);
+void DrawStatusIcons(CTabBaseDlg *dat, HDC hdc, const RECT &r, int gap);
+void CheckStatusIconClick(CTabBaseDlg *dat, POINT pt, const RECT &rc, int gap, int code);
struct SKINDESC
{
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index 5dc5fbd09b..b708f5f887 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -45,7 +45,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TranslateDialogDefault(hwndDlg);
if (lParam) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
if (dat) {
mir_snwprintf(szNewTitle, TranslateT("Select container for %s"), dat->cache->getNick());
SetWindowText(hwndDlg, szNewTitle);
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index dcabc6bc29..3de3fe7e77 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -35,17 +35,17 @@ SendQueue *sendQueue = 0; // as "failed" by either the ACKRESULT_FAILED or a timeout handler // returns: zero-based queue index or -1 if none was found -int SendQueue::findNextFailed(const TWindowData *dat) const +int SendQueue::findNextFailed(const CSrmmWindow *dat) const { if (dat) for (int i = 0; i < NR_SENDJOBS; i++) - if (m_jobs[i].hContact == dat->hContact && m_jobs[i].iStatus == SQ_ERROR) + if (m_jobs[i].hContact == dat->m_hContact && m_jobs[i].iStatus == SQ_ERROR) return i; return -1; } -void SendQueue::handleError(TWindowData *dat, const int iEntry) const +void SendQueue::handleError(CSrmmWindow *dat, const int iEntry) const { if (!dat) return; @@ -63,13 +63,13 @@ void SendQueue::handleError(TWindowData *dat, const int iEntry) const //add a message to the sending queue. // iLen = required size of the memory block to hold the message -int SendQueue::addTo(TWindowData *dat, size_t iLen, int dwFlags) +int SendQueue::addTo(CSrmmWindow *dat, size_t iLen, int dwFlags) { int i; int iFound = NR_SENDJOBS; if (m_currentIndex >= NR_SENDJOBS) { - _DebugPopup(dat->hContact, L"Send queue full"); + _DebugPopup(dat->m_hContact, L"Send queue full"); return 0; } @@ -90,7 +90,7 @@ int SendQueue::addTo(TWindowData *dat, size_t iLen, int dwFlags) } entry_found: if (iFound == NR_SENDJOBS) { - _DebugPopup(dat->hContact, L"Send queue full"); + _DebugPopup(dat->m_hContact, L"Send queue full"); return 0; } @@ -101,7 +101,7 @@ entry_found: job.dwFlags = dwFlags; job.dwTime = time(NULL); - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->GetHwnd(); dat->cache->saveHistory(0, 0); ::SetDlgItemText(hwndDlg, IDC_MESSAGE, L""); @@ -190,10 +190,10 @@ size_t SendQueue::getSendLength(const int iEntry) return p.iSendLength; } -int SendQueue::sendQueued(TWindowData *dat, const int iEntry) +int SendQueue::sendQueued(CSrmmWindow *dat, const int iEntry) { - HWND hwndDlg = dat->hwnd; - CContactCache *ccActive = CContactCache::getContactCache(dat->hContact); + HWND hwndDlg = dat->GetHwnd(); + CContactCache *ccActive = CContactCache::getContactCache(dat->m_hContact); if (dat->sendMode & SMODE_MULTIPLE) { int iJobs = 0; @@ -216,7 +216,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) if (iSendLength >= iMinLength) { wchar_t tszError[256]; mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength); - ::SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); + ::SendMessage(dat->GetHwnd(), DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); sendQueue->clearJob(iEntry); return 0; } @@ -235,7 +235,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) return 0; } - if (dat->hContact == NULL) + if (dat->m_hContact == NULL) return 0; //never happens dat->nMax = (int)dat->cache->getMaxMessageLength(); // refresh length info @@ -271,7 +271,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) size_t iSendLength = getSendLength(iEntry); if ((int)iSendLength >= dat->nMax) { mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax); - SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); + SendMessage(dat->GetHwnd(), DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); clearJob(iEntry); return 0; } @@ -279,11 +279,11 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) clearJob(iEntry); return 0; } - m_jobs[iEntry].hSendId = (HANDLE)ProtoChainSend(dat->hContact, PSS_MESSAGE, m_jobs[iEntry].dwFlags, (LPARAM)m_jobs[iEntry].szSendBuffer); + m_jobs[iEntry].hSendId = (HANDLE)ProtoChainSend(dat->m_hContact, PSS_MESSAGE, m_jobs[iEntry].dwFlags, (LPARAM)m_jobs[iEntry].szSendBuffer); if (dat->sendMode & SMODE_NOACK) { // fake the ack if we are not interested in receiving real acks ACKDATA ack = { 0 }; - ack.hContact = dat->hContact; + ack.hContact = dat->m_hContact; ack.hProcess = m_jobs[iEntry].hSendId; ack.type = ACKTYPE_MESSAGE; ack.result = ACKRESULT_SUCCESS; @@ -297,7 +297,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) // give icon feedback... if (dat->pContainer->hwndActive == hwndDlg) - ::UpdateReadChars(dat); + dat->UpdateReadChars(); if (!(dat->sendMode & SMODE_NOACK)) ::HandleIconFeedback(dat, PluginConfig.g_IconSend); @@ -321,18 +321,18 @@ void SendQueue::clearJob(const int iIndex) // ) user decided to cancel a failed send // it removes the completed / canceled send job from the queue and schedules the next job to send (if any) -void SendQueue::checkQueue(const TWindowData *dat) const +void SendQueue::checkQueue(const CSrmmWindow *dat) const { if (dat) { - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->GetHwnd(); if (dat->iOpenJobs == 0) - ::HandleIconFeedback(const_cast<TWindowData *>(dat), (HICON)INVALID_HANDLE_VALUE); + ::HandleIconFeedback(const_cast<CSrmmWindow *>(dat), (HICON)INVALID_HANDLE_VALUE); else if (!(dat->sendMode & SMODE_NOACK)) - ::HandleIconFeedback(const_cast<TWindowData *>(dat), PluginConfig.g_IconSend); + ::HandleIconFeedback(const_cast<CSrmmWindow *>(dat), PluginConfig.g_IconSend); if (dat->pContainer->hwndActive == hwndDlg) - ::UpdateReadChars(const_cast<TWindowData *>(dat)); + dat->UpdateReadChars(); } } @@ -340,7 +340,7 @@ void SendQueue::checkQueue(const TWindowData *dat) const // logs an error message to the message window.Optionally, appends the original message // from the given sendJob (queue index) -void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const wchar_t *szErrMsg) const +void SendQueue::logError(CSrmmWindow *dat, int iSendJobIndex, const wchar_t *szErrMsg) const { if (dat == 0) return; @@ -361,7 +361,7 @@ void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const wchar_ dbei.cbBlob = (int)iMsgLen; dbei.timestamp = time(NULL); dbei.szModule = (char *)szErrMsg; - StreamInEvents(dat->hwnd, NULL, 1, 1, &dbei); + dat->StreamInEvents(NULL, 1, 1, &dbei); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -370,23 +370,23 @@ void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const wchar_ // ) multisend contact list instance // ) send button -void SendQueue::EnableSending(const TWindowData *dat, const int iMode) +void SendQueue::EnableSending(const CSrmmWindow *dat, bool bMode) { if (dat) { - HWND hwndDlg = dat->hwnd; - ::SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, (WPARAM)iMode ? FALSE : TRUE, 0); - Utils::enableDlgControl(hwndDlg, IDC_CLIST, iMode ? TRUE : FALSE); - ::EnableSendButton(dat, iMode); + HWND hwndDlg = dat->GetHwnd(); + ::SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, !bMode, 0); + Utils::enableDlgControl(hwndDlg, IDC_CLIST, bMode); + dat->EnableSendButton(bMode); } } ///////////////////////////////////////////////////////////////////////////////////////// // show or hide the error control button bar on top of the window -void SendQueue::showErrorControls(TWindowData *dat, const int showCmd) const +void SendQueue::showErrorControls(CSrmmWindow *dat, const int showCmd) const { UINT myerrorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER }; - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->GetHwnd(); if (showCmd) { TCITEM item = { 0 }; @@ -411,27 +411,27 @@ void SendQueue::showErrorControls(TWindowData *dat, const int showCmd) const EnableSending(dat, TRUE); } -void SendQueue::recallFailed(const TWindowData *dat, int iEntry) const +void SendQueue::recallFailed(const CSrmmWindow *dat, int iEntry) const { if (dat == NULL) return; - int iLen = GetWindowTextLength(GetDlgItem(dat->hwnd, IDC_MESSAGE)); + int iLen = GetWindowTextLength(GetDlgItem(dat->GetHwnd(), IDC_MESSAGE)); NotifyDeliveryFailure(dat); if (iLen != 0) return; // message area is empty, so we can recall the failed message... SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; - SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer); - UpdateSaveAndSendButton(const_cast<TWindowData *>(dat)); - SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETSEL, (WPARAM)-1, (LPARAM)-1); + SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer); + UpdateSaveAndSendButton(const_cast<CSrmmWindow *>(dat)); + SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_SETSEL, (WPARAM)-1, (LPARAM)-1); } -void SendQueue::UpdateSaveAndSendButton(TWindowData *dat) +void SendQueue::UpdateSaveAndSendButton(CSrmmWindow *dat) { if (dat) { - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->GetHwnd(); GETTEXTLENGTHEX gtxl = { 0 }; gtxl.codepage = CP_UTF8; @@ -439,9 +439,9 @@ void SendQueue::UpdateSaveAndSendButton(TWindowData *dat) int len = SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); if (len && GetSendButtonState(hwndDlg) == PBS_DISABLED) - EnableSendButton(dat, TRUE); + dat->EnableSendButton(TRUE); else if (len == 0 && GetSendButtonState(hwndDlg) != PBS_DISABLED) - EnableSendButton(dat, FALSE); + dat->EnableSendButton(FALSE); if (len) { // looks complex but avoids flickering on the button while typing. if (!(dat->dwFlags & MWF_SAVEBTN_SAV)) { @@ -459,7 +459,7 @@ void SendQueue::UpdateSaveAndSendButton(TWindowData *dat) } } -void SendQueue::NotifyDeliveryFailure(const TWindowData *dat) +void SendQueue::NotifyDeliveryFailure(const CSrmmWindow *dat) { if (M.GetByte("adv_noErrorPopups", 0)) return; @@ -468,7 +468,7 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat) return; POPUPDATAT ppd = { 0 }; - ppd.lchContact = dat->hContact; + ppd.lchContact = dat->m_hContact; wcsncpy_s(ppd.lptzContactName, dat->cache->getNick(), _TRUNCATE); wcsncpy_s(ppd.lptzText, TranslateT("A message delivery has failed.\nClick to open the message window."), _TRUNCATE); @@ -507,7 +507,7 @@ int SendQueue::RTL_Detect(const WCHAR *pszwText) return(n >= 2 ? 1 : 0); } -int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam) +int SendQueue::ackMessage(CSrmmWindow *dat, WPARAM wParam, LPARAM lParam) { ACKDATA *ack = (ACKDATA *)lParam; @@ -541,7 +541,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam) mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), _A2T((char *)ack->lParam)); job.iStatus = SQ_ERROR; - KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound); + KillTimer(dat->GetHwnd(), TIMERID_MSGSEND + iFound); if (!(dat->dwFlags & MWF_ERRORSTATE)) handleError(dat, iFound); return 0; @@ -590,7 +590,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (job.iAcksNeeded == 0) { // everything sent clearJob(iFound); if (dat) { - KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound); + KillTimer(dat->GetHwnd(), TIMERID_MSGSEND + iFound); dat->iOpenJobs--; } m_currentIndex--; @@ -604,7 +604,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam) else { if (M.GetByte("AutoClose", 0)) { if (M.GetByte("adv_AutoClose_2", 0)) - SendMessage(dat->hwnd, WM_CLOSE, 0, 1); + SendMessage(dat->GetHwnd(), WM_CLOSE, 0, 1); else SendMessage(dat->pContainer->hwnd, WM_CLOSE, 0, 0); } @@ -631,7 +631,7 @@ LRESULT SendQueue::WarnPendingJobs(unsigned int) // // @return the index on success, -1 on failure -int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, bool fIsSendLater) +int SendQueue::doSendLater(int iJobIndex, CSrmmWindow *dat, MCONTACT hContact, bool fIsSendLater) { bool fAvail = sendLater->isAvail(); @@ -647,19 +647,19 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.szModule = GetContactProto(dat->hContact); + dbei.szModule = GetContactProto(dat->m_hContact); dbei.timestamp = time(NULL); dbei.cbBlob = (int)mir_strlen(utfText) + 1; dbei.pBlob = (PBYTE)(char*)utfText; - StreamInEvents(dat->hwnd, 0, 1, 1, &dbei); + dat->StreamInEvents(0, 1, 1, &dbei); if (dat->hDbEventFirst == NULL) - SendMessage(dat->hwnd, DM_REMAKELOG, 0, 0); + SendMessage(dat->GetHwnd(), DM_REMAKELOG, 0, 0); dat->cache->saveHistory(0, 0); - EnableSendButton(dat, FALSE); - if (dat->pContainer->hwndActive == dat->hwnd) - UpdateReadChars(dat); - SendDlgItemMessage(dat->hwnd, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]); - SendDlgItemMessage(dat->hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_UNICODE); + dat->EnableSendButton(false); + if (dat->pContainer->hwndActive == dat->GetHwnd()) + dat->UpdateReadChars(); + SendDlgItemMessage(dat->GetHwnd(), IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]); + SendDlgItemMessage(dat->GetHwnd(), IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_UNICODE); dat->dwFlags &= ~MWF_SAVEBTN_SAV; if (!fAvail) diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index 48be92645e..db914f214c 100644 --- a/plugins/TabSRMM/src/sendqueue.h +++ b/plugins/TabSRMM/src/sendqueue.h @@ -85,26 +85,26 @@ public: SendJob *getJobByIndex(const int index) { return(&m_jobs[index]); }
void clearJob(const int index);
- int findNextFailed(const TWindowData *dat) const;
- void handleError(TWindowData *dat, const int iEntry) const;
- int addTo(TWindowData *dat, size_t iLen, int dwFlags);
- int sendQueued(TWindowData *dat, const int iEntry);
+ int findNextFailed(const CSrmmWindow *dat) const;
+ void handleError(CSrmmWindow *dat, const int iEntry) const;
+ int addTo(CSrmmWindow *dat, size_t iLen, int dwFlags);
+ int sendQueued(CSrmmWindow *dat, const int iEntry);
size_t getSendLength(const int iEntry);
- void checkQueue(const TWindowData *dat) const;
- void logError(const TWindowData *dat, int iSendJobIndex, const wchar_t *szErrMsg) const;
- void recallFailed(const TWindowData *dat, int iEntry) const;
- void showErrorControls(TWindowData *dat, const int showCmd) const;
- int ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam);
- int doSendLater(int iIndex, TWindowData *dat, MCONTACT hContact = 0, bool fIsSendLater = true);
+ void checkQueue(const CSrmmWindow *dat) const;
+ void logError(CSrmmWindow *dat, int iSendJobIndex, const wchar_t *szErrMsg) const;
+ void recallFailed(const CSrmmWindow *dat, int iEntry) const;
+ void showErrorControls(CSrmmWindow *dat, const int showCmd) const;
+ int ackMessage(CSrmmWindow *dat, WPARAM wParam, LPARAM lParam);
+ int doSendLater(int iIndex, CSrmmWindow *dat, MCONTACT hContact = 0, bool fIsSendLater = true);
/*
* static members
*/
static int TSAPI RTL_Detect(const wchar_t *pszwText);
static int TSAPI GetProtoIconFromList(const char *szProto, int iStatus);
static LRESULT TSAPI WarnPendingJobs(unsigned int uNrMessages);
- static void TSAPI NotifyDeliveryFailure(const TWindowData *dat);
- static void TSAPI UpdateSaveAndSendButton(TWindowData *dat);
- static void TSAPI EnableSending(const TWindowData *dat, const int iMode);
+ static void TSAPI NotifyDeliveryFailure(const CSrmmWindow *dat);
+ static void TSAPI UpdateSaveAndSendButton(CSrmmWindow *dat);
+ static void TSAPI EnableSending(const CSrmmWindow *dat, bool bMode);
private:
SendJob m_jobs[NR_SENDJOBS];
@@ -115,6 +115,6 @@ extern SendQueue *sendQueue; int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild);
void TSAPI ShowMultipleControls(const HWND hwndDlg, const UINT * controls, int cControls, int state);
-void TSAPI HandleIconFeedback(TWindowData *dat, HICON iIcon);
+void TSAPI HandleIconFeedback(CTabBaseDlg *dat, HICON iIcon);
#endif /* __SENDQUEUE_H */
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 468125ecdf..72d249c12f 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -71,10 +71,10 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { }
};
-CSideBarButton::CSideBarButton(const TWindowData *dat, CSideBar *sideBar)
+CSideBarButton::CSideBarButton(const CTabBaseDlg *dat, CSideBar *sideBar)
{
m_dat = dat;
- m_id = UINT(dat->hContact); // set the control id
+ m_id = UINT(dat->m_hContact); // set the control id
m_sideBar = sideBar;
_create();
}
@@ -254,7 +254,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const if (m_dat && pContainer) {
hIcon = m_dat->cache->getIcon(iSize);
- if (m_dat->mayFlashTab == FALSE || (m_dat->mayFlashTab == TRUE && m_dat->bTabFlash != 0) || !(pContainer->dwFlagsEx & TCF_FLASHICON)) {
+ if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !(pContainer->dwFlagsEx & TCF_FLASHICON)) {
DWORD ix = rc.left + 4;
DWORD iy = (rc.bottom + rc.top - iSize) / 2;
if (m_dat->dwFlagsEx & MWF_SHOW_ISIDLE && PluginConfig.m_bIdleDetect)
@@ -280,7 +280,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const ::SetBkMode(hdc, TRANSPARENT);
- if (m_dat->mayFlashTab == FALSE || (m_dat->mayFlashTab == TRUE && m_dat->bTabFlash != 0) || !(pContainer->dwFlagsEx & TCF_FLASHLABEL)) {
+ if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !(pContainer->dwFlagsEx & TCF_FLASHLABEL)) {
bool fIsActive = (m_sideBar->getActiveItem() == this ? true : false);
COLORREF clr = 0;
dwTextFlags |= DT_WORD_ELLIPSIS;
@@ -333,7 +333,7 @@ int CSideBarButton::testCloseButton() const void CSideBarButton::activateSession() const
{
if (m_dat)
- ::SendMessage(m_dat->hwnd, DM_ACTIVATEME, 0, 0); // the child window will activate itself
+ ::SendMessage(m_dat->GetHwnd(), DM_ACTIVATEME, 0, 0); // the child window will activate itself
}
// show the context menu (same as on tabs
@@ -505,7 +505,7 @@ void CSideBar::populateAll() if (item.lParam == 0 || !IsWindow((HWND)item.lParam))
continue;
- TWindowData *dat = (TWindowData*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
if (dat == NULL)
continue;
@@ -530,7 +530,7 @@ void CSideBar::populateAll() * (that is, it can only be used after WM_INITIALOG completed).
*position: -1 = append, otherwise insert it at the given position
*/
-void CSideBar::addSession(const TWindowData *dat, int position)
+void CSideBar::addSession(const CTabBaseDlg *dat, int position)
{
if (!m_isActive)
return;
@@ -552,7 +552,7 @@ void CSideBar::addSession(const TWindowData *dat, int position) else
m_buttonlist.insert(item, position);
- SendDlgItemMessage(dat->hwnd, IDC_TOGGLESIDEBAR, BM_SETIMAGE, IMAGE_ICON,
+ SendDlgItemMessage(dat->GetHwnd(), IDC_TOGGLESIDEBAR, BM_SETIMAGE, IMAGE_ICON,
(LPARAM)(m_dwFlags & SIDEBARORIENTATION_LEFT ? PluginConfig.g_buttonBarIcons[ICON_DEFAULT_LEFT] : PluginConfig.g_buttonBarIcons[ICON_DEFAULT_RIGHT]));
Invalidate();
@@ -563,7 +563,7 @@ void CSideBar::addSession(const TWindowData *dat, int position) *
* @param dat _MessageWindowData *: session data for a client session.
*/
-HRESULT CSideBar::removeSession(const TWindowData *dat)
+HRESULT CSideBar::removeSession(const CTabBaseDlg *dat)
{
if (dat) {
CSideBarButton *item = findSession(dat);
@@ -649,7 +649,7 @@ void CSideBar::scrollIntoView(const CSideBarButton *item) *
* @param dat _MessageWindowData*: Session data
*/
-void CSideBar::updateSession(const TWindowData *dat)
+void CSideBar::updateSession(const CTabBaseDlg *dat)
{
if (!m_isVisible || !m_isActive)
return;
@@ -681,7 +681,7 @@ void CSideBar::updateSession(const TWindowData *dat) *
* @return The previously active item (that can be zero)
*/
-const CSideBarButton* CSideBar::setActiveItem(const TWindowData *dat)
+const CSideBarButton* CSideBar::setActiveItem(const CTabBaseDlg *dat)
{
CSideBarButton *item = findSession(dat);
if (item != NULL)
@@ -805,7 +805,7 @@ void CSideBar::showAll(int showCmd) * @return CSideBarButtonItem*: pointer to the found item. Zero, if none was found
*/
-CSideBarButton* CSideBar::findSession(const TWindowData *dat)
+CSideBarButton* CSideBar::findSession(const CTabBaseDlg *dat)
{
if (dat == NULL)
return NULL;
@@ -865,7 +865,7 @@ void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG, LONG height) const SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
}
-void CSideBar::invalidateButton(const TWindowData *dat)
+void CSideBar::invalidateButton(const CTabBaseDlg *dat)
{
if (m_isActive && m_isVisible) {
CSideBarButton *item = findSession(dat);
@@ -1039,10 +1039,8 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT }
}
-void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rcBox,
- const CSideBarButton *item)
+void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rcBox, const CSideBarButton *item)
{
- const TWindowData *dat = item->getDat();
UINT id = item->getID();
int stateID = item->m_buttonControl->stateId;
@@ -1052,7 +1050,7 @@ void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rc if (!M.isAero() && stateID == PBS_HOT)
::DrawEdge(hdc, const_cast<RECT *>(rcBox), BDR_INNER, BF_RECT | BF_SOFT | BF_FLAT);
}
- else if (dat)
+ else if (item->getDat())
item->renderIconAndNick(hdc, rcBox);
}
@@ -1063,7 +1061,7 @@ void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rc void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *rcBox,
const CSideBarButton *item)
{
- const TWindowData *dat = item->getDat();
+ const CTabBaseDlg *dat = item->getDat();
UINT id = item->getID();
LONG cx = rcBox->right - rcBox->left;
@@ -1076,18 +1074,18 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r RECT rc = *rcBox;
if (dat->ace && dat->ace->hbmPic) { // we have an avatar
- double dNewHeight, dNewWidth;
- LONG maxHeight = cy - 8;
- bool fFree = false;
+ double dNewHeight, dNewWidth;
+ LONG maxHeight = cy - 8;
+ bool fFree = false;
Utils::scaleAvatarHeightLimited(dat->ace->hbmPic, dNewWidth, dNewHeight, maxHeight);
HBITMAP hbmResized = CSkin::ResizeBitmap(dat->ace->hbmPic, dNewWidth, dNewHeight, fFree);
- HDC dc = CreateCompatibleDC(hdc);
+ HDC dc = CreateCompatibleDC(hdc);
HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(dc, hbmResized));
- LONG xOff = (cx - maxHeight) + (maxHeight - (LONG)dNewWidth) / 2 - 4;
- LONG yOff = (cy - (LONG)dNewHeight) / 2;
+ LONG xOff = (cx - maxHeight) + (maxHeight - (LONG)dNewWidth) / 2 - 4;
+ LONG yOff = (cy - (LONG)dNewHeight) / 2;
GdiAlphaBlend(hdc, xOff, yOff, (LONG)dNewWidth, (LONG)dNewHeight, dc, 0, 0, (LONG)dNewWidth, (LONG)dNewHeight, CSkin::m_default_bf);
::SelectObject(dc, hbmOld);
@@ -1097,11 +1095,8 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r rc.right -= (maxHeight + 6);
}
- /*
- * calculate metrics based on font configuration. Determine if we have enough
- * space for both lines
- */
-
+ // calculate metrics based on font configuration. Determine if we have enough
+ // space for both lines
rc.left += 3;
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
::GetTextExtentPoint32A(hdc, "A", 1, &szFirstLine);
@@ -1124,11 +1119,8 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r int iSize;
HICON hIcon = dat->cache->getIcon(iSize);
- /*
- * TODO support larger icons at a later time. This side bar button
- * could use 32x32 icons as well.
- */
-
+ // TODO support larger icons at a later time. This side bar button
+ // could use 32x32 icons as well.
rc.top = rc.bottom - szSecondLine.cy - 2;
::DrawIconEx(hdc, rc.left, rc.top + (rc.bottom - rc.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
rc.left += 18;
@@ -1148,21 +1140,21 @@ const SIZE& __fastcall CSideBar::m_measureAdvancedVertical(CSideBarButton* item) {
SIZE sz = { 0 };
- const TWindowData *dat = item->getDat();
+ const CTabBaseDlg *dat = item->getDat();
if (dat) {
SIZE szFirstLine, szSecondLine;
if (dat->ace && dat->ace->hbmPic)
sz.cy = item->getLayout()->width;
- HDC dc = ::GetDC(dat->hwnd);
+ HDC dc = ::GetDC(dat->GetHwnd());
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
::GetTextExtentPoint32(dc, dat->cache->getNick(), (int)mir_wstrlen(dat->cache->getNick()), &szFirstLine);
::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS]);
::GetTextExtentPoint32(dc, dat->szStatus, (int)mir_wstrlen(dat->szStatus), &szSecondLine);
::SelectObject(dc, hOldFont);
- ReleaseDC(dat->hwnd, dc);
+ ReleaseDC(dat->GetHwnd(), dc);
szSecondLine.cx += 18; // icon space
diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index b4c565ec7e..2ee7f35d90 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -31,8 +31,8 @@ struct TSideBarNotify
{
- NMHDR nmHdr;
- const TWindowData* dat;
+ NMHDR nmHdr;
+ const CTabBaseDlg *dat;
};
/* layout description structure */
@@ -61,7 +61,7 @@ class CSideBarButton {
public:
CSideBarButton(const UINT id, CSideBar *sideBar);
- CSideBarButton(const TWindowData *dat, CSideBar *sideBar);
+ CSideBarButton(const CTabBaseDlg *dat, CSideBar *sideBar);
~CSideBarButton();
LONG getHeight() const { return(m_sz.cy); }
@@ -70,8 +70,8 @@ public: const bool isTopAligned() const { return(m_isTopAligned); }
const HWND getHwnd() const { return(m_hwnd); }
const UINT getID() const { return(m_id); }
- const MCONTACT getContactHandle() const { return(m_dat->hContact); }
- const TWindowData* getDat() const { return(m_dat); }
+ const MCONTACT getContactHandle() const { return(m_dat->m_hContact); }
+ const CTabBaseDlg* getDat() const { return(m_dat); }
const TSideBarLayout* getLayout() const { return(m_sideBarLayout); }
void RenderThis(const HDC hdc) const;
@@ -91,7 +91,7 @@ private: private:
const TSideBarLayout* m_sideBarLayout;
HWND m_hwnd; // window handle for the TSButton object
- const TWindowData* m_dat; // session data
+ const CTabBaseDlg* m_dat; // session data
UINT m_id; // control id
bool m_isTopAligned;
SIZE m_sz;
@@ -130,9 +130,9 @@ public: ~CSideBar();
void Init();
- void addSession(const TWindowData *dat, int position);
- HRESULT removeSession(const TWindowData *dat);
- void updateSession(const TWindowData *dat);
+ void addSession(const CTabBaseDlg *dat, int position);
+ HRESULT removeSession(const CTabBaseDlg *dat);
+ void updateSession(const CTabBaseDlg *dat);
void processScrollerButtons(UINT cmd);
void Layout(const RECT *rc = 0, bool fOnlyCalc = false);
@@ -149,7 +149,7 @@ public: const CSideBarButton* getScrollDown() const { return(m_down); }
bool isSkinnedContainer() const { return(CSkin::m_skinEnabled ? true : false); }
const UINT getLayoutId() const { return(m_uLayout); }
- void invalidateButton(const TWindowData *dat);
+ void invalidateButton(const CTabBaseDlg *dat);
const CSideBarButton* setActiveItem(const CSideBarButton *newItem)
{
@@ -171,7 +171,7 @@ public: }
HWND getScrollWnd() const { return(m_hwndScrollWnd); }
const CSideBarButton* getHoveredClose() const { return(m_hoveredClose); }
- const CSideBarButton* setActiveItem(const TWindowData *dat);
+ const CSideBarButton* setActiveItem(const CTabBaseDlg *dat);
static LRESULT CALLBACK wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -189,7 +189,7 @@ private: void populateAll();
void removeAll();
void Invalidate();
- CSideBarButton* findSession(const TWindowData *dat);
+ CSideBarButton* findSession(const CTabBaseDlg *dat);
CSideBarButton* findSession(const MCONTACT hContact);
LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index dbb1a59233..d37e847728 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -245,7 +245,7 @@ extern CREOleCallback2 reOleCallback2; int LoadSendRecvMessageModule(void);
int SplitmsgShutdown(void);
-void LogErrorMessage(HWND hwndDlg, TWindowData *dat, int i, wchar_t *szMsg);
+void LogErrorMessage(HWND hwndDlg, CSrmmWindow *dat, int i, wchar_t *szMsg);
int Chat_Load(), Chat_Unload();
void FreeLogFonts();
@@ -276,7 +276,7 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP int TSAPI TBStateConvert2Flat(int state);
int TSAPI RBStateConvert2Flat(int state);
-void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat, RECT* rc);
+void TSAPI FillTabBackground(const HDC hdc, int iStateId, const CTabBaseDlg *dat, RECT* rc);
#define IS_EXTKEY(a) (a & (1 << 24))
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index f783d2c73c..ba2bbbfa32 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -139,11 +139,11 @@ static void TSAPI DrawCustomTabPage(HDC hdc, RECT& rcClient) ::DeleteObject(hPen);
}
-void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat, RECT* rc)
+void TSAPI FillTabBackground(const HDC hdc, int iStateId, const CTabBaseDlg *dat, RECT* rc)
{
unsigned clrIndex;
- if (dat && dat->mayFlashTab)
+ if (dat && dat->m_bCanFlashTab)
clrIndex = 7;
else
clrIndex = (iStateId == PBS_PRESSED ? 5 : (iStateId == PBS_HOT ? 6 : 4));
@@ -160,14 +160,14 @@ void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat // no image list is used and necessary, the message window dialog procedure has to provide a valid
// icon handle in dat->hTabIcon
-static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, int nItem, TWindowData *dat)
+static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, int nItem, CSrmmWindow *dat)
{
if (dat == NULL)
return;
InflateRect(rcItem, -2, -2);
- unsigned clrIndex = (dat->mayFlashTab) ? 3 : (nHint & HINT_ACTIVE_ITEM ? 1 : (nHint & HINT_HOTTRACK ? 2 : 0));
+ unsigned clrIndex = (dat->m_bCanFlashTab) ? 3 : (nHint & HINT_ACTIVE_ITEM ? 1 : (nHint & HINT_HOTTRACK ? 2 : 0));
COLORREF clr = PluginConfig.tabConfig.colors[clrIndex];
int oldMode = SetBkMode(dc, TRANSPARENT);
@@ -179,7 +179,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in HICON hIcon;
if (dat->dwFlags & MWF_ERRORSTATE)
hIcon = PluginConfig.g_iconErr;
- else if (dat->mayFlashTab)
+ else if (dat->m_bCanFlashTab)
hIcon = dat->iFlashIcon;
else {
if (dat->si && dat->iFlashIcon) {
@@ -194,7 +194,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in hIcon = dat->hTabIcon;
}
- if (dat->mayFlashTab == FALSE || (dat->mayFlashTab == TRUE && dat->bTabFlash != 0) || !(dat->pContainer->dwFlagsEx & TCF_FLASHICON)) {
+ if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !(dat->pContainer->dwFlagsEx & TCF_FLASHICON)) {
DWORD ix = rcItem->left + tabdat->m_xpad - 1;
DWORD iy = (rcItem->bottom + rcItem->top - iSize) / 2;
if (dat->dwFlagsEx & MWF_SHOW_ISIDLE && PluginConfig.m_bIdleDetect)
@@ -216,7 +216,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in CSkin::m_default_bf.SourceConstantAlpha = 255;
}
- if (dat->mayFlashTab == FALSE || (dat->mayFlashTab == TRUE && dat->bTabFlash != 0) || !(dat->pContainer->dwFlagsEx & TCF_FLASHLABEL)) {
+ if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !(dat->pContainer->dwFlagsEx & TCF_FLASHLABEL)) {
DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER;
HFONT oldFont = (HFONT)SelectObject(dc, (HFONT)SendMessage(tabdat->hwnd, WM_GETFONT, 0, 0));
if (tabdat->dwStyle & TCS_BUTTONS || !(tabdat->dwStyle & TCS_MULTILINE)) {
@@ -235,7 +235,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in static RECT rcTabPage = { 0 };
-static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, const TWindowData *dat)
+static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, const CSrmmWindow *dat)
{
POINT pt;
DWORD dwStyle = tabdat->dwStyle;
@@ -393,7 +393,7 @@ static int DWordAlign(int n) return n;
}
-static HRESULT DrawThemesPartWithAero(const TabControlData *tabdat, HDC hDC, int iPartId, int iStateId, LPRECT prcBox, TWindowData *dat)
+static HRESULT DrawThemesPartWithAero(const TabControlData *tabdat, HDC hDC, int iPartId, int iStateId, LPRECT prcBox, CSrmmWindow *dat)
{
HRESULT hResult = 0;
bool bAero = M.isAero();
@@ -440,7 +440,7 @@ static HRESULT DrawThemesPart(const TabControlData *tabdat, HDC hDC, int iPartId // draw a themed tab item. either a tab or the body pane
// handles image mirroring for tabs at the bottom
-static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlData *tabdat, TWindowData *dat)
+static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlData *tabdat, CSrmmWindow *dat)
{
BOOL bBody = (uiFlag & 1) ? TRUE : FALSE;
BOOL bSel = (uiFlag & 2) ? TRUE : FALSE;
@@ -623,7 +623,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) tabdat->helperDat = 0;
if (tabdat->fAeroTabs) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(tabdat->pContainer->hwndActive, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(tabdat->pContainer->hwndActive, GWLP_USERDATA);
if (dat)
tabdat->helperDat = dat;
else
@@ -818,7 +818,7 @@ page_done: RECT rcLog, rcPage;
GetClientRect(hwnd, &rcPage);
if (dwStyle & TCS_BOTTOM) {
- GetWindowRect(tabdat->helperDat->hwnd, &rcLog);
+ GetWindowRect(tabdat->helperDat->GetHwnd(), &rcLog);
pt.y = rcLog.bottom;
pt.x = rcLog.left;
ScreenToClient(hwnd, &pt);
@@ -826,7 +826,7 @@ page_done: FillRect(hdc, &rcPage, CSkin::m_BrushBack);
rcPage.top = 0;
}
- GetWindowRect(GetDlgItem(tabdat->helperDat->hwnd, tabdat->helperDat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcLog);
+ GetWindowRect(GetDlgItem(tabdat->helperDat->GetHwnd(), tabdat->helperDat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG), &rcLog);
pt.y = rcLog.top;
pt.x = rcLog.left;
@@ -846,9 +846,9 @@ page_done: continue;
TabCtrl_GetItem(hwnd, i, &tci);
- TWindowData *dat = 0;
+ CSrmmWindow *dat = 0;
if (tci.lParam)
- dat = (TWindowData*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
TabCtrl_GetItemRect(hwnd, i, &rcItem);
if (!bClassicDraw && uiBottom) {
rcItem.top -= PluginConfig.tabConfig.m_bottomAdjust;
@@ -876,13 +876,13 @@ page_done: rctActive.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
}
if (rctActive.left >= 0) {
- TWindowData *dat = 0;
+ CSrmmWindow *dat = 0;
int nHint = 0;
rcItem = rctActive;
TabCtrl_GetItem(hwnd, iActive, &tci);
if (tci.lParam)
- dat = (TWindowData*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
if (!bClassicDraw && !(dwStyle & TCS_BUTTONS)) {
InflateRect(&rcItem, 2, 2);
@@ -1110,11 +1110,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara int i = GetTabItemFromMouse(hwnd, &pt);
if (i != -1) {
TCITEM tc;
- TWindowData *dat = NULL;
+ CSrmmWindow *dat = NULL;
tc.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, i, &tc);
- dat = (TWindowData*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
if (dat) {
tabdat->bDragging = TRUE;
tabdat->iBeginIndex = i;
@@ -1142,7 +1142,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tc.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, i, &tc);
- TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
if (dat) {
tabdat->bDragging = TRUE;
tabdat->iBeginIndex = i;
@@ -1267,13 +1267,13 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara /*
* get the message window data for the session to which this tab item belongs
*/
- TWindowData *dat = 0;
+ CSrmmWindow *dat = 0;
if (IsWindow((HWND)item.lParam) && item.lParam != 0)
- dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
if (dat) {
tabdat->fTipActive = TRUE;
ti.isGroup = 0;
- ti.hItem = (HANDLE)dat->hContact;
+ ti.hItem = (HANDLE)dat->m_hContact;
ti.isTreeFocused = 0;
CallService("mToolTip/ShowTip", 0, (LPARAM)&ti);
}
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 2122ef9cc7..2a9d24f210 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -179,7 +179,7 @@ void CTaskbarInteract::SetTabActive(const HWND hwndTab, const HWND hwndGroup) co * static member function. Ignored when OS is not Windows 7 or global option for
* Windows 7 task bar support is diabled.
*/
-void CProxyWindow::add(TWindowData *dat)
+void CProxyWindow::add(CTabBaseDlg *dat)
{
if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) // && (!CSkin::m_skinEnabled || M.GetByte("forceAeroPeek", 0)))
dat->pWnd = new CProxyWindow(dat);
@@ -195,7 +195,7 @@ void CProxyWindow::add(TWindowData *dat) *
* static member function
*/
-void CProxyWindow::verify(TWindowData *dat)
+void CProxyWindow::verify(CTabBaseDlg *dat)
{
if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) {
if (0 == dat->pWnd) {
@@ -224,7 +224,7 @@ void CProxyWindow::verify(TWindowData *dat) * and previews for a message session.
* each tab has one invisible proxy window
*/
-CProxyWindow::CProxyWindow(TWindowData *dat)
+CProxyWindow::CProxyWindow(CTabBaseDlg *dat)
{
m_dat = dat;
m_hBigIcon = 0;
@@ -320,7 +320,7 @@ void CProxyWindow::sendPreview() if (m_dat->pContainer == NULL)
return;
- TWindowData *dat_active = reinterpret_cast<TWindowData *>(::GetWindowLongPtr(m_dat->pContainer->hwndActive, GWLP_USERDATA));
+ CSrmmWindow *dat_active = reinterpret_cast<CSrmmWindow *>(::GetWindowLongPtr(m_dat->pContainer->hwndActive, GWLP_USERDATA));
if (!m_thumb || !dat_active)
return;
@@ -330,7 +330,7 @@ void CProxyWindow::sendPreview() HDC hdc, dc;
int twips = (int)(15.0f / PluginConfig.m_DPIscaleY);
bool fIsChat = m_dat->bType != SESSIONTYPE_IM;
- HWND hwndRich = ::GetDlgItem(m_dat->hwnd, fIsChat ? IDC_CHAT_LOG : IDC_LOG);
+ HWND hwndRich = ::GetDlgItem(m_dat->GetHwnd(), fIsChat ? IDC_LOG : IDC_LOG);
LONG cx, cy;
POINT ptOrigin = { 0 }, ptBottom;
@@ -338,8 +338,8 @@ void CProxyWindow::sendPreview() RECT rcClient;
::SendMessage(m_dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
- ::MoveWindow(m_dat->hwnd, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), FALSE);
- ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
+ ::MoveWindow(m_dat->GetHwnd(), rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), FALSE);
+ ::SendMessage(m_dat->GetHwnd(), WM_SIZE, 0, 0);
DM_ScrollToBottom(m_dat, 0, 1);
}
/*
@@ -360,7 +360,7 @@ void CProxyWindow::sendPreview() pt = m_dat->pContainer->ptLogSaved;
}
- ::GetWindowRect(::GetDlgItem(m_dat->pContainer->hwndActive, dat_active->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcTemp);
+ ::GetWindowRect(::GetDlgItem(m_dat->pContainer->hwndActive, dat_active->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG), &rcTemp);
ptBottom.x = rcTemp.left;
ptBottom.y = rcTemp.bottom;
::ScreenToClient(m_dat->pContainer->hwnd, &ptBottom);
@@ -372,7 +372,7 @@ void CProxyWindow::sendPreview() rcRich.right = cx;
rcRich.bottom = ptBottom.y - pt.y;
- dc = ::GetDC(m_dat->hwnd);
+ dc = ::GetDC(m_dat->GetHwnd());
hdc = ::CreateCompatibleDC(dc);
HBITMAP hbm = CSkin::CreateAeroCompatibleBitmap(rcContainer, hdc);
HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdc, hbm));
@@ -434,7 +434,7 @@ void CProxyWindow::sendPreview() else pt.x = pt.y = 0;
CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap(m_hwndProxy, hbm, &pt, m_dat->pContainer->dwFlags & CNT_CREATE_MINIMIZED ? 0 : DWM_SIT_DISPLAYFRAME);
- ::ReleaseDC(m_dat->hwnd, dc);
+ ::ReleaseDC(m_dat->GetHwnd(), dc);
::DeleteObject(hbm);
}
@@ -553,10 +553,10 @@ LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA {
TContainerData* pC = m_dat->pContainer;
- if (m_dat->hwnd != pC->hwndActive)
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
+ if (m_dat->GetHwnd() != pC->hwndActive)
+ SendMessage(m_dat->GetHwnd(), WM_CLOSE, 1, 3);
else
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
+ SendMessage(m_dat->GetHwnd(), WM_CLOSE, 1, 2);
if (!IsIconic(pC->hwnd))
SetForegroundWindow(pC->hwnd);
}
@@ -568,8 +568,8 @@ LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA */
case WM_ACTIVATE:
if (WA_ACTIVE == wParam) {
- if (IsWindow(m_dat->hwnd))
- ::PostMessage(m_dat->hwnd, DM_ACTIVATEME, 0, 0);
+ if (IsWindow(m_dat->GetHwnd()))
+ ::PostMessage(m_dat->GetHwnd(), DM_ACTIVATEME, 0, 0);
return 0; // no default processing, avoid flickering.
}
break;
diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h index 8e43fbf0db..d8ca7ec962 100644 --- a/plugins/TabSRMM/src/taskbar.h +++ b/plugins/TabSRMM/src/taskbar.h @@ -50,7 +50,7 @@ public: virtual void update() = 0;
protected:
- const TWindowData *m_dat;
+ const CTabBaseDlg *m_dat;
const CProxyWindow *m_pWnd;
HBITMAP m_hbmThumb, m_hbmOld;
@@ -97,7 +97,7 @@ private: class CProxyWindow
{
public:
- CProxyWindow(TWindowData *dat);
+ CProxyWindow(CTabBaseDlg *dat);
~CProxyWindow();
void updateIcon(const HICON hIcon) const;
@@ -108,7 +108,7 @@ public: void Invalidate() const;
void verifyDwmState();
- __inline const TWindowData* getDat() const { return m_dat; }
+ __inline const CTabBaseDlg* getDat() const { return m_dat; }
__inline const LONG getWidth() const { return m_width; }
__inline const LONG getHeight() const { return m_height; }
__inline const HWND getHwnd() const { return m_hwndProxy; }
@@ -116,11 +116,11 @@ public: __inline const HICON getOverlayIcon() const { return m_hOverlayIcon; }
static LRESULT CALLBACK stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static void add(TWindowData *dat);
- static void verify(TWindowData *dat);
+ static void add(CTabBaseDlg *dat);
+ static void verify(CTabBaseDlg *dat);
private:
- TWindowData *m_dat;
+ CTabBaseDlg *m_dat;
HWND m_hwndProxy;
LONG m_width, m_height;
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index ea0458703b..d8345d0152 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -112,7 +112,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP { TemplateEditorInfo *teInfo = 0; TTemplateSet *tSet; - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); /* * since this dialog needs a MessageWindowData * but has no container, we can store * the extended info struct in pContainer *) @@ -128,7 +128,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg); { TemplateEditorNew *teNew = (TemplateEditorNew *)lParam; - dat = (TWindowData*)mir_calloc(sizeof(TWindowData)); + dat = (CSrmmWindow*)mir_calloc(sizeof(CSrmmWindow)); dat->pContainer = (TContainerData*)mir_alloc(sizeof(TContainerData)); memset(dat->pContainer, 0, sizeof(TContainerData)); teInfo = (TemplateEditorInfo *)dat->pContainer; @@ -147,19 +147,19 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_EXLIMITTEXT, 0, 0x80000000); - dat->hContact = db_find_first(); - dat->szProto = GetContactProto(dat->hContact); - while (dat->szProto == 0 && dat->hContact != 0) { - dat->hContact = db_find_next(dat->hContact); - dat->szProto = GetContactProto(dat->hContact); + dat->m_hContact = db_find_first(); + dat->szProto = GetContactProto(dat->m_hContact); + while (dat->szProto == 0 && dat->m_hContact != 0) { + dat->m_hContact = db_find_next(dat->m_hContact); + dat->szProto = GetContactProto(dat->m_hContact); } dat->dwFlags = dat->pContainer->theme.dwFlags; - dat->cache = CContactCache::getContactCache(dat->hContact); + dat->cache = CContactCache::getContactCache(dat->m_hContact); dat->cache->updateNick(); dat->cache->updateUIN(); dat->cache->updateStats(TSessionStats::INIT_TIMER); - GetMYUIN(dat); + dat->GetMYUIN(); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); ShowWindow(hwndDlg, SW_SHOW); @@ -359,7 +359,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL); dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE; mir_snwprintf(dat->szMyNickname, L"My Nickname"); - StreamInEvents(hwndDlg, 0, 1, 0, &dbei); + dat->StreamInEvents(0, 1, 0, &dbei); SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1); if (teInfo->changed) memcpy(tSet->szTemplates[teInfo->inEdit], szTemp, TEMPLATE_LENGTH * sizeof(wchar_t)); diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index e78fdf786d..c87c0df5b0 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -176,7 +176,7 @@ int TSAPI CheckThemeVersion(const wchar_t *szIniFilename) return 0;
}
-void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, TWindowData *dat)
+void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, CSrmmWindow *dat)
{
int i, n = 0;
DBVARIANT dbv;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index ed6853f736..444e1e562b 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1920,7 +1920,7 @@ void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON DeleteDC(dcMem);
}
-UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC MyWndProc)
+UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const CTabBaseDlg *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC MyWndProc)
{
NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam;
BOOL bReturn = FALSE;
@@ -1968,7 +1968,7 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID // process WM_NCPAINT for the rich edit control. Draws a visual style border and avoid
// classic static edge / client edge may also draw a colorized border around the control
-UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
+UINT CSkin::DrawRichEditFrame(HWND hwnd, const CTabBaseDlg *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
{
// do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam);
@@ -2192,93 +2192,90 @@ void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc) // @param hdc HDC: handle to the device context in which painting should occur.
// @param rcWindow RECT &: The window rectangle of the message dialog window
-void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindow)
+void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const
{
- if (dat) {
- if (dat->pContainer->dwFlags & CNT_HIDETOOLBAR)
- return;
-
- bool bAero = M.isAero();
- bool fTbColorsValid = PluginConfig.m_tbBackgroundHigh && PluginConfig.m_tbBackgroundLow;
- BYTE bAlphaOffset = 0;
- BOOL fMustDrawNonThemed = ((bAero || fTbColorsValid) && !M.GetByte(SRMSGMOD_T, "forceThemedToolbar", 0));
- RECT rc, rcToolbar;
- POINT pt;
-
- if (!(dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR)) {
- ::GetWindowRect(::GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_CHAT ? IDC_CHAT_LOG : IDC_LOG), &rc);
- pt.y = rc.bottom + 0;
- ::ScreenToClient(dat->hwnd, &pt);
- rcToolbar.top = pt.y;
- rcToolbar.left = 0;
- rcToolbar.right = rcWindow.right;
-
- if (dat->bType == SESSIONTYPE_IM) {
- if (dat->dwFlags & MWF_ERRORSTATE)
- rcToolbar.top += ERRORPANEL_HEIGHT;
- if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || dat->bNotOnList) {
- rcToolbar.top += 20;
- RECT rcAdd;
- rcAdd.left = 0; rcAdd.right = rcToolbar.right - rcToolbar.left;
- rcAdd.bottom = rcToolbar.top - 1;
- rcAdd.top = rcAdd.bottom - 20;
- ::DrawEdge(hdc, &rcAdd, BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT | BF_SOFT | BF_FLAT);
- }
- }
-
- ::GetWindowRect(::GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_CHAT ? IDC_CHAT_MESSAGE : IDC_MESSAGE), &rc);
- pt.y = rc.top - (dat->bIsAutosizingInput ? 1 : 2);
- ::ScreenToClient(dat->hwnd, &pt);
- rcToolbar.bottom = pt.y;
- }
- else {
- GetWindowRect(::GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_CHAT ? IDC_CHAT_MESSAGE : IDC_MESSAGE), &rc);
- pt.y = rc.bottom - 2;
- ScreenToClient(dat->hwnd, &pt);
- rcToolbar.top = pt.y + 1;
- rcToolbar.left = 0;
- rcToolbar.right = rcWindow.right;
- rcToolbar.bottom = rcWindow.bottom;
- }
- LONG cx = rcToolbar.right - rcToolbar.left;
- LONG cy = rcToolbar.bottom - rcToolbar.top;
-
- RECT rcCachedToolbar = { 0 };
- rcCachedToolbar.right = cx;
- rcCachedToolbar.bottom = cy;
+ if (pContainer->dwFlags & CNT_HIDETOOLBAR)
+ return;
- if (dat->pContainer->cachedToolbarDC == 0)
- dat->pContainer->cachedToolbarDC = ::CreateCompatibleDC(hdc);
+ bool bAero = M.isAero();
+ bool fTbColorsValid = PluginConfig.m_tbBackgroundHigh && PluginConfig.m_tbBackgroundLow;
+ BYTE bAlphaOffset = 0;
+ BOOL fMustDrawNonThemed = ((bAero || fTbColorsValid) && !M.GetByte(SRMSGMOD_T, "forceThemedToolbar", 0));
+ RECT rc, rcToolbar;
+ POINT pt;
- if (dat->pContainer->szOldToolbarSize.cx != cx || dat->pContainer->szOldToolbarSize.cy != cy) {
- if (dat->pContainer->oldhbmToolbarBG) {
- ::SelectObject(dat->pContainer->cachedToolbarDC, dat->pContainer->oldhbmToolbarBG);
- ::DeleteObject(dat->pContainer->hbmToolbarBG);
+ if (!(pContainer->dwFlags & CNT_BOTTOMTOOLBAR)) {
+ ::GetWindowRect(::GetDlgItem(m_hwnd, bType == SESSIONTYPE_CHAT ? IDC_LOG : IDC_LOG), &rc);
+ pt.y = rc.bottom + 0;
+ ::ScreenToClient(m_hwnd, &pt);
+ rcToolbar.top = pt.y;
+ rcToolbar.left = 0;
+ rcToolbar.right = rcWindow.right;
+
+ if (bType == SESSIONTYPE_IM) {
+ if (dwFlags & MWF_ERRORSTATE)
+ rcToolbar.top += ERRORPANEL_HEIGHT;
+ if (dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || bNotOnList) {
+ rcToolbar.top += 20;
+ RECT rcAdd;
+ rcAdd.left = 0; rcAdd.right = rcToolbar.right - rcToolbar.left;
+ rcAdd.bottom = rcToolbar.top - 1;
+ rcAdd.top = rcAdd.bottom - 20;
+ ::DrawEdge(hdc, &rcAdd, BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT | BF_SOFT | BF_FLAT);
}
- dat->pContainer->hbmToolbarBG = CSkin::CreateAeroCompatibleBitmap(rcCachedToolbar, hdc);// ::CreateCompatibleBitmap(hdc, cx, cy);
- dat->pContainer->oldhbmToolbarBG = reinterpret_cast<HBITMAP>(::SelectObject(dat->pContainer->cachedToolbarDC, dat->pContainer->hbmToolbarBG));
}
- dat->pContainer->szOldToolbarSize.cx = cx;
- dat->pContainer->szOldToolbarSize.cy = cy;
- if (!fMustDrawNonThemed && M.isVSThemed()) {
- DrawThemeBackground(dat->hThemeToolbar, dat->pContainer->cachedToolbarDC, 6, 1, &rcCachedToolbar, &rcCachedToolbar);
- dat->pContainer->bTBRenderingMode = 1; // tell TSButton how to render the tool bar buttons
- }
- else {
- dat->pContainer->bTBRenderingMode = (M.isVSThemed() ? 1 : 0);
- m_tmp_tb_high = PluginConfig.m_tbBackgroundHigh ? PluginConfig.m_tbBackgroundHigh :
- ((bAero && m_pCurrentAeroEffect) ? m_pCurrentAeroEffect->m_clrToolbar : ::GetSysColor(COLOR_3DFACE));
- m_tmp_tb_low = PluginConfig.m_tbBackgroundLow ? PluginConfig.m_tbBackgroundLow :
- ((bAero && m_pCurrentAeroEffect) ? m_pCurrentAeroEffect->m_clrToolbar2 : ::GetSysColor(COLOR_3DFACE));
-
- bAlphaOffset = PluginConfig.m_tbBackgroundHigh ? 40 : 0;
- ::DrawAlpha(dat->pContainer->cachedToolbarDC, &rcCachedToolbar, m_tmp_tb_high, 55 + bAlphaOffset, m_tmp_tb_low, 0, 9, 0, 0, 0);
+ ::GetWindowRect(::GetDlgItem(m_hwnd, bType == SESSIONTYPE_CHAT ? IDC_MESSAGE : IDC_MESSAGE), &rc);
+ pt.y = rc.top - (bIsAutosizingInput ? 1 : 2);
+ ::ScreenToClient(m_hwnd, &pt);
+ rcToolbar.bottom = pt.y;
+ }
+ else {
+ GetWindowRect(::GetDlgItem(m_hwnd, bType == SESSIONTYPE_CHAT ? IDC_MESSAGE : IDC_MESSAGE), &rc);
+ pt.y = rc.bottom - 2;
+ ScreenToClient(m_hwnd, &pt);
+ rcToolbar.top = pt.y + 1;
+ rcToolbar.left = 0;
+ rcToolbar.right = rcWindow.right;
+ rcToolbar.bottom = rcWindow.bottom;
+ }
+ LONG cx = rcToolbar.right - rcToolbar.left;
+ LONG cy = rcToolbar.bottom - rcToolbar.top;
+
+ RECT rcCachedToolbar = { 0 };
+ rcCachedToolbar.right = cx;
+ rcCachedToolbar.bottom = cy;
+
+ if (pContainer->cachedToolbarDC == 0)
+ pContainer->cachedToolbarDC = ::CreateCompatibleDC(hdc);
+
+ if (pContainer->szOldToolbarSize.cx != cx || pContainer->szOldToolbarSize.cy != cy) {
+ if (pContainer->oldhbmToolbarBG) {
+ ::SelectObject(pContainer->cachedToolbarDC, pContainer->oldhbmToolbarBG);
+ ::DeleteObject(pContainer->hbmToolbarBG);
}
+ pContainer->hbmToolbarBG = CSkin::CreateAeroCompatibleBitmap(rcCachedToolbar, hdc);// ::CreateCompatibleBitmap(hdc, cx, cy);
+ pContainer->oldhbmToolbarBG = reinterpret_cast<HBITMAP>(::SelectObject(pContainer->cachedToolbarDC, pContainer->hbmToolbarBG));
+ }
+ pContainer->szOldToolbarSize.cx = cx;
+ pContainer->szOldToolbarSize.cy = cy;
- ::BitBlt(hdc, rcToolbar.left, rcToolbar.top, cx, cy,
- dat->pContainer->cachedToolbarDC, 0, 0, SRCCOPY);
+ if (!fMustDrawNonThemed && M.isVSThemed()) {
+ DrawThemeBackground(hThemeToolbar, pContainer->cachedToolbarDC, 6, 1, &rcCachedToolbar, &rcCachedToolbar);
+ pContainer->bTBRenderingMode = 1; // tell TSButton how to render the tool bar buttons
}
+ else {
+ pContainer->bTBRenderingMode = (M.isVSThemed() ? 1 : 0);
+ CSkin::m_tmp_tb_high = PluginConfig.m_tbBackgroundHigh ? PluginConfig.m_tbBackgroundHigh :
+ ((bAero && CSkin::m_pCurrentAeroEffect) ? CSkin::m_pCurrentAeroEffect->m_clrToolbar : ::GetSysColor(COLOR_3DFACE));
+ CSkin::m_tmp_tb_low = PluginConfig.m_tbBackgroundLow ? PluginConfig.m_tbBackgroundLow :
+ ((bAero && CSkin::m_pCurrentAeroEffect) ? CSkin::m_pCurrentAeroEffect->m_clrToolbar2 : ::GetSysColor(COLOR_3DFACE));
+
+ bAlphaOffset = PluginConfig.m_tbBackgroundHigh ? 40 : 0;
+ ::DrawAlpha(pContainer->cachedToolbarDC, &rcCachedToolbar, CSkin::m_tmp_tb_high, 55 + bAlphaOffset, CSkin::m_tmp_tb_low, 0, 9, 0, 0, 0);
+ }
+
+ ::BitBlt(hdc, rcToolbar.left, rcToolbar.top, cx, cy, pContainer->cachedToolbarDC, 0, 0, SRCCOPY);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -2454,31 +2451,28 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const /////////////////////////////////////////////////////////////////////////////////////////
// redraw the splitter area between the message input and message log area only
-void CSkin::UpdateToolbarBG(TWindowData *dat)
+void CTabBaseDlg::UpdateToolbarBG()
{
- if (dat == NULL)
- return;
-
RECT rcUpdate, rcTmp;
- ::GetWindowRect(::GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcTmp);
+ ::GetWindowRect(::GetDlgItem(m_hwnd, bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG), &rcTmp);
POINT pt;
pt.x = rcTmp.left;
pt.y = rcTmp.top;
- ::ScreenToClient(dat->hwnd, &pt);
+ ::ScreenToClient(m_hwnd, &pt);
rcUpdate.left = 0;
rcUpdate.top = pt.y;
- ::GetClientRect(dat->hwnd, &rcTmp);
+ ::GetClientRect(m_hwnd, &rcTmp);
rcUpdate.right = rcTmp.right;
rcUpdate.bottom = rcTmp.bottom;
if (M.isAero() || M.isDwmActive())
- dat->fLimitedUpdate = true; // skip unrelevant window updates when we have buffered paint avail
- ::RedrawWindow(dat->hwnd, &rcUpdate, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
- ::BB_RedrawButtons(dat);
- dat->fLimitedUpdate = false;
+ fLimitedUpdate = true; // skip unrelevant window updates when we have buffered paint avail
+ ::RedrawWindow(m_hwnd, &rcUpdate, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
+ BB_RedrawButtons();
+ fLimitedUpdate = false;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h index b999139d8a..4472524fe9 100644 --- a/plugins/TabSRMM/src/themes.h +++ b/plugins/TabSRMM/src/themes.h @@ -371,12 +371,11 @@ public: static void TSAPI SkinDrawBG(HWND hwndClient, HWND hwnd, TContainerData *pContainer, RECT *rcClient, HDC hdcTarget);
static void TSAPI DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON hIcon, BYTE alpha);
static DWORD __fastcall HexStringToLong(const wchar_t *szSource);
- static UINT TSAPI DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc);
- static UINT TSAPI NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc);
+ static UINT TSAPI DrawRichEditFrame(HWND hwnd, const CTabBaseDlg *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc);
+ static UINT TSAPI NcCalcRichEditFrame(HWND hwnd, const CTabBaseDlg *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc);
static HBITMAP TSAPI CreateAeroCompatibleBitmap(const RECT &rc, HDC dc);
static int TSAPI RenderText(HDC hdc, HANDLE hTheme, const wchar_t *szText, RECT *rc, DWORD dtFlags, const int iGlowSize = DEFAULT_GLOW_SIZE, COLORREF clr = 0, bool fForceAero = false);
static void TSAPI MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc);
- static void TSAPI RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindow);
static HBITMAP TSAPI ResizeBitmap(HBITMAP hBmpSrc, LONG width, LONG height, bool &mustFree);
static void TSAPI ApplyAeroEffect(const HDC hdc, const RECT* rc, int iEffectArea);
static void TSAPI setAeroEffect(const LRESULT effect);
@@ -384,7 +383,6 @@ public: static HANDLE TSAPI InitiateBufferedPaint(const HDC hdcSrc, RECT& rc, HDC& hdcOut);
static void TSAPI FinalizeBufferedPaint(HANDLE hbp, RECT *rc);
static bool __fastcall DrawItem(const HDC hdc, const RECT *rc, const CSkinItem *item);
- static void TSAPI UpdateToolbarBG(TWindowData *dat);
static void TSAPI FillBack(const HDC hdc, RECT* rc);
static bool TSAPI IsThemed(void);
@@ -466,14 +464,14 @@ struct TabControlData int iHoveredTabIndex;
int iHoveredCloseIcon;
HWND hwndDrag;
- TWindowData *dragDat;
+ CSrmmWindow *dragDat;
HIMAGELIST himlDrag;
BOOL bRefreshWithoutClip;
BOOL fSavePos;
BOOL fTipActive;
BOOL fAeroTabs;
BOOL fCloseButton;
- TWindowData* helperDat; // points to the client data of the active tab
+ CSrmmWindow* helperDat; // points to the client data of the active tab
CImageItem* helperItem, *helperGlowItem; // aero ui, holding the skin image for the tabs
};
@@ -494,17 +492,17 @@ struct ButtonItem { LONG_PTR pressedGlyphMetrics[4];
DWORD dwFlags, dwStockFlags;
DWORD uId;
- wchar_t szTip[256];
+ wchar_t szTip[256];
char szService[256];
char szModule[256], szSetting[256];
BYTE bValuePush[256], bValueRelease[256];
DWORD type;
- void(*pfnAction)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
- void(*pfnCallback)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
+ void(*pfnAction)(ButtonItem *item, HWND hwndDlg, CTabBaseDlg *dat, HWND hwndItem);
+ void(*pfnCallback)(ButtonItem *item, HWND hwndDlg, CTabBaseDlg *dat, HWND hwndItem);
wchar_t tszLabel[40];
ButtonItem* nextItem;
HANDLE hContact;
- TWindowData *dat;
+ CSrmmWindow *dat;
};
typedef struct _tagButtonSet {
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 768d9f34d5..38a90c916c 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -132,16 +132,16 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_USER + 100:
- TWindowData *dat = 0;
+ CSrmmWindow *dat = 0;
DWORD *pdwActionToTake = (DWORD *)lParam;
unsigned int iOldIEView = 0;
HWND hWnd = M.FindWindow(hContact);
BYTE bOldInfoPanel = M.GetByte(hContact, "infopanel", 0);
if (hWnd) {
- dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (dat)
- iOldIEView = GetIEViewMode(dat->hContact);
+ iOldIEView = GetIEViewMode(dat->m_hContact);
}
int iIndex = SendDlgItemMessage(hwndDlg, IDC_IEVIEWMODE, CB_GETCURSEL, 0, 0);
int iMode = SendDlgItemMessage(hwndDlg, IDC_IEVIEWMODE, CB_GETITEMDATA, iIndex, 0);
@@ -166,7 +166,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
if (hWnd && dat) {
- unsigned int iNewIEView = GetIEViewMode(dat->hContact);
+ unsigned int iNewIEView = GetIEViewMode(dat->m_hContact);
if (iNewIEView != iOldIEView) {
if (pdwActionToTake)
*pdwActionToTake |= UPREF_ACTION_SWITCHLOGVIEWER;
@@ -211,11 +211,13 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_LOADONLYACTUAL)) {
db_set_b(hContact, SRMSGMOD_T, "ActualHistory", 1);
- if (hWnd && dat) dat->bActualHistory = TRUE;
+ if (hWnd && dat)
+ dat->bActualHistory = TRUE;
}
else {
db_set_b(hContact, SRMSGMOD_T, "ActualHistory", 0);
- if (hWnd && dat) dat->bActualHistory = FALSE;
+ if (hWnd && dat)
+ dat->bActualHistory = FALSE;
}
if (IsDlgButtonChecked(hwndDlg, IDC_IGNORETIMEOUTS)) {
@@ -230,7 +232,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, }
if (hWnd && dat) {
SendMessage(hWnd, DM_CONFIGURETOOLBAR, 0, 1);
- ShowPicture(dat, FALSE);
+ dat->ShowPicture(false);
SendMessage(hWnd, WM_SIZE, 0, 0);
DM_ScrollToBottom(dat, 0, 1);
}
@@ -242,6 +244,14 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// loads message log and other "per contact" flags
+// it uses the global flag value (0, mwflags) and then merges per contact settings
+// based on the mask value.
+//
+// ALWAYS mask dat->dwFlags with MWF_LOG_ALL to only affect real flag bits and
+// ignore temporary bits.
+
static struct _checkboxes
{
UINT uId;
@@ -264,36 +274,25 @@ checkboxes[] = { 0, 0
};
-/////////////////////////////////////////////////////////////////////////////////////////
-// loads message log and other "per contact" flags
-// it uses the global flag value (0, mwflags) and then merges per contact settings
-// based on the mask value.
-//
-// ALWAYS mask dat->dwFlags with MWF_LOG_ALL to only affect real flag bits and
-// ignore temporary bits.
-
-int TSAPI LoadLocalFlags(TWindowData *dat)
+int CTabBaseDlg::LoadLocalFlags()
{
- if (dat == NULL)
- return NULL;
-
- int i = 0;
- DWORD dwMask = M.GetDword(dat->hContact, "mwmask", 0);
- DWORD dwLocal = M.GetDword(dat->hContact, "mwflags", 0);
+ DWORD dwMask = M.GetDword(m_hContact, "mwmask", 0);
+ DWORD dwLocal = M.GetDword(m_hContact, "mwflags", 0);
DWORD dwGlobal = M.GetDword("mwflags", MWF_LOG_DEFAULT);
- dat->dwFlags &= ~MWF_LOG_ALL;
- if (dat->pContainer->theme.isPrivate)
- dat->dwFlags |= (dat->pContainer->theme.dwFlags & MWF_LOG_ALL);
+ dwFlags &= ~MWF_LOG_ALL;
+ if (pContainer->theme.isPrivate)
+ dwFlags |= (pContainer->theme.dwFlags & MWF_LOG_ALL);
else
- dat->dwFlags |= (dwGlobal & MWF_LOG_ALL);
- while (checkboxes[i].uId) {
+ dwFlags |= (dwGlobal & MWF_LOG_ALL);
+
+ for (int i = 0; checkboxes[i].uId; i++) {
DWORD maskval = checkboxes[i].uFlag;
if (dwMask & maskval)
- dat->dwFlags = (dwLocal & maskval) ? dat->dwFlags | maskval : dat->dwFlags & ~maskval;
- i++;
+ dwFlags = (dwLocal & maskval) ? dwFlags | maskval : dwFlags & ~maskval;
}
- return(dat->dwFlags & MWF_LOG_ALL);
+
+ return dwFlags & MWF_LOG_ALL;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -344,9 +343,9 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA HWND hwnd = M.FindWindow(hContact);
DWORD *dwActionToTake = (DWORD *)lParam, dwMask = 0, dwFlags = 0, maskval;
- TWindowData *dat = NULL;
+ CSrmmWindow *dat = NULL;
if (hwnd)
- dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
while (checkboxes[i].uId) {
maskval = checkboxes[i].uFlag;
@@ -477,11 +476,11 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage((HWND)tci.lParam, WM_COMMAND, WM_USER + 100, (LPARAM)&dwActionToTake);
}
if (hwnd) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat) {
DWORD dwOldFlags = (dat->dwFlags & MWF_LOG_ALL);
SetDialogToType(hwnd);
- LoadLocalFlags(dat);
+ dat->LoadLocalFlags();
if ((dat->dwFlags & MWF_LOG_ALL) != dwOldFlags) {
bool fShouldHide = true;
if (IsIconic(dat->pContainer->hwnd))
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 93fc88fd89..613b92207e 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -67,7 +67,7 @@ static wchar_t *formatting_strings_end[] = { L"b0 ", L"i0 ", L"u0 ", L"s0 ", // flags: loword = words only for simple * /_ formatting
// hiword = bbcode support (strip bbcodes if 0)
-const wchar_t* Utils::FormatRaw(TWindowData *dat, const wchar_t *msg, int flags, BOOL isSent)
+const wchar_t* Utils::FormatRaw(CTabBaseDlg *dat, const wchar_t *msg, int flags, BOOL isSent)
{
bool clr_was_added = false, was_added;
static tstring message(msg);
@@ -213,7 +213,7 @@ ok: smbp.Protocolname = dat->cache->getActiveProto();
smbp.flag = SAFL_TCHAR | SAFL_PATH | (isSent ? SAFL_OUTGOING : 0);
smbp.str = (wchar_t*)smcode.c_str();
- smbp.hContact = dat->hContact;
+ smbp.hContact = dat->m_hContact;
SMADD_BATCHPARSERES *smbpr = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&smbp);
if (smbpr) {
CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smbpr);
@@ -241,7 +241,7 @@ static wchar_t* Trunc500(wchar_t *str) return str;
}
-bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMStringW &dest)
+bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMStringW &dest)
{
if (dat == 0)
return false;
@@ -286,7 +286,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt {
BYTE xStatus = dat->cache->getXStatusId();
if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- ptrW szXStatus(db_get_wsa(dat->hContact, dat->szProto, "XStatusName"));
+ ptrW szXStatus(db_get_wsa(dat->m_hContact, dat->szProto, "XStatusName"));
dest.Append((szXStatus != NULL) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]);
}
}
@@ -296,7 +296,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt {
BYTE xStatus = dat->cache->getXStatusId();
if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- ptrW szXStatus(db_get_wsa(dat->hContact, dat->szProto, "XStatusName"));
+ ptrW szXStatus(db_get_wsa(dat->m_hContact, dat->szProto, "XStatusName"));
dest.Append((szXStatus != NULL) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]);
}
else dest.Append(dat->szStatus[0] ? dat->szStatus : L"(undef)");
@@ -317,7 +317,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt case 'g':
{
- ptrW tszGroup(db_get_wsa(dat->hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_wsa(dat->m_hContact, "CList", "Group"));
if (tszGroup != NULL)
dest.Append(tszGroup);
}
@@ -411,7 +411,7 @@ wchar_t* Utils::GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen) // returns != 0 when one of the installed keyboard layouts belongs to an rtl language
// used to find out whether we need to configure the message input box for bidirectional mode
-int Utils::FindRTLLocale(TWindowData *dat)
+int Utils::FindRTLLocale(CTabBaseDlg *dat)
{
HKL layouts[20];
int i, result = 0;
@@ -621,12 +621,12 @@ void Utils::scaleAvatarHeightLimited(const HBITMAP hBm, double& dNewWidth, doubl // @param dat: _MessageWindowData* pointer to the window data
// @return HICON: the icon handle
-HICON Utils::iconFromAvatar(const TWindowData *dat)
+HICON Utils::iconFromAvatar(const CTabBaseDlg *dat)
{
if (!ServiceExists(MS_AV_GETAVATARBITMAP) || dat == NULL)
return 0;
- AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, dat->hContact, 0);
+ AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, dat->m_hContact, 0);
if (ace == NULL || ace->hbmPic == NULL)
return NULL;
@@ -724,7 +724,7 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO &mii, HICON hIcon, const wc // return != 0 when the sound effect must be played for the given
// session. Uses container sound settings
-int Utils::mustPlaySound(const TWindowData *dat)
+int Utils::mustPlaySound(const CTabBaseDlg *dat)
{
if (!dat)
return 0;
@@ -736,7 +736,7 @@ int Utils::mustPlaySound(const TWindowData *dat) return 0;
bool fActiveWindow = (dat->pContainer->hwnd == ::GetForegroundWindow() ? true : false);
- bool fActiveTab = (dat->pContainer->hwndActive == dat->hwnd ? true : false);
+ bool fActiveTab = (dat->pContainer->hwndActive == dat->GetHwnd() ? true : false);
bool fIconic = (::IsIconic(dat->pContainer->hwnd) ? true : false);
// window minimized, check if sound has to be played
@@ -844,22 +844,22 @@ wchar_t* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich) // generic command dispatcher
// used in various places (context menus, info panel menus etc.)
-LRESULT Utils::CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam, LPARAM lParam, TWindowData *dat, TContainerData *pContainer)
+LRESULT Utils::CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam, LPARAM lParam, CTabBaseDlg *dat, TContainerData *pContainer)
{
switch (uType) {
case CMD_CONTAINER:
if (pContainer && hwndDlg)
- return(DM_ContainerCmdHandler(pContainer, cmd, wParam, lParam));
+ return DM_ContainerCmdHandler(pContainer, cmd, wParam, lParam);
break;
case CMD_MSGDIALOG:
if (pContainer && hwndDlg && dat)
- return(DM_MsgWindowCmdHandler(hwndDlg, pContainer, dat, cmd, wParam, lParam));
+ return DM_MsgWindowCmdHandler(hwndDlg, pContainer, dat, cmd, wParam, lParam);
break;
case CMD_INFOPANEL:
- if (MsgWindowMenuHandler(dat, cmd, MENU_LOGMENU) == 0)
- return(DM_MsgWindowCmdHandler(hwndDlg, pContainer, dat, cmd, wParam, lParam));
+ if (dat->MsgWindowMenuHandler(cmd, MENU_LOGMENU) == 0)
+ return DM_MsgWindowCmdHandler(hwndDlg, pContainer, dat, cmd, wParam, lParam);
break;
}
return 0;
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 7d86004366..fbc9ba9930 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -52,11 +52,11 @@ public: CMD_INFOPANEL = 4,
};
- static int FindRTLLocale(TWindowData *dat);
+ static int FindRTLLocale(CTabBaseDlg *dat);
static wchar_t* GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen);
static wchar_t* FilterEventMarkers(wchar_t *wszText);
- static LPCTSTR FormatRaw(TWindowData *dat, const wchar_t *msg, int flags, BOOL isSent);
- static bool FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMStringW &dest);
+ static LPCTSTR FormatRaw(CTabBaseDlg *dat, const wchar_t *msg, int flags, BOOL isSent);
+ static bool FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMStringW &dest);
static char* FilterEventMarkers(char *szText);
static void DoubleAmpersands(wchar_t *pszText, size_t len);
static void RTF_CTableInit();
@@ -69,13 +69,13 @@ public: static void SaveContainerSettings(TContainerData *pContainer, const char *szSetting);
static DWORD CALLBACK StreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb);
- static LRESULT CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam, LPARAM lParam, TWindowData *dat = 0, TContainerData *pContainer = 0);
+ static LRESULT CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam, LPARAM lParam, CTabBaseDlg *dat = 0, TContainerData *pContainer = 0);
static void addMenuItem(const HMENU& m, MENUITEMINFO& mii, HICON hIcon, const wchar_t *szText, UINT uID, UINT pos);
static void enableDlgControl(const HWND hwnd, UINT id, bool fEnable = true);
static void showDlgControl(const HWND hwnd, UINT id, int showCmd);
- static int mustPlaySound(const TWindowData *dat);
- static HICON iconFromAvatar(const TWindowData *dat);
+ static int mustPlaySound(const CTabBaseDlg *dat);
+ static HICON iconFromAvatar(const CTabBaseDlg *dat);
static void setAvatarContact(HWND hWnd, MCONTACT hContact);
static void getIconSize(HICON hIcon, int& sizeX, int& sizeY);
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index e8b2f7baf8..d68b27d599 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3
-#define __MINOR_VERSION 4
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 2
+#define __MINOR_VERSION 5
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>
|