diff options
Diffstat (limited to 'plugins')
22 files changed, 714 insertions, 858 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index e38ee9c643..2103f812bf 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -88,7 +88,7 @@ struct TMUCSettings : public GlobalLogSettingsBase bool bLogClassicIndicators, bAlternativeSorting, bAnnoyingHighlight, bCreateWindowOnHighlight;
bool bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog;
- bool bScaleIcons, bUseDividers, bDividersUsePopupConfig, bUseCommaAsColon, bNewLineAfterNames;
+ bool bScaleIcons, bUseCommaAsColon, bNewLineAfterNames;
CMUCHighlight* Highlight;
};
diff --git a/plugins/TabSRMM/src/chat/chat_resource.h b/plugins/TabSRMM/src/chat/chat_resource.h index 79207f3db8..7dcdb22d61 100644 --- a/plugins/TabSRMM/src/chat/chat_resource.h +++ b/plugins/TabSRMM/src/chat/chat_resource.h @@ -22,7 +22,6 @@ #define IDC_NICKROW 1024
#define IDC_LOGLIMIT 1024
#define IDC_CHAT_CLOSE 1025
-#define IDC_CHAT_SPIN1 1028
#define IDC_CHAT_SPIN2 1029
#define IDC_CHAT_SPIN3 1030
#define IDC_CHAT_SPIN4 1031
@@ -37,7 +36,6 @@ #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
#define IDC_TEXT 1064
@@ -69,11 +67,10 @@ #define IDC_HIGHLIGHTME 1094
#define IDC_ADDHIGHLIGHTEDITLIST 1095
#define IDC_MUC_OPENLOGBASEDIR 1096
-#define IDC_CHAT_BOLD 1106
+#define IDC_BOLD 1106
#define IDC_ITALICS 1107
-#define IDC_CHAT_UNDERLINE 1108
+#define IDC_UNDERLINE 1108
#define IDC_COLOR 1110
-#define IDC_CHAT_HISTORY 1111
#define IDC_1 1200
#define IDC_2 1201
#define IDC_3 1202
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index f34f5d18ad..ae1d259b6d 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -55,8 +55,8 @@ static void OnReplaceSession(SESSION_INFO *si) static void OnSetTopic(SESSION_INFO *si)
{
- if (si->hWnd)
- SendMessage(si->hWnd, DM_INVALIDATEPANEL, 0, 0);
+ if (si->hWnd && si->dat->m_pPanel)
+ si->dat->m_pPanel->Invalidate(true);
}
static void OnNewUser(SESSION_INFO *si, USERINFO*)
@@ -102,8 +102,6 @@ static void OnLoadSettings() g_Settings.bColorizeNicks = M.GetBool(CHAT_MODULE, "ColorizeNicks", true);
g_Settings.bColorizeNicksInLog = M.GetBool(CHAT_MODULE, "ColorizeNicksInLog", true);
g_Settings.bScaleIcons = M.GetBool(CHAT_MODULE, "ScaleIcons", true);
- g_Settings.bUseDividers = M.GetBool(CHAT_MODULE, "UseDividers", true);
- g_Settings.bDividersUsePopupConfig = M.GetBool(CHAT_MODULE, "DividersUsePopupConfig", true);
g_Settings.bDoubleClick4Privat = M.GetBool(CHAT_MODULE, "DoubleClick4Privat", false);
g_Settings.bShowContactStatus = M.GetBool(CHAT_MODULE, "ShowContactStatus", true);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index c87555b17f..f3df0d3054 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -66,8 +66,8 @@ static ColorOptionsList _clrs[] = { { 3, LPGENW("Message Sessions") L"/" LPGENW("Single Messaging"), LPGENW("Incoming background(old)"), "oldinbg", SRMSGDEFSET_BKGINCOLOUR },
{ 4, LPGENW("Message Sessions") L"/" LPGENW("Single Messaging"), LPGENW("Outgoing background(old)"), "oldoutbg", SRMSGDEFSET_BKGOUTCOLOUR },
{ 5, LPGENW("Message Sessions") L"/" LPGENW("Single Messaging"), LPGENW("Horizontal Grid Lines"), "hgrid", RGB(224, 224, 224) },
- { 0, LPGENW("Message Sessions") L"/" LPGENW("Info m_Panel"), LPGENW("m_Panel background low"), "ipfieldsbg", 0x62caff },
- { 1, LPGENW("Message Sessions") L"/" LPGENW("Info m_Panel"), LPGENW("m_Panel background high"), "ipfieldsbgHigh", 0xf0f0f0 },
+ { 0, LPGENW("Message Sessions") L"/" LPGENW("Info m_pPanel"), LPGENW("m_pPanel background low"), "ipfieldsbg", 0x62caff },
+ { 1, LPGENW("Message Sessions") L"/" LPGENW("Info m_pPanel"), LPGENW("m_pPanel background high"), "ipfieldsbgHigh", 0xf0f0f0 },
{ 0, LPGENW("Message Sessions") L"/" LPGENW("Common colors"), LPGENW("Toolbar background high"), "tbBgHigh", 0 },
{ 1, LPGENW("Message Sessions") L"/" LPGENW("Common colors"), LPGENW("Toolbar background low"), "tbBgLow", 0 },
{ 2, LPGENW("Message Sessions") L"/" LPGENW("Common colors"), LPGENW("Window fill color"), "fillColor", 0 },
@@ -169,9 +169,7 @@ static branch_t branch2[] = { { LPGENW("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL },
{ LPGENW("Add new line after names"), "NewlineAfterNames", 0, 0, NULL },
{ LPGENW("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL },
- { LPGENW("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL },
- { LPGENW("Place a separator in the log after a window lost its foreground status"), "UseDividers", 0, 1, NULL },
- { LPGENW("Only place a separator when an incoming event is announced with a popup"), "DividersUsePopupConfig", 0, 1, NULL }
+ { LPGENW("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL }
};
static HWND hPathTip = 0;
@@ -557,8 +555,8 @@ void RegisterFontServiceFonts() fontOptionsList = IP_fontOptionsList;
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
- wcsncpy(fid.group, LPGENW("Message Sessions") L"/" LPGENW("Info m_Panel"), _countof(fid.group));
- wcsncpy(fid.backgroundGroup, LPGENW("Message Sessions") L"/" LPGENW("Info m_Panel"), _countof(fid.backgroundGroup));
+ wcsncpy(fid.group, LPGENW("Message Sessions") L"/" LPGENW("Info m_pPanel"), _countof(fid.group));
+ wcsncpy(fid.backgroundGroup, LPGENW("Message Sessions") L"/" LPGENW("Info m_pPanel"), _countof(fid.backgroundGroup));
wcsncpy(fid.backgroundName, LPGENW("Fields background"), _countof(fid.backgroundName));
for (int i = 0; i < IPFONTCOUNT; i++) {
LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 89b5c71d12..662acaa6e4 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -179,7 +179,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0); } - m_Panel->dismissConfig(); + m_pPanel->dismissConfig(); m_dwUnread = 0; if (m_pWnd) { m_pWnd->activateTab(); @@ -249,23 +249,6 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) } ///////////////////////////////////////////////////////////////////////////////////////// -// initialize button bar, set all the icons and ensure proper button state - -static void InitButtons(HWND hwndDlg, SESSION_INFO *si) -{ - MODULEINFO *pInfo = si ? pci->MM_FindModule(si->pszModule) : NULL; - if (pInfo) { - Utils::enableDlgControl(hwndDlg, IDC_CHAT_BOLD, pInfo->bBold); - Utils::enableDlgControl(hwndDlg, IDC_ITALICS, pInfo->bItalics); - Utils::enableDlgControl(hwndDlg, IDC_CHAT_UNDERLINE, pInfo->bUnderline); - Utils::enableDlgControl(hwndDlg, IDC_COLOR, pInfo->bColor); - Utils::enableDlgControl(hwndDlg, IDC_BKGCOLOR, pInfo->bBkgColor); - if (si->iType == GCW_CHATROOM) - Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, pInfo->bChanMgr); - } -} - -///////////////////////////////////////////////////////////////////////////////////////// // resizer callback for the group chat session window.Called from Mirandas dialog // resizing service @@ -274,8 +257,8 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) bool bToolbar = !(m_pContainer->dwFlags & CNT_HIDETOOLBAR); bool bBottomToolbar = m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0; bool bNick = si->iType != GCW_SERVER && si->bNicklistEnabled; - bool bInfoPanel = m_Panel->isActive(); - int panelHeight = m_Panel->getHeight() + 1; + bool bInfoPanel = m_pPanel->isActive(); + int panelHeight = m_pPanel->getHeight() + 1; RECT rcTabs; GetClientRect(m_hwnd, &rcTabs); @@ -288,7 +271,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); Utils::enableDlgControl(m_hwnd, IDC_SHOWNICKLIST, true); - Utils::enableDlgControl(m_hwnd, IDC_FILTER, true); + m_btnFilter.Enable(true); if (si->iType == GCW_CHATROOM) { MODULEINFO* tmp = pci->MM_FindModule(si->pszModule); if (tmp) @@ -302,7 +285,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) if (si->iType == GCW_SERVER) { Utils::enableDlgControl(m_hwnd, IDC_SHOWNICKLIST, false); - Utils::enableDlgControl(m_hwnd, IDC_FILTER, false); + m_btnFilter.Enable(false); Utils::enableDlgControl(m_hwnd, IDC_CHANMGR, false); } @@ -484,7 +467,7 @@ LBL_SkipEnd: static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndParent = GetParent(hwnd); - CTabBaseDlg *mwdat = (CTabBaseDlg*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); + CTabBaseDlg *mwdat = (CChatRoomDlg*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (mwdat != nullptr) @@ -624,21 +607,21 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0; case 0x02: // ctrl-b (bold) if (mi->bBold) { - CheckDlgButton(hwndParent, IDC_CHAT_BOLD, IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED); - SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0); + CheckDlgButton(hwndParent, IDC_BOLD, IsDlgButtonChecked(hwndParent, IDC_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED); + SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0); } return 0; case 0x20: // ctrl-space clear formatting if (mi->bBold && mi->bItalics && mi->bUnderline) { CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_UNCHECKED); CheckDlgButton(hwndParent, IDC_COLOR, BST_UNCHECKED); - CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED); - CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_UNCHECKED); + CheckDlgButton(hwndParent, IDC_BOLD, BST_UNCHECKED); + CheckDlgButton(hwndParent, IDC_UNDERLINE, BST_UNCHECKED); CheckDlgButton(hwndParent, IDC_ITALICS, BST_UNCHECKED); SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0); SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0); - SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0); - SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0); + SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0); + SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0); SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0); } return 0; @@ -650,8 +633,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0; case 0x15: // ctrl-u underlined if (mi->bUnderline) { - CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED); - SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0); + CheckDlgButton(hwndParent, IDC_UNDERLINE, IsDlgButtonChecked(hwndParent, IDC_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED); + SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0); } return 0; // ctrl-k color case 0x0b: @@ -908,13 +891,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (mi->bBold) { - UINT u = IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD); + UINT u = IsDlgButtonChecked(hwndParent, IDC_BOLD); UINT u2 = cf.dwEffects; u2 &= CFE_BOLD; if (u == BST_UNCHECKED && u2) - CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_CHECKED); + CheckDlgButton(hwndParent, IDC_BOLD, BST_CHECKED); else if (u == BST_CHECKED && u2 == 0) - CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED); + CheckDlgButton(hwndParent, IDC_BOLD, BST_UNCHECKED); } if (mi->bItalics) { @@ -928,14 +911,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (mi->bUnderline) { - UINT u = IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE); + UINT u = IsDlgButtonChecked(hwndParent, IDC_UNDERLINE); if (cf.dwEffects & CFE_UNDERLINE && (cf.bUnderlineType & CFU_UNDERLINE || cf.bUnderlineType & CFU_UNDERLINEWORD)) { if (u == BST_UNCHECKED) - CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_CHECKED); + CheckDlgButton(hwndParent, IDC_UNDERLINE, BST_CHECKED); } else { if (u == BST_CHECKED) - CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_UNCHECKED); + CheckDlgButton(hwndParent, IDC_UNDERLINE, BST_UNCHECKED); } } } @@ -1536,10 +1519,30 @@ static void __cdecl phase2(void * lParam) // which is usually a (tabbed) child of a container class window. CChatRoomDlg::CChatRoomDlg(TNewWindowData *pData) - : CTabBaseDlg(pData, IDD_CHANNEL) + : CTabBaseDlg(pData, IDD_CHANNEL), + m_btnOk(this, IDOK), + m_btnBold(this, IDC_BOLD), + m_btnColor(this, IDC_COLOR), + m_btnFilter(this, IDC_FILTER), + m_btnItalic(this, IDC_ITALICS), + m_btnHistory(this, IDC_HISTORY), + m_btnBkColor(this, IDC_BKGCOLOR), + m_btnUnderline(this, IDC_UNDERLINE) { m_bType = SESSIONTYPE_CHAT; - m_Panel = new CInfoPanel(this); + m_pPanel = new CInfoPanel(this); + + si = newData->si; + m_hContact = si->hContact; + m_szProto = GetContactProto(si->hContact); + + m_btnOk.OnClick = Callback(this, &CChatRoomDlg::OnClick_OK); + m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::OnClick_Filter); + m_btnHistory.OnClick = Callback(this, &CChatRoomDlg::OnClick_History); + m_btnColor.OnClick = Callback(this, &CChatRoomDlg::OnClick_Color); + m_btnBkColor.OnClick = Callback(this, &CChatRoomDlg::OnClick_BkColor); + m_btnBold.OnClick = m_btnItalic.OnClick = m_btnUnderline.OnClick = Callback(this, &CChatRoomDlg::OnClick_BIU); + m_message.OnChange = Callback(this, &CChatRoomDlg::OnChange_Message); } CThumbBase* CChatRoomDlg::CreateThumb(CProxyWindow *pProxy) const @@ -1567,10 +1570,6 @@ void CChatRoomDlg::OnInitDialog() { SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); - si = newData->si; - m_hContact = si->hContact; - m_szProto = GetContactProto(si->hContact); - m_cache = CContactCache::getContactCache(m_hContact); m_cache->updateNick(); m_cache->updateUIN(); @@ -1604,29 +1603,30 @@ void CChatRoomDlg::OnInitDialog() SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL); } - m_Panel->getVisibility(); - m_Panel->Configure(); + m_pPanel->getVisibility(); + m_pPanel->Configure(); M.AddWindow(m_hwnd, m_hContact); BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0); - SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); - SendDlgItemMessage(m_hwnd, IDC_LOG, EM_AUTOURLDETECT, 1, 0); + m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); + m_log.SendMsg(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)); - m_Panel->loadHeight(); + m_log.SendMsg(EM_SETEVENTMASK, 0, m_log.SendMsg(EM_GETEVENTMASK, 0, 0) | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS); + m_log.SendMsg(EM_LIMITTEXT, 0x7FFFFFFF, 0); + m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); + + m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); + m_message.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); + + m_pPanel->loadHeight(); if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != NULL) UpdateTrayMenu(0, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE); DM_ThemeChanged(); - SendDlgItemMessage(m_hwnd, IDC_LOG, EM_HIDESELECTION, TRUE, 0); + m_log.SendMsg(EM_HIDESELECTION, TRUE, 0); GetMYUIN(); GetMyNick(); @@ -1642,17 +1642,19 @@ void CChatRoomDlg::OnInitDialog() DM_InitTip(); BB_InitDlgButtons(); SendMessage(m_hwnd, WM_CBD_LOADICONS, 0, 0); + m_btnBold.OnInit(); m_btnItalic.OnInit(); m_btnUnderline.OnInit(); m_btnOk.OnInit(); + m_btnColor.OnInit(); m_btnBkColor.OnInit(); m_btnFilter.OnInit(); 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(m_btnFilter.GetHwnd(), ButtonSubclassProc); + mir_subclassWindow(m_btnColor.GetHwnd(), ButtonSubclassProc); + mir_subclassWindow(m_btnBkColor.GetHwnd(), ButtonSubclassProc); - mir_subclassWindow(GetDlgItem(m_hwnd, IDC_MESSAGE), MessageSubclassProc); - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SUBCLASSED, 0, 0); + mir_subclassWindow(m_message.GetHwnd(), MessageSubclassProc); + m_message.SendMsg(EM_SUBCLASSED, 0, 0); SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0); SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); @@ -1725,7 +1727,7 @@ void CChatRoomDlg::OnDestroy() memset((void*)&m_pContainer->mOld, -1000, sizeof(MARGINS)); PostMessage(m_pContainer->hwnd, WM_SIZE, 0, 1); - delete m_Panel; + delete m_pPanel; if (m_pContainer->dwFlags & CNT_SIDEBAR) m_pContainer->SideBar->removeSession(this); @@ -1733,14 +1735,197 @@ void CChatRoomDlg::OnDestroy() SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); } +void CChatRoomDlg::OnClick_OK(CCtrlButton*) +{ + if (GetSendButtonState(m_hwnd) == PBS_DISABLED) + return; + + MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + if (mi == NULL) + return; + + ptrA pszRtf(Message_GetFromStream(m_message.GetHwnd())); + pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf); + + CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf))); + if (ptszText.IsEmpty()) + return; + + si->dat->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors); + ptszText.Trim(); + ptszText.Replace(L"%", L"%%"); + + if (mi->bAckMsg) { + Utils::enableDlgControl(m_hwnd, IDC_MESSAGE, false); + m_message.SendMsg(EM_SETREADONLY, TRUE, 0); + } + else SetDlgItemText(m_hwnd, IDC_MESSAGE, L""); + + Utils::enableDlgControl(m_hwnd, IDOK, false); + + // Typing support for GCW_PRIVMESS sessions + if (si->iType == GCW_PRIVMESS) + if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); + + bool fSound = true; + if (ptszText[0] == '/' || si->iType == GCW_SERVER) + fSound = false; + 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 (m_pContainer) + if (fSound && !nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND)) + SkinPlaySound("ChatSent"); + + SetFocus(m_message.GetHwnd()); +} + +void CChatRoomDlg::OnClick_Filter(CCtrlButton *pButton) +{ + if (!pButton->Enabled()) + return; + + if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) { + MessageBox(0, TranslateT("The filter cannot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK); + si->bFilterEnabled = 0; + } + else si->bFilterEnabled = !si->bFilterEnabled; + + m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, + (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); + + if (si->bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) { + SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0); + return; + } + 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); +} + +void CChatRoomDlg::OnClick_History(CCtrlButton *pButton) +{ + if (!pButton->Enabled()) + return; + + MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule); + if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(si->pszModule, "IRC")) { + char szName[MAX_PATH]; + WideCharToMultiByte(CP_ACP, 0, si->ptszName, -1, szName, MAX_PATH, 0, 0); + szName[MAX_PATH - 1] = 0; + CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName); + } + else if (pInfo) + ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW); +} + +void CChatRoomDlg::OnClick_BIU(CCtrlButton *pButton) +{ + if (!pButton->Enabled()) + return; + + CHARFORMAT2 cf; + cf.cbSize = sizeof(CHARFORMAT2); + cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE; + cf.dwEffects = 0; + + if (IsDlgButtonChecked(m_hwnd, IDC_BOLD)) + cf.dwEffects |= CFE_BOLD; + if (IsDlgButtonChecked(m_hwnd, IDC_ITALICS)) + cf.dwEffects |= CFE_ITALIC; + if (IsDlgButtonChecked(m_hwnd, IDC_UNDERLINE)) + cf.dwEffects |= CFE_UNDERLINE; + + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); +} + +void CChatRoomDlg::OnClick_Color(CCtrlButton *pButton) +{ + if (!pButton->Enabled()) + return; + + CHARFORMAT2 cf; + cf.cbSize = sizeof(CHARFORMAT2); + cf.dwEffects = 0; + + if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) { + if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) + 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]; + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + } + else { + COLORREF cr; + LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE); + cf.dwMask = CFM_COLOR; + cf.crTextColor = cr; + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } +} + +void CChatRoomDlg::OnClick_BkColor(CCtrlButton *pButton) +{ + if (!pButton->Enabled()) + return; + + CHARFORMAT2 cf; + cf.cbSize = sizeof(CHARFORMAT2); + cf.dwEffects = 0; + + if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) { + if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) + 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]; + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + } + else { + cf.dwMask = CFM_BACKCOLOR; + cf.crBackColor = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR); + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } +} + +void CChatRoomDlg::OnChange_Message(CCtrlEdit*) +{ + if (m_pContainer->hwndActive == m_hwnd) + UpdateReadChars(); + m_dwLastActivity = GetTickCount(); + m_pContainer->dwLastActivity = m_dwLastActivity; + m_btnOk.SendMsg(BUTTONSETASNORMAL, GetRichTextLength(m_message.GetHwnd()) != 0, 0); + m_btnOk.Enable(GetRichTextLength(m_message.GetHwnd()) != 0); + + // Typing support for GCW_PRIVMESS sessions + if (si->iType == GCW_PRIVMESS) { + if (!(GetKeyState(VK_CONTROL) & 0x8000)) { + m_nLastTyping = GetTickCount(); + if (GetWindowTextLength(m_message.GetHwnd())) { + if (m_nTypeMode == PROTOTYPE_SELFTYPING_OFF) { + if (!(m_dwFlags & MWF_INITMODE)) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_ON); + } + } + else if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) + DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); + } + } +} + INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { if (si == NULL && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) return 0; - CHARFORMAT2 cf; POINT pt, tmp, cur; RECT rc; + MODULEINFO *pInfo; switch (uMsg) { case WM_SETFOCUS: @@ -1748,7 +1933,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; UpdateWindowState(WM_SETFOCUS); - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); + SetFocus(m_message.GetHwnd()); return 1; case WM_TIMECHANGE: @@ -1760,17 +1945,25 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case GC_SETWNDPROPS: - InitButtons(m_hwnd, si); - SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); + pInfo = si ? pci->MM_FindModule(si->pszModule) : NULL; + if (pInfo) { + m_btnBold.Enable(pInfo->bBold); + m_btnItalic.Enable(pInfo->bItalics); + m_btnUnderline.Enable(pInfo->bUnderline); + m_btnColor.Enable(pInfo->bColor); + m_btnBkColor.Enable(pInfo->bBkgColor); + if (si->iType == GCW_CHATROOM) + Utils::enableDlgControl(m_hwnd, IDC_CHANMGR, pInfo->bChanMgr); + } + m_log.SendMsg(EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); DM_InitRichEdit(); - SendDlgItemMessage(m_hwnd, IDOK, BUTTONSETASNORMAL, TRUE, 0); + m_btnOk.SendMsg(BUTTONSETASNORMAL, TRUE, 0); SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight); InvalidateRect(GetDlgItem(m_hwnd, IDC_LIST), NULL, TRUE); - SendDlgItemMessage(m_hwnd, IDC_FILTER, BUTTONSETOVERLAYICON, - (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); + m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0); break; @@ -1858,7 +2051,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) x += GetTextPixelSize(mi->ptszModDispName, (HFONT)SendMessage(m_pContainer->hwndStatus, WM_GETFONT, 0, 0), TRUE); x += GetSystemMetrics(SM_CXSMICON); - if (m_Panel->isActive()) { + if (m_pPanel->isActive()) { time_t now = time(0); DWORD diff = (now - mi->idleTimeStamp) / 60; @@ -1885,7 +2078,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText); UpdateStatusBar(); - m_Panel->Invalidate(); + m_pPanel->Invalidate(); if (m_pWnd) m_pWnd->Invalidate(); return TRUE; @@ -1900,7 +2093,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); if (!IsIconic(m_hwnd)) { - int panelHeight = m_Panel->getHeight() + 1; + int panelHeight = m_pPanel->getHeight() + 1; GetClientRect(m_hwnd, &rc); int cx = rc.right; @@ -1959,16 +2152,18 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case GC_ADDLOG: - if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) { - if (!MessageWindowOpened(0, (LPARAM)m_hwnd)) - SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); - } - else if (g_Settings.bUseDividers) { - bool bInactive = (GetForegroundWindow() != m_pContainer->hwnd || GetActiveWindow() != m_pContainer->hwnd); - if (bInactive) - SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); - else if (m_pContainer->hwndActive != m_hwnd) - SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); + if (PluginConfig.m_bUseDividers) { + if (PluginConfig.m_bDividersUsePopupConfig) { + if (!MessageWindowOpened(0, (LPARAM)m_hwnd)) + DM_AddDivider(); + } + else { + bool bInactive = (GetForegroundWindow() != m_pContainer->hwnd || GetActiveWindow() != m_pContainer->hwnd); + if (bInactive) + DM_AddDivider(); + else if (m_pContainer->hwndActive != m_hwnd) + DM_AddDivider(); + } } if (si->pLogEnd) @@ -1998,7 +2193,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam; if (mis->CtlType == ODT_MENU) { - if (m_Panel->isHovered()) { + if (m_pPanel->isHovered()) { mis->itemHeight = 0; mis->itemWidth = 6; return TRUE; @@ -2013,7 +2208,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; if (dis->CtlType == ODT_MENU) { - if (m_Panel->isHovered()) { + if (m_pPanel->isHovered()) { DrawMenuItem(dis, (HICON)dis->itemData, 0); return TRUE; } @@ -2203,7 +2398,7 @@ LABEL_SHOWWINDOW: } else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTERY) || lParam == -1) { GetClientRect(m_hwnd, &rc); - rc.top += (m_Panel->isActive() ? m_Panel->getHeight() + 40 : 30); + rc.top += (m_pPanel->isActive() ? m_pPanel->getHeight() + 40 : 30); pt.x = 0, pt.y = wParam; ScreenToClient(m_hwnd, &pt); @@ -2221,7 +2416,7 @@ LABEL_SHOWWINDOW: 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)) - m_Panel->setHeight(pt.y + 2); + m_pPanel->setHeight(pt.y + 2); RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); if (M.isAero()) InvalidateRect(m_hwndParent, NULL, FALSE); @@ -2265,12 +2460,8 @@ LABEL_SHOWWINDOW: 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(wParam, lParam); - return 0; - case GC_SHOWCOLORCHOOSER: - pci->ColorChooser(si, lParam == IDC_COLOR, m_hwnd, GetDlgItem(m_hwnd, IDC_MESSAGE), GetDlgItem(m_hwnd, lParam)); + pci->ColorChooser(si, lParam == IDC_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, lParam)); break; case GC_SCROLLTOBOTTOM: @@ -2326,12 +2517,12 @@ LABEL_SHOWWINDOW: if (msg == WM_MOUSEMOVE) { GetCursorPos(&pt); DM_DismissTip(pt); - m_Panel->trackMouse(pt); + m_pPanel->trackMouse(pt); break; } if (msg == WM_KEYDOWN) { if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) { - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0); + m_message.SendMsg(EM_PASTESPECIAL, CF_UNICODETEXT, 0); ((MSGFILTER*)lParam)->msg = WM_NULL; ((MSGFILTER*)lParam)->wParam = 0; ((MSGFILTER*)lParam)->lParam = 0; @@ -2358,7 +2549,7 @@ LABEL_SHOWWINDOW: return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_FILTERTOGGLE: SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0); - InvalidateRect(GetDlgItem(m_hwnd, IDC_FILTER), NULL, TRUE); + InvalidateRect(m_btnFilter.GetHwnd(), NULL, TRUE); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_LISTTOGGLE: SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0); @@ -2379,7 +2570,7 @@ LABEL_SHOWWINDOW: if (msg == WM_KEYDOWN && wp == VK_TAB) { if (((NMHDR*)lParam)->idFrom == IDC_LOG) { - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); + SetFocus(m_message.GetHwnd()); return _dlgReturn(m_hwnd, 1); } } @@ -2395,12 +2586,12 @@ LABEL_SHOWWINDOW: pszWord[0] = '\0'; POINTL ptl = { pt.x, pt.y }; ScreenToClient(m_log.GetHwnd(), (LPPOINT)&ptl); - int iCharIndex = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl); + int iCharIndex = m_log.SendMsg(EM_CHARFROMPOS, 0, (LPARAM)&ptl); if (iCharIndex < 0) break; - int start = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex); - int end = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex); + int start = m_log.SendMsg(EM_FINDWORDBREAK, WB_LEFT, iCharIndex); + int end = m_log.SendMsg(EM_FINDWORDBREAK, WB_RIGHT, iCharIndex); if (end - start > 0) { static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n"; @@ -2412,7 +2603,7 @@ LABEL_SHOWWINDOW: TEXTRANGE tr = { 0 }; tr.chrg = cr; tr.lpstrText = (wchar_t*)pszWord; - int iRes = SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + int iRes = m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) { size_t iLen = mir_wstrlen(pszWord) - 1; @@ -2528,7 +2719,7 @@ LABEL_SHOWWINDOW: if (msg == WM_LBUTTONUP) { CHARRANGE chr; - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); + m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&chr); wchar_t tszAplTmpl[] = L"%s:"; size_t bufSize = mir_wstrlen(tr.lpstrText) + mir_wstrlen(tszAplTmpl) + 3; @@ -2540,7 +2731,7 @@ LABEL_SHOWWINDOW: // prepend nick with space if needed tr2.chrg.cpMin = chr.cpMin - 1; tr2.chrg.cpMax = chr.cpMin; - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2); + m_message.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr2); if (!iswspace(*tr2.lpstrText)) *tszTmp++ = ' '; mir_wstrcpy(tszTmp, tr.lpstrText); @@ -2554,7 +2745,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(m_hwnd, IDC_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !iswspace(*tr2.lpstrText)) { + if (!m_message.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !iswspace(*tr2.lpstrText)) { tszAppeal[st++] = ' '; tszAppeal[st++] = '\0'; } @@ -2563,12 +2754,12 @@ LABEL_SHOWWINDOW: tszAppeal[st++] = ' '; tszAppeal[st++] = '\0'; } - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal); + m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszAppeal); mir_free((void*)tr2.lpstrText); mir_free((void*)tszAppeal); } } - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); + SetFocus(m_message.GetHwnd()); mir_free(tr.lpstrText); return TRUE; } @@ -2581,7 +2772,7 @@ LABEL_SHOWWINDOW: case WM_LBUTTONDOWN: GetCursorPos(&tmp); - if (!m_Panel->isHovered()) { + if (!m_pPanel->isHovered()) { cur.x = (SHORT)tmp.x; cur.y = (SHORT)tmp.y; SendMessage(m_pContainer->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur))); @@ -2590,8 +2781,8 @@ LABEL_SHOWWINDOW: case WM_LBUTTONUP: GetCursorPos(&tmp); - if (m_Panel->isHovered()) - m_Panel->handleClick(tmp); + if (m_pPanel->isHovered()) + m_pPanel->handleClick(tmp); else { cur.x = (SHORT)tmp.x; cur.y = (SHORT)tmp.y; @@ -2602,7 +2793,7 @@ LABEL_SHOWWINDOW: case WM_MOUSEMOVE: GetCursorPos(&pt); DM_DismissTip(pt); - m_Panel->trackMouse(pt); + m_pPanel->trackMouse(pt); break; case WM_APPCOMMAND: @@ -2633,7 +2824,7 @@ LABEL_SHOWWINDOW: 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(m_hwnd, IDC_MESSAGE, EM_GETSEL, 0, 0); + LRESULT lResult = (LRESULT)m_message.SendMsg(EM_GETSEL, 0, 0); int start = LOWORD(lResult); CMStringW tszName; if (start == 0) @@ -2641,9 +2832,9 @@ LABEL_SHOWWINDOW: else tszName.Format(L"%s ", ui->pszNick); - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); + m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); + SetFocus(m_message.GetHwnd()); } else pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); } @@ -2661,51 +2852,6 @@ LABEL_SHOWWINDOW: ShowWindow(m_pContainer->hwnd, SW_MINIMIZE); return FALSE; - case IDOK: - if (GetSendButtonState(m_hwnd) != PBS_DISABLED) { - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); - if (mi == NULL) - break; - - 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; - - si->dat->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors); - ptszText.Trim(); - ptszText.Replace(L"%", L"%%"); - - if (mi->bAckMsg) { - Utils::enableDlgControl(m_hwnd, IDC_MESSAGE, false); - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0); - } - else SetDlgItemText(m_hwnd, IDC_MESSAGE, L""); - - Utils::enableDlgControl(m_hwnd, IDOK, false); - - // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) - if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) - DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); - - bool fSound = true; - if (ptszText[0] == '/' || si->iType == GCW_SERVER) - fSound = false; - 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 (m_pContainer) - if (fSound && !nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND)) - SkinPlaySound("ChatSent"); - - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); - } - break; - case IDC_SHOWNICKLIST: if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_SHOWNICKLIST))) break; @@ -2720,46 +2866,6 @@ LABEL_SHOWWINDOW: PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); break; - case IDC_MESSAGE: - if (HIWORD(wParam) == EN_CHANGE) { - if (m_pContainer->hwndActive == m_hwnd) - UpdateReadChars(); - m_dwLastActivity = GetTickCount(); - m_pContainer->dwLastActivity = m_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)) { - m_nLastTyping = GetTickCount(); - if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE))) { - if (m_nTypeMode == PROTOTYPE_SELFTYPING_OFF) { - if (!(m_dwFlags & MWF_INITMODE)) - DM_NotifyTyping(PROTOTYPE_SELFTYPING_ON); - } - } - else if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) - DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); - } - } - } - break; - - case 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]; - WideCharToMultiByte(CP_ACP, 0, si->ptszName, -1, szName, MAX_PATH, 0, 0); - szName[MAX_PATH - 1] = 0; - CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName); - } - else if (pInfo) - ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW); - } - break; - case IDC_CHAT_CLOSE: SendMessage(m_hwnd, WM_CLOSE, 0, 1); break; @@ -2770,99 +2876,6 @@ LABEL_SHOWWINDOW: pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); break; - case IDC_FILTER: - if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_FILTER))) - break; - - if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) { - MessageBox(0, TranslateT("The filter cannot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK); - si->bFilterEnabled = 0; - } - else si->bFilterEnabled = !si->bFilterEnabled; - - 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(m_hwnd, GC_SHOWFILTERMENU, 0, 0); - break; - } - 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; - - case IDC_BKGCOLOR: - cf.cbSize = sizeof(CHARFORMAT2); - cf.dwEffects = 0; - - if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_BKGCOLOR))) - break; - - if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) { - if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) - 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(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(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - break; - - case IDC_COLOR: - cf.cbSize = sizeof(CHARFORMAT2); - cf.dwEffects = 0; - - if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_COLOR))) - break; - - if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) { - if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) - 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(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - } - else { - COLORREF cr; - LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE); - cf.dwMask = CFM_COLOR; - cf.crTextColor = cr; - SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - break; - - case IDC_CHAT_BOLD: - case IDC_ITALICS: - case IDC_CHAT_UNDERLINE: - cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE; - cf.dwEffects = 0; - - if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_BOLD))) - break; - if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_ITALICS))) - break; - if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_UNDERLINE))) - break; - if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_BOLD)) - cf.dwEffects |= CFE_BOLD; - if (IsDlgButtonChecked(m_hwnd, IDC_ITALICS)) - cf.dwEffects |= CFE_ITALIC; - if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_UNDERLINE)) - cf.dwEffects |= CFE_UNDERLINE; - - 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) { @@ -2881,7 +2894,7 @@ LABEL_SHOWWINDOW: break; case WM_KEYDOWN: - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); + SetFocus(m_message.GetHwnd()); break; case WM_MOVE: @@ -2933,15 +2946,15 @@ LABEL_SHOWWINDOW: if (M.isAero()) { LONG temp = rcClient.bottom; - rcClient.bottom = m_Panel->isActive() ? m_Panel->getHeight() + 5 : 5; + rcClient.bottom = m_pPanel->isActive() ? m_pPanel->getHeight() + 5 : 5; FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH)); rcClient.bottom = temp; } } GetClientRect(m_hwnd, &rc); - m_Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], M.isAero()); - m_Panel->renderContent(hdcMem); + m_pPanel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], M.isAero()); + m_pPanel->renderContent(hdcMem); if (!CSkin::m_skinEnabled) RenderToolbarBG(hdcMem, rcClient); @@ -2970,18 +2983,9 @@ LABEL_SHOWWINDOW: EndPaint(m_hwnd, &ps); return 0; - case DM_SETINFOPANEL: - CInfoPanel::setPanelHandler(this, wParam, lParam); - return 0; - - case DM_INVALIDATEPANEL: - if (m_Panel) - m_Panel->Invalidate(true); - return 0; - case WM_RBUTTONUP: GetCursorPos(&pt); - if (!m_Panel->invokeConfigDialog(pt)) { + if (!m_pPanel->invokeConfigDialog(pt)) { HMENU subMenu = GetSubMenu(PluginConfig.g_hMenuContext, 0); MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT); @@ -3022,40 +3026,6 @@ LABEL_SHOWWINDOW: _dlgReturn(m_hwnd, TRUE); } SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 1); - if (lParam) // forced close not to be handled by the core - return 0; - break; - - case DM_CONTAINERSELECTED: - { - wchar_t *szNewName = (wchar_t*)lParam; - if (!mir_wstrcmp(szNewName, TranslateT("Default container"))) - szNewName = CGlobals::m_default_container_name; - int iOldItems = TabCtrl_GetItemCount(m_hwndParent); - if (!wcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN)) - break; - TContainerData *pNewContainer = FindContainerByName(szNewName); - if (pNewContainer == NULL) - if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == NULL) - break; - 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(m_pContainer->hwndActive, WM_SIZE, 0, 0); - SetForegroundWindow(pNewContainer->hwnd); - SetActiveWindow(pNewContainer->hwnd); - } - break; - - // container API support functions - case DM_QUERYCONTAINER: - if (lParam) - *(TContainerData**)lParam = m_pContainer; - return 0; - - case DM_QUERYHCONTACT: - if (lParam) - *(MCONTACT*)lParam = m_hContact; return 0; case GC_CLOSEWINDOW: @@ -3104,18 +3074,6 @@ LABEL_SHOWWINDOW: } return 0; - case DM_SETLOCALE: - if (m_dwFlags & MWF_WASBACKGROUNDCREATE) - break; - if (m_pContainer->hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && m_hContact != 0 && m_pContainer->hwnd == GetForegroundWindow() && m_pContainer->hwnd == GetActiveWindow()) { - if (lParam) - hkl = (HKL)lParam; - - if (hkl) - ActivateKeyboardLayout(hkl, 0); - } - return 0; - case DM_SAVESIZE: if (m_dwFlags & MWF_NEEDCHECKSIZE) lParam = 0; @@ -3132,7 +3090,7 @@ LABEL_SHOWWINDOW: SendMessage(m_hwnd, WM_SIZE, 0, 0); pt.x = pt.y = 0; - SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt); + m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&pt); if (PluginConfig.m_bAutoLocaleSupport) { if (hkl == 0) DM_LoadLocale(); @@ -3147,37 +3105,10 @@ LABEL_SHOWWINDOW: } return 0; - case DM_GETWINDOWSTATE: - { - UINT state = MSG_WINDOW_STATE_EXISTS; - if (IsWindowVisible(m_hwnd)) - state |= MSG_WINDOW_STATE_VISIBLE; - if (GetForegroundWindow() == m_pContainer->hwnd) - state |= MSG_WINDOW_STATE_FOCUS; - if (IsIconic(m_pContainer->hwnd)) - state |= MSG_WINDOW_STATE_ICONIC; - SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state); - } - return TRUE; - - case DM_ADDDIVIDER: - if (!(m_dwFlags & MWF_DIVIDERSET) && g_Settings.bUseDividers) - if (GetWindowTextLength(m_log.GetHwnd()) > 0) - m_dwFlags |= MWF_DIVIDERWANTED | MWF_DIVIDERSET; - return 0; - - case DM_CHECKSIZE: - m_dwFlags |= MWF_NEEDCHECKSIZE; - return 0; - case DM_REFRESHTABINDEX: m_iTabID = GetTabIndexFromHWND(m_hwndParent, m_hwnd); return 0; - case DM_STATUSBARCHANGED: - UpdateStatusBar(); - break; - case WM_CBD_UPDATED: if (lParam) CB_ChangeButton((CustomButtonData*)lParam); @@ -3212,23 +3143,6 @@ LABEL_SHOWWINDOW: memset(&m_pContainer->mOld, -1000, sizeof(MARGINS)); CProxyWindow::verify(this); break; - - case DM_ACTIVATEME: - ActivateExistingTab(m_pContainer, m_hwnd); - return 0; - - case DM_ACTIVATETOOLTIP: - if (!IsIconic(m_pContainer->hwnd) && m_pContainer->hwndActive == m_hwnd) - m_Panel->showTip(wParam, lParam); - break; - - case DM_SAVEMESSAGELOG: - DM_SaveLogAsRTF(); - return 0; - - case DM_CHECKAUTOHIDE: - DM_CheckAutoHide(wParam, lParam); - return 0; } return CTabBaseDlg::DlgProc(uMsg, wParam, lParam); } diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 9154c69739..7c0f5b003b 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -300,8 +300,8 @@ void CContactCache::inputHistoryEvent(WPARAM wParam) return; if (m_history != NULL && m_history[0].szText != NULL) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;) - HWND hwndEdit = ::GetDlgItem(m_hwnd, IDC_MESSAGE); - SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; + HWND hwndEdit = ::GetDlgItem(m_hwnd, IDC_MESSAGE); + SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; if (m_dat->m_dwFlags & MWF_NEEDHISTORYSAVE) { m_iHistoryCurrent = m_iHistoryTop; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index d4cbb47f6a..2fb8fdc715 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -61,13 +61,13 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) RECT rcWnd;
if (dat->m_bType == SESSIONTYPE_IM) {
- if (dat->m_Panel->isActive())
+ if (dat->m_pPanel->isActive())
GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
else
GetWindowRect(dat->GetHwnd(), &rcWnd);
}
else {
- if (dat->m_Panel->isActive())
+ if (dat->m_pPanel->isActive())
GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
else
GetWindowRect(dat->GetHwnd(), &rcWnd);
@@ -970,7 +970,8 @@ panel_found: break;
case ID_FILE_SAVEMESSAGELOGAS:
- SendMessage(pContainer->hwndActive, DM_SAVEMESSAGELOG, 0, 0);
+ if (dat)
+ dat->DM_SaveLogAsRTF();
break;
case ID_FILE_CLOSEMESSAGESESSION:
@@ -1076,8 +1077,8 @@ panel_found: POINT pt;
GetWindowRect(pContainer->hwndActive, &rc);
pt.x = rc.left + 10;
- pt.y = rc.top + dat->m_Panel->getHeight() - 10;
- dat->m_Panel->invokeConfigDialog(pt);
+ pt.y = rc.top + dat->m_pPanel->getHeight() - 10;
+ dat->m_pPanel->invokeConfigDialog(pt);
}
return 0;
@@ -1239,7 +1240,7 @@ panel_found: dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat && dat->m_bType == SESSIONTYPE_IM) {
if (dat->m_idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- dat->m_Panel->Invalidate(TRUE);
+ dat->m_pPanel->Invalidate(TRUE);
}
else if (dat)
SendMessage(dat->GetHwnd(), GC_UPDATESTATUSBAR, 0, 0);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 653f580545..e94586b5a8 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -73,34 +73,6 @@ void CTabBaseDlg::DM_SaveLogAsRTF() const } ///////////////////////////////////////////////////////////////////////////////////////// -// This is broadcasted by the container to all child windows to check if the -// container can be autohidden or -closed. -// -// wParam is the autohide timeout (in seconds) -// lParam points to a BOOL and a session which wants to prevent auto-hiding -// the container must set it to FALSE. -// -// If no session in the container disagrees, the container will be hidden. - -void CTabBaseDlg::DM_CheckAutoHide(WPARAM wParam, LPARAM lParam) const -{ - if (!lParam) - return; - - BOOL *fResult = (BOOL*)lParam; - if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE)) > 0) { - *fResult = FALSE; - return; // text entered in the input area -> prevent autohide/cose - } - if (m_dwUnread) { - *fResult = FALSE; - return; // unread events, do not hide or close the container - } - if (((GetTickCount() - m_dwLastActivity) / 1000) <= wParam) - *fResult = FALSE; // time since last activity did not yet reach the threshold. -} - -///////////////////////////////////////////////////////////////////////////////////////// // checks if the balloon tooltip can be dismissed (usually called by WM_MOUSEMOVE events) void CTabBaseDlg::DM_DismissTip(const POINT& pt) @@ -163,15 +135,15 @@ bool CTabBaseDlg::DM_GenericHotkeysCheck(MSG *message) return true; case TABSRMM_HK_SEND: - if (!(GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_STYLE) & ES_READONLY)) { + if (!(GetWindowLongPtr(m_message.GetHwnd(), GWL_STYLE) & ES_READONLY)) { PostMessage(m_hwnd, WM_COMMAND, IDOK, 0); return true; } break; case TABSRMM_HK_TOGGLEINFOPANEL: - m_Panel->setActive(!m_Panel->isActive()); - m_Panel->showHide(); + m_pPanel->setActive(!m_pPanel->isActive()); + m_pPanel->showHide(); return true; case TABSRMM_HK_TOGGLETOOLBAR: @@ -435,16 +407,16 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar break; } db_set_b(m_hContact, SRMSGMOD_T, "no_ack", (BYTE)(m_sendMode & SMODE_NOACK ? 1 : 0)); - SetWindowPos(GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); + SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); if (m_sendMode & SMODE_MULTIPLE || m_sendMode & SMODE_CONTAINER) { - SetWindowPos(GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } else { if (IsWindow(GetDlgItem(m_hwnd, IDC_CLIST))) DestroyWindow(GetDlgItem(m_hwnd, IDC_CLIST)); - SetWindowPos(GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } @@ -464,7 +436,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar m_fEditNotesActive = !m_fEditNotesActive; if (m_fEditNotesActive) { - int iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE)); + int iLen = GetWindowTextLength(m_message.GetHwnd()); if (iLen != 0) { SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("You cannot edit user notes when there are unsent messages")); m_fEditNotesActive = false; @@ -485,7 +457,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar } } else { - int iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE)); + int iLen = GetWindowTextLength(m_message.GetHwnd()); wchar_t *buf = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t)); GetDlgItemText(m_hwnd, IDC_MESSAGE, buf, iLen + 1); @@ -498,7 +470,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar DM_ScrollToBottom(0, 1); } } - SetWindowPos(GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); @@ -526,15 +498,15 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar // error control case IDC_CANCELSEND: - SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_CANCEL, 0); + DM_ErrorDetected(MSGERROR_CANCEL, 0); break; case IDC_RETRY: - SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_RETRY, 0); + DM_ErrorDetected(MSGERROR_RETRY, 0); break; case IDC_MSGSENDLATER: - SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_SENDLATER, 0); + DM_ErrorDetected(MSGERROR_SENDLATER, 0); break; case IDC_SELFTYPING: @@ -728,15 +700,15 @@ void CTabBaseDlg::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) m_dwFlags |= MWF_DEFERREDSCROLL; if (m_hwndIEView) { - PostMessage(GetHwnd(), DM_SCROLLIEVIEW, 0, 0); + PostMessage(m_hwnd, DM_SCROLLIEVIEW, 0, 0); return; } if (m_hwndHPP) { - SendMessage(GetHwnd(), DM_SCROLLIEVIEW, 0, 0); + SendMessage(m_hwnd, DM_SCROLLIEVIEW, 0, 0); return; } - HWND hwnd = GetDlgItem(GetHwnd(), m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG); + HWND hwnd = GetDlgItem(m_hwnd, m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG); if (lParam) SendMessage(hwnd, WM_SIZE, 0, 0); @@ -796,7 +768,7 @@ void CTabBaseDlg::DM_LoadLocale() void CTabBaseDlg::DM_RecalcPictureSize() { - HBITMAP hbm = ((m_Panel->isActive()) && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); + HBITMAP hbm = ((m_pPanel->isActive()) && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); if (hbm) { BITMAP bminfo; GetObject(hbm, sizeof(bminfo), &bminfo); @@ -916,9 +888,9 @@ LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) } if (m_bType == SESSIONTYPE_CHAT) { // scroll nick list by just hovering it RECT rcNicklist; - GetWindowRect(GetDlgItem(GetHwnd(), IDC_LIST), &rcNicklist); + GetWindowRect(GetDlgItem(m_hwnd, IDC_LIST), &rcNicklist); if (PtInRect(&rcNicklist, pt)) { - SendDlgItemMessage(GetHwnd(), IDC_LIST, WM_MOUSEWHEEL, wParam, lParam); + SendDlgItemMessage(m_hwnd, IDC_LIST, WM_MOUSEWHEEL, wParam, lParam); return 0; } } @@ -980,7 +952,7 @@ void CTabBaseDlg::DM_ThemeChanged() if (m_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 (m_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); + SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); } else { if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) { @@ -988,7 +960,7 @@ void CTabBaseDlg::DM_ThemeChanged() SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); } if (m_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); + SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); } m_hThemeIP = M.isAero() ? OpenThemeData(m_hwnd, L"ButtonStyle") : 0; m_hThemeToolbar = (M.isAero() || (!CSkin::m_skinEnabled && M.isVSThemed())) ? OpenThemeData(m_hwnd, L"REBAR") : 0; @@ -1061,7 +1033,7 @@ void CSrmmWindow::DM_OptionsApplied(WPARAM, LPARAM lParam) m_bShowUIElements = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0; m_dwFlagsEx = M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0; - m_Panel->getVisibility(); + m_pPanel->getVisibility(); // small inner margins (padding) for the text areas m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); @@ -1074,7 +1046,7 @@ void CSrmmWindow::DM_OptionsApplied(WPARAM, LPARAM lParam) DM_InitRichEdit(); if (m_hwnd == m_pContainer->hwndActive) SendMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); - InvalidateRect(GetDlgItem(m_hwnd, IDC_MESSAGE), NULL, FALSE); + InvalidateRect(m_message.GetHwnd(), NULL, FALSE); if (!lParam) { if (IsIconic(m_pContainer->hwnd)) m_dwFlags |= MWF_DEFERREDREMAKELOG; @@ -1254,6 +1226,14 @@ int CTabBaseDlg::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) return 0; } +void CTabBaseDlg::DM_AddDivider() +{ + if (!(m_dwFlags & MWF_DIVIDERSET) && PluginConfig.m_bUseDividers) { + if (GetWindowTextLength(m_log.GetHwnd()) > 0) + m_dwFlags |= MWF_DIVIDERWANTED | MWF_DIVIDERSET; + } +} + ///////////////////////////////////////////////////////////////////////////////////////// // incoming event handler @@ -1290,13 +1270,13 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) { if (PluginConfig.m_bDividersUsePopupConfig && PluginConfig.m_bUseDividers) { if (!MessageWindowOpened(m_hContact, 0)) - SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); + DM_AddDivider(); } else if (PluginConfig.m_bUseDividers) { if ((GetForegroundWindow() != m_pContainer->hwnd || GetActiveWindow() != m_pContainer->hwnd)) - SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); + DM_AddDivider(); else if (m_pContainer->hwndActive != m_hwnd) - SendMessage(m_hwnd, DM_ADDDIVIDER, 0, 0); + DM_AddDivider(); } if (!bDisableNotify) tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, m_pContainer->fHidden ? 0 : 1, m_pContainer, m_hwnd, m_cache->getActiveProto()); @@ -1307,7 +1287,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) if (hDbEvent != m_hDbEventFirst) { if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) - SendMessage(m_hwnd, DM_APPENDTOLOG, hDbEvent, 0); + StreamInEvents(hDbEvent, 1, 1, NULL); else { if (m_iNextQueuedEvent >= m_iEventQueueSize) { m_hQueuedEvents = (MEVENT*)mir_realloc(m_hQueuedEvents, (m_iEventQueueSize + 10) * sizeof(MEVENT)); @@ -1373,8 +1353,8 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) // play a sound if (!bDisableNotify && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & (DBEF_SENT))) - PostMessage(m_hwnd, DM_PLAYINCOMINGSOUND, 0, 0); - + PlayIncomingSound(); + if (m_pWnd) m_pWnd->Invalidate(); } @@ -1402,7 +1382,7 @@ void CTabBaseDlg::DM_HandleAutoSizeRequest(REQRESIZE* rr) RECT rc; GetClientRect(m_hwnd, &rc); LONG cy = rc.bottom - rc.top; - LONG panelHeight = (m_Panel->isActive() ? m_Panel->getHeight() : 0); + LONG panelHeight = (m_pPanel->isActive() ? m_pPanel->getHeight() : 0); if (iNewHeight > (cy - panelHeight) / 2) iNewHeight = (cy - panelHeight) / 2; @@ -1511,14 +1491,13 @@ void CTabBaseDlg::DM_UpdateTitle(WPARAM, LPARAM lParam) AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuRecent); - m_Panel->Invalidate(); + m_pPanel->Invalidate(); if (m_pWnd) m_pWnd->Invalidate(); } // care about MetaContacts and update the statusbar icon with the currently "most online" contact... if (m_bIsMeta) { - PostMessage(m_hwnd, DM_UPDATEMETACONTACTINFO, 0, 0); PostMessage(m_hwnd, DM_OWNNICKCHANGED, 0, 0); if (m_pContainer->dwFlags & CNT_UINSTATUSBAR) DM_UpdateLastMessage(); @@ -1641,6 +1620,62 @@ void CTabBaseDlg::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int co } } +void CTabBaseDlg::DM_ErrorDetected(int type, int flag) +{ + switch (type) { + case MSGERROR_CANCEL: + case MSGERROR_SENDLATER: + if (m_dwFlags & MWF_ERRORSTATE) { + m_cache->saveHistory(0, 0); + if (type == MSGERROR_SENDLATER) + sendQueue->doSendLater(m_iCurrentQueueError, this); // to be implemented at a later time + m_iOpenJobs--; + sendQueue->dec(); + if (m_iCurrentQueueError >= 0 && m_iCurrentQueueError < SendQueue::NR_SENDJOBS) + sendQueue->clearJob(m_iCurrentQueueError); + m_iCurrentQueueError = -1; + sendQueue->showErrorControls(this, FALSE); + if (type != MSGERROR_CANCEL || (type == MSGERROR_CANCEL && flag == 0)) + SetDlgItemText(m_hwnd, IDC_MESSAGE, L""); + sendQueue->checkQueue(this); + int iNextFailed = sendQueue->findNextFailed(this); + if (iNextFailed >= 0) + sendQueue->handleError(this, iNextFailed); + } + break; + + case MSGERROR_RETRY: + if (m_dwFlags & MWF_ERRORSTATE) { + int resent = 0; + + m_cache->saveHistory(0, 0); + if (m_iCurrentQueueError >= 0 && m_iCurrentQueueError < SendQueue::NR_SENDJOBS) { + SendJob *job = sendQueue->getJobByIndex(m_iCurrentQueueError); + if (job->hSendId == 0 && job->hContact == 0) + break; + + job->hSendId = (HANDLE)ProtoChainSend(job->hContact, PSS_MESSAGE, job->dwFlags, (LPARAM)job->szSendBuffer); + resent++; + } + + if (resent) { + SendJob *job = sendQueue->getJobByIndex(m_iCurrentQueueError); + + SetTimer(m_hwnd, TIMERID_MSGSEND + m_iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL); + job->iStatus = SendQueue::SQ_INPROGRESS; + m_iCurrentQueueError = -1; + sendQueue->showErrorControls(this, FALSE); + SetDlgItemText(m_hwnd, IDC_MESSAGE, L""); + sendQueue->checkQueue(this); + + int iNextFailed = sendQueue->findNextFailed(this); + if (iNextFailed >= 0) + sendQueue->handleError(this, iNextFailed); + } + } + } +} + int SI_InitStatusIcons() { StatusIconData sid = { sizeof(sid) }; diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 38cc60a681..0763b9c854 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -94,9 +94,9 @@ public: bool m_bStatusOnTabs;
bool m_bLogStatusChanges;
bool m_bUseDividers;
+ bool m_bDividersUsePopupConfig;
bool m_bSoundOnTyping;
bool m_bAllowOfflineMultisend;
- bool m_bDividersUsePopupConfig;
bool m_bFlashOnClist;
bool m_bAlwaysFullToolbarWidth;
bool m_bIdleDetect;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 58a766a86a..549ea6a18d 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -387,39 +387,14 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
break;
- case DM_DOCREATETAB_CHAT:
- {
- SESSION_INFO *si = SM_FindSessionByHWND((HWND)lParam);
- if (si && IsWindow(si->hWnd)) {
- TContainerData *pContainer = 0;
- SendMessage(si->hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer) {
- int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS));
- if (iTabs == 1)
- SendMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
- else
- SendMessage(si->hWnd, WM_CLOSE, 0, 1);
-
- si->hWnd = CreateNewRoom((TContainerData*)wParam, si, TRUE, 0, 0);
- }
- }
- }
- break;
-
case DM_SENDMESSAGECOMMANDW:
SendMessageCommand_W(wParam, lParam);
if (lParam)
mir_free((void*)lParam);
return 0;
- case DM_SENDMESSAGECOMMAND:
- SendMessageCommand(wParam, lParam);
- if (lParam)
- mir_free((void*)lParam);
- return 0;
-
- // sent from the popup to "dismiss" the event. we should do this in the main thread
case DM_REMOVECLISTEVENT:
+ // sent from the popup to "dismiss" the event. we should do this in the main thread
pcli->pfnRemoveEvent(wParam, lParam);
db_event_markRead(wParam, lParam);
return 0;
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index a24101d889..f1e4a2d977 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -40,33 +40,6 @@ wchar_t *xStatusDescr[] = TInfoPanelConfig CInfoPanel::m_ipConfig = { 0 };
-int CInfoPanel::setPanelHandler(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam)
-{
- if (wParam == 0 && lParam == 0) {
- dat->m_Panel->getVisibility();
- dat->m_Panel->loadHeight();
- dat->m_Panel->showHide();
- }
- else {
- CTabBaseDlg *srcDat = (CTabBaseDlg*)wParam;
- if (lParam == 0)
- dat->m_Panel->loadHeight();
- else {
- if (srcDat && lParam && dat != srcDat && !dat->m_Panel->isPrivateHeight()) {
- if (srcDat->m_bType != dat->m_bType && M.GetByte("syncAllPanels", 0) == 0)
- return 0;
-
- if (dat->m_pContainer->settings->fPrivate && srcDat->m_pContainer != dat->m_pContainer)
- return 0;
-
- dat->m_Panel->setHeight((LONG)lParam);
- }
- }
- SendMessage(dat->GetHwnd(), WM_SIZE, 0, 0);
- }
- return 0;
-}
-
void CInfoPanel::setActive(const int newActive)
{
m_active = newActive ? true : false;
@@ -716,7 +689,7 @@ HMENU CInfoPanel::constructContextualMenu() const if (m_hoverFlags & HOVER_NICK) {
Utils::addMenuItem(m, mii, ::Skin_LoadIcon(SKINICON_OTHER_USERDETAILS), TranslateT("Open user details..."), IDC_NAME, 0);
- Utils::addMenuItem(m, mii, ::Skin_LoadIcon(SKINICON_OTHER_HISTORY), TranslateT("Open history..."), m_isChat ? IDC_CHAT_HISTORY : IDC_HISTORY, 0);
+ Utils::addMenuItem(m, mii, ::Skin_LoadIcon(SKINICON_OTHER_HISTORY), TranslateT("Open history..."), m_isChat ? IDC_HISTORY : IDC_HISTORY, 0);
if (!m_isChat)
Utils::addMenuItem(m, mii, PluginConfig.g_iconContainer, TranslateT("Messaging settings..."), ID_MESSAGELOGSETTINGS_FORTHISCONTACT, 1);
else {
@@ -755,7 +728,7 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd) }
break;
- case IDC_CHAT_HISTORY:
+ case IDC_HISTORY:
case IDC_CHANMGR:
if (m_isChat) {
SendMessage(m_dat->GetHwnd(), WM_COMMAND, cmd, 0);
@@ -971,7 +944,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP GetClientRect(hwnd, &rcItem);
rc = rcItem;
- if (!IsWindowEnabled(hwnd) || !dat->m_Panel->isActive() || !dat->m_bShowInfoAvatar)
+ if (!IsWindowEnabled(hwnd) || !dat->m_pPanel->isActive() || !dat->m_bShowInfoAvatar)
return TRUE;
HDC dcWin = (HDC)wParam;
@@ -1005,7 +978,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP else {
rc.bottom += 2;
rc.left -= 3; rc.right += 3;
- dat->m_Panel->renderBG(dcWin, rc, &SkinItems[ID_EXTBKINFOPANELBG], M.isAero(), false);
+ dat->m_pPanel->renderBG(dcWin, rc, &SkinItems[ID_EXTBKINFOPANELBG], M.isAero(), false);
}
if (CSkin::m_bAvatarBorderType == 1) {
diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h index 717740b32b..73c235d902 100644 --- a/plugins/TabSRMM/src/infopanel.h +++ b/plugins/TabSRMM/src/infopanel.h @@ -172,7 +172,6 @@ public: public:
static TInfoPanelConfig m_ipConfig;
- static int setPanelHandler(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index acaa4fe9a8..0cba6bffc3 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -272,7 +272,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) if (m_pWnd)
m_pWnd->activateTab();
- m_Panel->dismissConfig();
+ m_pPanel->dismissConfig();
m_dwUnread = 0;
if (m_pContainer->hwndSaved == m_hwnd)
return;
@@ -323,9 +323,9 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) UpdateTrayMenuState(this, FALSE);
if (m_pContainer->hwndActive == m_hwnd)
- PostMessage(m_hwnd, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0);
+ DeletePopupsForContact(m_hContact, PU_REMOVE_ON_FOCUS);
- m_Panel->Invalidate();
+ m_pPanel->Invalidate();
if (m_dwFlags & MWF_DEFERREDSCROLL && m_hwndIEView == 0 && m_hwndHPP == 0) {
m_dwFlags &= ~MWF_DEFERREDSCROLL;
@@ -428,7 +428,7 @@ void TSAPI SetDialogToType(HWND hwndDlg) Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, false);
- dat->m_Panel->Configure();
+ dat->m_pPanel->Configure();
}
static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -940,7 +940,7 @@ CSrmmWindow::CSrmmWindow(TNewWindowData *pNewData) m_dwFlags = MWF_INITMODE;
m_bType = SESSIONTYPE_IM;
- m_Panel = new CInfoPanel(this);
+ m_pPanel = new CInfoPanel(this);
}
void CSrmmWindow::ClearLog()
@@ -1034,9 +1034,7 @@ void CSrmmWindow::OnInitDialog() else
m_hHistoryEvents = NULL;
- if (m_bIsMeta)
- SendMessage(m_hwnd, DM_UPDATEMETACONTACTINFO, 0, 0);
- else
+ if (!m_bIsMeta)
SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
GetMyNick();
@@ -1054,14 +1052,14 @@ void CSrmmWindow::OnInitDialog() LoadLocalFlags();
DM_InitTip();
- m_Panel->getVisibility();
+ m_pPanel->getVisibility();
m_dwFlagsEx |= M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
m_bIsAutosizingInput = IsAutoSplitEnabled();
m_iInputAreaHeight = -1;
SetMessageLog();
if (m_hContact)
- m_Panel->loadHeight();
+ m_pPanel->loadHeight();
m_bShowAvatar = GetAvatarVisibility();
@@ -1152,7 +1150,7 @@ void CSrmmWindow::OnInitDialog() m_nMax = (int)m_cache->getMaxMessageLength();
}
LoadContactAvatar();
- SendMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ DM_OptionsApplied(0, 0);
LoadOwnAvatar();
// restore saved msg if any...
@@ -1261,7 +1259,7 @@ void CSrmmWindow::OnDestroy() if (db_get_b(m_hContact, "CList", "NotOnList", 0))
db_delete_contact(m_hContact);
- delete m_Panel;
+ delete m_pPanel;
if (m_hwndContactPic)
DestroyWindow(m_hwndContactPic);
@@ -1378,14 +1376,25 @@ void CSrmmWindow::OnDestroy() }
}
+void CSrmmWindow::ReplayQueue()
+{
+ for (int i = 0; i < m_iNextQueuedEvent; i++)
+ if (m_hQueuedEvents[i] != 0)
+ StreamInEvents(m_hQueuedEvents[i], 1, 1, NULL);
+
+ m_iNextQueuedEvent = 0;
+ SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, m_bNotOnList ? TranslateT("Contact not on list. You may add it...") :
+ TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// resizer proc for the "new" layout.
int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc)
{
- int panelHeight = m_Panel->getHeight() + 1;
+ int panelHeight = m_pPanel->getHeight() + 1;
- bool bInfoPanel = m_Panel->isActive();
+ bool bInfoPanel = m_pPanel->isActive();
bool bErrorState = (m_dwFlags & MWF_ERRORSTATE) != 0;
bool bShowToolbar = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0;
bool bBottomToolbar = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0;
@@ -1429,7 +1438,7 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc) return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDC_CONTACTPIC:
- GetClientRect(GetDlgItem(m_hwnd, IDC_MESSAGE), &rc);
+ GetClientRect(m_message.GetHwnd(), &rc);
urc->rcItem.top -= m_splitterY - m_originalSplitterY;
urc->rcItem.left = urc->rcItem.right - (m_pic.cx + 2);
if ((urc->rcItem.bottom - urc->rcItem.top) < (m_pic.cy/* + 2*/) && m_bShowAvatar) {
@@ -1446,7 +1455,7 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc) }
}
- if (m_hwndContactPic) //if m_Panel control was created?
+ if (m_hwndContactPic) //if m_pPanel control was created?
SetWindowPos(m_hwndContactPic, HWND_TOP, 1, ((urc->rcItem.bottom - urc->rcItem.top) - (m_pic.cy)) / 2 + 1, //resizes it
m_pic.cx - 2, m_pic.cy - 2, SWP_SHOWWINDOW);
@@ -1624,7 +1633,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (M.isAero()) {
LONG temp = rcClient.bottom;
- rcClient.bottom = m_Panel->isActive() ? m_Panel->getHeight() + 5 : 5;
+ rcClient.bottom = m_pPanel->isActive() ? m_pPanel->getHeight() + 5 : 5;
FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
rcClient.bottom = temp;
}
@@ -1632,14 +1641,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // draw the (new) infopanel background. Use the gradient from the statusitem.
GetClientRect(m_hwnd, &rc);
- m_Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
+ m_pPanel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
// draw aero related stuff
if (!CSkin::m_skinEnabled)
RenderToolbarBG(hdcMem, rcClient);
// render info panel fields
- m_Panel->renderContent(hdcMem);
+ m_pPanel->renderContent(hdcMem);
if (hpb)
CSkin::FinalizeBufferedPaint(hpb, &rcClient);
@@ -1654,6 +1663,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
return 1;
+ case WM_NCPAINT:
+ if (CSkin::m_skinEnabled)
+ return 0;
+ break;
+
+ case WM_PAINT:
+ PAINTSTRUCT ps;
+ BeginPaint(m_hwnd, &ps);
+ EndPaint(m_hwnd, &ps);
+ return 0;
+
case WM_SIZE:
if (!IsIconic(m_hwnd)) {
if (m_ipFieldHeight == 0)
@@ -1669,7 +1689,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) LoadSplitter();
}
- HBITMAP hbm = ((m_Panel->isActive()) && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown);
+ HBITMAP hbm = ((m_pPanel->isActive()) && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown);
if (hbm != 0) {
BITMAP bminfo;
GetObject(hbm, sizeof(bminfo), &bminfo);
@@ -1683,9 +1703,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) BB_SetButtonsPos();
// size info panel fields
- if (m_Panel->isActive()) {
+ if (m_pPanel->isActive()) {
LONG cx = rc.right;
- LONG panelHeight = m_Panel->getHeight();
+ LONG panelHeight = m_pPanel->getHeight();
hbm = (m_pContainer->avatarMode == 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown);
double dHeight = 0, dWidth = 0;
@@ -1701,7 +1721,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_bShowInfoAvatar) {
SetWindowPos(m_hwndPanelPicParent, HWND_TOP, rc.left - 2, rc.top, rc.right - rc.left, rc.bottom - rc.top + 1, 0);
- ShowWindow(m_hwndPanelPicParent, (m_iPanelAvatarX == 0) || !m_Panel->isActive() ? SW_HIDE : SW_SHOW);
+ ShowWindow(m_hwndPanelPicParent, (m_iPanelAvatarX == 0) || !m_pPanel->isActive() ? SW_HIDE : SW_SHOW);
}
else {
ShowWindow(m_hwndPanelPicParent, SW_HIDE);
@@ -1726,7 +1746,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) rc.top = rc.bottom - m_ipFieldHeight;
m_rcUIN = rc;
- m_Panel->Invalidate();
+ m_pPanel->Invalidate();
}
if (GetDlgItem(m_hwnd, IDC_CLIST) != 0) {
@@ -1737,8 +1757,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) rc.right = rcClient.right;
rc.left = rcClient.right - m_multiSplitterX;
rc.bottom = rcLog.bottom;
- if (m_Panel->isActive())
- rc.top += (m_Panel->getHeight() + 1);
+ if (m_pPanel->isActive())
+ rc.top += (m_pPanel->getHeight() + 1);
MoveWindow(GetDlgItem(m_hwnd, IDC_CLIST), rc.left, rc.top, rc.right - rc.left, rcLog.bottom - rcLog.top, FALSE);
}
@@ -1750,7 +1770,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0;
case WM_TIMECHANGE:
- PostMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ DM_OptionsApplied(0, 0);
break;
case WM_NOTIFY:
@@ -1853,7 +1873,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) db_unset(m_hContact, SRMSGMOD_T, "mwmask");
db_unset(m_hContact, SRMSGMOD_T, "mwflags");
}
- SendMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ DM_OptionsApplied(0, 0);
SendMessage(m_hwnd, DM_DEFERREDREMAKELOG, (WPARAM)m_hwnd, 0);
}
return _dlgReturn(m_hwnd, 1);
@@ -1960,7 +1980,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (isShift || isCtrl || isAlt)
return _dlgReturn(m_hwnd, 1);
if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
- SendMessage(m_hwnd, DM_REPLAYQUEUE, 0, 0);
+ ReplayQueue();
m_dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, (m_bNotOnList || m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE);
if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
@@ -2113,7 +2133,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE:
GetCursorPos(&pt);
DM_DismissTip(pt);
- m_Panel->trackMouse(pt);
+ m_pPanel->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))
@@ -2202,22 +2222,13 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0;
case DM_UPDATESTATUSMSG:
- m_Panel->Invalidate();
+ m_pPanel->Invalidate();
return 0;
case DM_OWNNICKCHANGED:
GetMyNick();
return 0;
- case DM_ADDDIVIDER:
- if (!(m_dwFlags & MWF_DIVIDERSET) && PluginConfig.m_bUseDividers) {
- if (GetWindowTextLength(m_log.GetHwnd()) > 0) {
- m_dwFlags |= MWF_DIVIDERWANTED;
- m_dwFlags |= MWF_DIVIDERSET;
- }
- }
- return 0;
-
case WM_SETFOCUS:
MsgWindowUpdateState(WM_SETFOCUS);
SetFocus(m_message.GetHwnd());
@@ -2237,10 +2248,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(m_hwnd, WM_SIZE, 0, 0);
return 0;
- case DM_SPLITTERGLOBALEVENT:
- DM_SplitterGlobalEvent(wParam, lParam);
- return 0;
-
case DM_SPLITTERMOVED:
if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_MULTISPLITTER)) {
GetClientRect(m_hwnd, &rc);
@@ -2258,7 +2265,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTER)) {
GetClientRect(m_hwnd, &rc);
- rc.top += (m_Panel->isActive() ? m_Panel->getHeight() + 40 : 30);
+ rc.top += (m_pPanel->isActive() ? m_pPanel->getHeight() + 40 : 30);
pt.x = 0;
pt.y = wParam;
ScreenToClient(m_hwnd, &pt);
@@ -2297,7 +2304,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) POINT pnt = { 0, (int)wParam };
ScreenToClient(m_hwnd, &pnt);
if ((pnt.y + 2 >= MIN_PANELHEIGHT + 2) && (pnt.y + 2 < 100) && (pnt.y + 2 < rc.bottom - 30))
- m_Panel->setHeight(pnt.y + 2, true);
+ m_pPanel->setHeight(pnt.y + 2, true);
RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
if (M.isAero())
@@ -2347,20 +2354,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) StreamInEvents(lParam, 1, 1, NULL);
return 0;
- case DM_APPENDTOLOG:
- 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 < m_iNextQueuedEvent; i++)
- if (m_hQueuedEvents[i] != 0)
- StreamInEvents(m_hQueuedEvents[i], 1, 1, NULL);
-
- m_iNextQueuedEvent = 0;
- SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, m_bNotOnList ? TranslateT("Contact not on list. You may add it...") :
- TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
- return 0;
-
case DM_SCROLLIEVIEW:
{
IEVIEWWINDOW iew = { sizeof(iew) };
@@ -2389,7 +2382,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) KillTimer(m_hwnd, wParam);
GetCursorPos(&pt);
- if (wParam == TIMERID_AWAYMSG && m_Panel->hitTest(pt) != CInfoPanel::HTNIRVANA)
+ if (wParam == TIMERID_AWAYMSG && m_pPanel->hitTest(pt) != CInfoPanel::HTNIRVANA)
SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, 0, 0);
else
m_dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER;
@@ -2423,77 +2416,10 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
break;
- case DM_ERRORDECIDED:
- switch (wParam) {
- case MSGERROR_CANCEL:
- case MSGERROR_SENDLATER:
- if (m_dwFlags & MWF_ERRORSTATE) {
- m_cache->saveHistory(0, 0);
- if (wParam == MSGERROR_SENDLATER)
- sendQueue->doSendLater(m_iCurrentQueueError, this); // to be implemented at a later time
- m_iOpenJobs--;
- sendQueue->dec();
- if (m_iCurrentQueueError >= 0 && m_iCurrentQueueError < SendQueue::NR_SENDJOBS)
- sendQueue->clearJob(m_iCurrentQueueError);
- m_iCurrentQueueError = -1;
- sendQueue->showErrorControls(this, FALSE);
- if (wParam != MSGERROR_CANCEL || (wParam == MSGERROR_CANCEL && lParam == 0))
- SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
- sendQueue->checkQueue(this);
- int iNextFailed = sendQueue->findNextFailed(this);
- if (iNextFailed >= 0)
- sendQueue->handleError(this, iNextFailed);
- }
- break;
-
- case MSGERROR_RETRY:
- if (m_dwFlags & MWF_ERRORSTATE) {
- int resent = 0;
-
- m_cache->saveHistory(0, 0);
- if (m_iCurrentQueueError >= 0 && m_iCurrentQueueError < SendQueue::NR_SENDJOBS) {
- SendJob *job = sendQueue->getJobByIndex(m_iCurrentQueueError);
- if (job->hSendId == 0 && job->hContact == 0)
- break;
-
- job->hSendId = (HANDLE)ProtoChainSend(job->hContact, PSS_MESSAGE, job->dwFlags, (LPARAM)job->szSendBuffer);
- resent++;
- }
-
- if (resent) {
- SendJob *job = sendQueue->getJobByIndex(m_iCurrentQueueError);
-
- SetTimer(m_hwnd, TIMERID_MSGSEND + m_iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL);
- job->iStatus = SendQueue::SQ_INPROGRESS;
- m_iCurrentQueueError = -1;
- sendQueue->showErrorControls(this, FALSE);
- SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
- sendQueue->checkQueue(this);
-
- int iNextFailed = sendQueue->findNextFailed(this);
- if (iNextFailed >= 0)
- sendQueue->handleError(this, iNextFailed);
- }
- }
- }
- break;
-
case DM_SELECTTAB:
SendMessage(m_pContainer->hwnd, DM_SELECTTAB, wParam, lParam); // pass the msg to our container
return 0;
- case DM_SETLOCALE:
- if (m_dwFlags & MWF_WASBACKGROUNDCREATE)
- break;
- if (m_pContainer->hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && m_pContainer->hwnd == GetForegroundWindow() && m_pContainer->hwnd == GetActiveWindow()) {
- if (lParam)
- m_hkl = (HKL)lParam;
-
- if (m_hkl)
- ActivateKeyboardLayout(m_hkl, 0);
- }
- return 0;
-
// return timestamp (in ticks) of last recent message which has not been read yet.
// 0 if there is none
// lParam = pointer to a dword receiving the value.
@@ -2505,22 +2431,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
return 0;
- case DM_QUERYCONTAINER:
- {
- TContainerData **pc = (TContainerData **)lParam;
- if (pc)
- *pc = m_pContainer;
- }
- return 0;
-
- case DM_QUERYHCONTACT:
- {
- MCONTACT *phContact = (MCONTACT*)lParam;
- if (phContact)
- *phContact = m_hContact;
- }
- return 0;
-
case DM_UPDATELASTMESSAGE:
DM_UpdateLastMessage();
return 0;
@@ -2560,12 +2470,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
return 0;
- case DM_CHECKSIZE:
- m_dwFlags |= MWF_NEEDCHECKSIZE;
- return 0;
-
- // sent by the message input area hotkeys. just pass it to our container
- case DM_QUERYPENDING:
+ case DM_QUERYPENDING: // sent by the message input area hotkeys. just pass it to our container
SendMessage(m_pContainer->hwnd, DM_QUERYPENDING, wParam, lParam);
return 0;
@@ -2573,14 +2478,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetCursorPos(&tmp);
cur.x = (SHORT)tmp.x;
cur.y = (SHORT)tmp.y;
- if (!m_Panel->isHovered())
+ if (!m_pPanel->isHovered())
SendMessage(m_pContainer->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur)));
break;
case WM_LBUTTONUP:
GetCursorPos(&tmp);
- if (m_Panel->isHovered())
- m_Panel->handleClick(tmp);
+ if (m_pPanel->isHovered())
+ m_pPanel->handleClick(tmp);
else {
cur.x = (SHORT)tmp.x;
cur.y = (SHORT)tmp.y;
@@ -2597,7 +2502,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) rcPanelNick.left = rcPanelNick.right - 30;
GetCursorPos(&pt);
- if (m_Panel->invokeConfigDialog(pt))
+ if (m_pPanel->invokeConfigDialog(pt))
break;
if (PtInRect(&rcPicture, pt))
@@ -2636,13 +2541,13 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE:
GetCursorPos(&pt);
DM_DismissTip(pt);
- m_Panel->trackMouse(pt);
+ m_pPanel->trackMouse(pt);
break;
case WM_MEASUREITEM:
{
LPMEASUREITEMSTRUCT lpmi = (LPMEASUREITEMSTRUCT)lParam;
- if (m_Panel->isHovered()) {
+ if (m_pPanel->isHovered()) {
lpmi->itemHeight = 0;
lpmi->itemWidth = 6;
return TRUE;
@@ -2944,74 +2849,15 @@ quote_from_last: sendQueue->ackMessage(this, wParam, lParam);
return 0;
- case DM_ACTIVATEME:
- ActivateExistingTab(m_pContainer, m_hwnd);
- return 0;
-
- // sent by the select container dialog box when a container was selected...
- // lParam = (wchar_t*)selected name...
- case DM_CONTAINERSELECTED:
- {
- wchar_t *szNewName = (wchar_t*)lParam;
- if (!mir_wstrcmp(szNewName, TranslateT("Default container")))
- szNewName = CGlobals::m_default_container_name;
-
- int iOldItems = TabCtrl_GetItemCount(m_hwndParent);
- if (!wcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
- break;
-
- TContainerData *pNewContainer = FindContainerByName(szNewName);
- if (pNewContainer == NULL)
- if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == NULL)
- break;
-
- db_set_ws(m_hContact, SRMSGMOD_T, "containerW", szNewName);
- m_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);
- SetForegroundWindow(pNewContainer->hwnd);
- SetActiveWindow(pNewContainer->hwnd);
- }
- break;
-
- case DM_STATUSBARCHANGED:
- UpdateStatusBar();
- return 0;
-
case DM_UINTOCLIPBOARD:
Utils::CopyToClipBoard(m_cache->getUIN(), m_hwnd);
return 0;
- // broadcasted when GLOBAL info panel setting changes
- case DM_SETINFOPANEL:
- 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(m_pContainer->hwnd) || m_pContainer->hwndActive != m_hwnd)
- break;
-
- m_Panel->showTip(wParam, lParam);
- break;
-
case WM_NEXTDLGCTL:
if (m_dwFlags & MWF_WASBACKGROUNDCREATE)
return 1;
break;
- // save the contents of the log as rtf file
- case DM_SAVEMESSAGELOG:
- DM_SaveLogAsRTF();
- return 0;
-
- case DM_CHECKAUTOHIDE:
- DM_CheckAutoHide(wParam, lParam);
- return 0;
-
case DM_IEVIEWOPTIONSCHANGED:
if (m_hwndIEView)
SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
@@ -3029,45 +2875,24 @@ quote_from_last: }
break;
- case DM_GETWINDOWSTATE:
- {
- UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(m_hwnd))
- state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == m_pContainer->hwnd)
- state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(m_pContainer->hwnd))
- state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state);
- }
- return TRUE;
-
case DM_CLIENTCHANGED:
GetClientIcon();
- if (m_hClientIcon && m_Panel->isActive())
+ if (m_hClientIcon && m_pPanel->isActive())
InvalidateRect(m_hwnd, NULL, TRUE);
return 0;
case DM_UPDATEUIN:
- if (m_Panel->isActive())
- m_Panel->Invalidate();
+ if (m_pPanel->isActive())
+ m_pPanel->Invalidate();
if (m_pContainer->dwFlags & CNT_UINSTATUSBAR)
UpdateStatusBar();
return 0;
- case DM_REMOVEPOPUPS:
- DeletePopupsForContact(m_hContact, (DWORD)wParam);
- return 0;
-
case EM_THEMECHANGED:
DM_FreeTheme();
DM_ThemeChanged();
return 0;
- case DM_PLAYINCOMINGSOUND:
- PlayIncomingSound();
- return 0;
-
case DM_REFRESHTABINDEX:
m_iTabID = GetTabIndexFromHWND(GetParent(m_hwnd), m_hwnd);
return 0;
@@ -3158,7 +2983,7 @@ quote_from_last: case WM_CLOSE:
// esc handles error controls if we are in error state (error controls visible)
if (wParam == 0 && lParam == 0 && m_dwFlags & MWF_ERRORSTATE) {
- SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
+ DM_ErrorDetected(MSGERROR_CANCEL, 0);
return TRUE;
}
@@ -3176,7 +3001,7 @@ quote_from_last: if (m_iOpenJobs > 0 && lParam != 2) {
if (m_dwFlags & MWF_ERRORSTATE) {
- SendMessage(m_hwnd, DM_ERRORDECIDED, MSGERROR_CANCEL, 1);
+ DM_ErrorDetected(MSGERROR_CANCEL, 1);
}
else {
if (m_dwFlagsEx & MWF_EX_WARNCLOSE)
@@ -3238,7 +3063,7 @@ quote_from_last: return 0;
case DM_CHECKINFOTIP:
- m_Panel->hideTip(reinterpret_cast<HWND>(lParam));
+ m_pPanel->hideTip(reinterpret_cast<HWND>(lParam));
return 0;
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 40224c9339..9fad359f45 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -249,7 +249,7 @@ void CTabBaseDlg::CalcDynamicAvatarSize(BITMAP *bminfo) int CTabBaseDlg::MsgWindowUpdateMenu(HMENU submenu, int menuID)
{
- bool bInfoPanel = m_Panel->isActive();
+ bool bInfoPanel = m_pPanel->isActive();
if (menuID == MENU_TABCONTEXT) {
EnableMenuItem(submenu, ID_TABMENU_LEAVECHATROOM, (m_bType == SESSIONTYPE_CHAT && ProtoServiceExists(m_szProto, PS_LEAVECHAT)) ? MF_ENABLED : MF_DISABLED);
@@ -358,7 +358,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) break;
case ID_PICMENU_SAVETHISPICTUREAS:
- if (m_Panel->isActive())
+ if (m_pPanel->isActive())
SaveAvatarToFile(this, m_hOwnPic, 1);
else if (m_ace)
SaveAvatarToFile(this, m_ace->hbmPic, 0);
@@ -373,7 +373,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) if (menuId == MENU_PANELPICMENU)
CallService(MS_AV_CONTACTOPTIONS, m_hContact, 0);
else if (menuId == MENU_PICMENU) {
- if (m_Panel->isActive()) {
+ if (m_pPanel->isActive()) {
if (ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(m_cache->getActiveProto()), 0))
CallService(MS_AV_SETMYAVATARW, (WPARAM)(m_cache->getActiveProto()), 0);
}
@@ -513,7 +513,7 @@ void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam) dat->GetAvatarVisibility();
dat->ShowPicture(true);
- if (dat->m_Panel->isActive())
+ if (dat->m_pPanel->isActive())
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
}
@@ -531,7 +531,7 @@ bool CTabBaseDlg::GetAvatarVisibility() // infopanel visible, consider own avatar display
m_bShowAvatar = false;
- if (m_Panel->isActive() && bAvatarMode != 3) {
+ if (m_pPanel->isActive() && bAvatarMode != 3) {
if (!bOwnAvatarMode) {
m_bShowAvatar = (m_hOwnPic && m_hOwnPic != PluginConfig.g_hbmUnknown);
if (!m_hwndContactPic)
@@ -681,7 +681,7 @@ void CTabBaseDlg::AdjustBottomAvatarDisplay() {
GetAvatarVisibility();
- bool bInfoPanel = m_Panel->isActive();
+ bool bInfoPanel = m_pPanel->isActive();
HBITMAP hbm = (bInfoPanel && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown);
if (hbm) {
if (m_dynaSplitter == 0 || m_splitterY == 0)
@@ -700,11 +700,11 @@ void CTabBaseDlg::AdjustBottomAvatarDisplay() void CTabBaseDlg::ShowPicture(bool showNewPic)
{
- if (!m_Panel->isActive())
+ if (!m_pPanel->isActive())
m_pic.cy = m_pic.cx = DPISCALEY_S(60);
if (showNewPic) {
- if (m_Panel->isActive() && m_pContainer->avatarMode != 3) {
+ if (m_pPanel->isActive() && m_pContainer->avatarMode != 3) {
if (!m_hwndPanelPic) {
InvalidateRect(m_hwnd, NULL, TRUE);
UpdateWindow(m_hwnd);
@@ -1306,11 +1306,11 @@ void CTabBaseDlg::LoadContactAvatar() AdjustBottomAvatarDisplay();
CalcDynamicAvatarSize(&bm);
- if (!m_Panel->isActive() || m_pContainer->avatarMode == 3) {
+ if (!m_pPanel->isActive() || m_pContainer->avatarMode == 3) {
m_iRealAvatarHeight = 0;
PostMessage(m_hwnd, WM_SIZE, 0, 0);
}
- else if (m_Panel->isActive())
+ else if (m_pPanel->isActive())
GetAvatarVisibility();
}
@@ -1326,7 +1326,7 @@ void CTabBaseDlg::LoadOwnAvatar() else
m_hOwnPic = PluginConfig.g_hbmUnknown;
- if (m_Panel->isActive() && m_pContainer->avatarMode != 3) {
+ if (m_pPanel->isActive() && m_pContainer->avatarMode != 3) {
BITMAP bm;
m_iRealAvatarHeight = 0;
@@ -1407,7 +1407,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) }
HBITMAP hbmAvatar = m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown;
- if ((dis->hwndItem == GetDlgItem(m_hwnd, IDC_CONTACTPIC) && m_bShowAvatar) || (dis->hwndItem == m_hwnd && m_Panel->isActive())) {
+ if ((dis->hwndItem == GetDlgItem(m_hwnd, IDC_CONTACTPIC) && m_bShowAvatar) || (dis->hwndItem == m_hwnd && m_pPanel->isActive())) {
if (hbmAvatar == NULL)
return TRUE;
@@ -1542,7 +1542,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) return TRUE;
}
- if (dis->CtlType == ODT_MENU && m_Panel->isHovered()) {
+ if (dis->CtlType == ODT_MENU && m_pPanel->isHovered()) {
DrawMenuItem(dis, (HICON)dis->itemData, 0);
return TRUE;
}
@@ -1712,7 +1712,7 @@ void CTabBaseDlg::KbdState(bool &isShift, bool &isControl, bool &isAlt) void CTabBaseDlg::DetermineMinHeight()
{
RECT rc;
- LONG height = (m_Panel->isActive() ? m_Panel->getHeight() + 2 : 0);
+ LONG height = (m_pPanel->isActive() ? m_pPanel->getHeight() + 2 : 0);
if (!(m_pContainer->dwFlags & CNT_HIDETOOLBAR))
height += DPISCALEY_S(24); // toolbar
GetClientRect(m_message.GetHwnd(), &rc);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 336fe4687b..979fab9ca3 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;
- CSrmmWindow *dlgDat;
+ CTabBaseDlg *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, CSrmmWindow *dat)
+static void Build_RTF_Header(CMStringA &str, CTabBaseDlg *dat)
{
int i;
LOGFONTA *logFonts = dat->m_pContainer->theme.logFonts;
@@ -381,14 +381,14 @@ static void Build_RTF_Header(CMStringA &str, CSrmmWindow *dat) }
// mir_free() the return value
-static char* CreateRTFHeader(CSrmmWindow *dat)
+static char* CreateRTFHeader(CTabBaseDlg *dat)
{
CMStringA str;
Build_RTF_Header(str, dat);
return str.Detach();
}
-static void AppendTimeStamp(wchar_t *szFinalTimestamp, int isSent, CMStringA &str, int skipFont, CSrmmWindow *dat, int iFontIDOffset)
+static void AppendTimeStamp(wchar_t *szFinalTimestamp, int isSent, CMStringA &str, int skipFont, CTabBaseDlg *dat, int iFontIDOffset)
{
if (skipFont)
AppendUnicodeToBuffer(str, szFinalTimestamp, MAKELONG(isSent, dat->m_bIsHistory));
@@ -443,7 +443,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && (et->flags & DETF_MSGWINDOW);
}
-static char* Template_CreateRTFFromDbEvent(CSrmmWindow *dat, MCONTACT hContact, MEVENT hDbEvent, LogStreamData *streamData)
+static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *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(CSrmmWindow *dat)
+static void SetupLogFormatting(CTabBaseDlg *dat)
{
if (dat->m_hHistoryEvents)
strncpy_s(dat->m_szMicroLf, "\\v\\cf%d \\ ~-+%d+-~\\v0 ", _TRUNCATE);
@@ -1082,7 +1082,7 @@ static void SetupLogFormatting(CSrmmWindow *dat) mir_snprintf(dat->m_szMicroLf, "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT));
}
-static void ReplaceIcons(HWND hwndDlg, CSrmmWindow *dat, LONG startAt, int fAppend, BOOL isSent)
+static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppend, BOOL isSent)
{
wchar_t trbuffer[40];
TEXTRANGE tr;
@@ -1204,7 +1204,7 @@ static void ReplaceIcons(HWND hwndDlg, CSrmmWindow *dat, LONG startAt, int fAppe }
}
-void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s)
+void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s)
{
CHARRANGE oldSel, sel;
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 2da1362a08..e6063362da 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1665,6 +1665,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, case DM_SETPARENTDIALOG:
hwndParent = (HWND)lParam;
break;
+
case DM_GETSTATUSMASK:
if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYS))
dwNewStatusMask = -1;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 12d28e1498..a546c7a84e 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -133,6 +133,148 @@ CTabBaseDlg::CTabBaseDlg(TNewWindowData *pData, int iResource) m_forceResizable = true;
}
+INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case DM_SETINFOPANEL: // broadcasted when global info panel setting changes
+ if (wParam == 0 && lParam == 0) {
+ m_pPanel->getVisibility();
+ m_pPanel->loadHeight();
+ m_pPanel->showHide();
+ }
+ else {
+ CTabBaseDlg *srcDat = (CTabBaseDlg*)wParam;
+ if (lParam == 0)
+ m_pPanel->loadHeight();
+ else {
+ if (srcDat && lParam && this != srcDat && !m_pPanel->isPrivateHeight()) {
+ if (srcDat->m_bType != m_bType && M.GetByte("syncAllPanels", 0) == 0)
+ return 0;
+
+ if (m_pContainer->settings->fPrivate && srcDat->m_pContainer != m_pContainer)
+ return 0;
+
+ m_pPanel->setHeight((LONG)lParam);
+ }
+ }
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ }
+ return 0;
+
+ case DM_ACTIVATEME: // the child window will activate itself
+ ActivateExistingTab(m_pContainer, m_hwnd);
+ return 0;
+
+ case DM_SETLOCALE:
+ if (m_dwFlags & MWF_WASBACKGROUNDCREATE)
+ break;
+ if (m_pContainer->hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && m_pContainer->hwnd == GetForegroundWindow() && m_pContainer->hwnd == GetActiveWindow()) {
+ if (lParam)
+ m_hkl = (HKL)lParam;
+
+ if (m_hkl)
+ ActivateKeyboardLayout(m_hkl, 0);
+ }
+ return 0;
+
+ case DM_QUERYCONTAINER: // container API support functions
+ if (lParam)
+ *(TContainerData**)lParam = m_pContainer;
+ return 0;
+
+ case DM_QUERYHCONTACT:
+ if (lParam)
+ *(MCONTACT*)lParam = m_hContact;
+ return 0;
+
+ case DM_CHECKSIZE:
+ m_dwFlags |= MWF_NEEDCHECKSIZE;
+ return 0;
+
+ case DM_CONTAINERSELECTED:
+ // sent by the select container dialog box when a container was selected...
+ // lParam = (wchar_t*)selected name...
+ {
+ wchar_t *szNewName = (wchar_t*)lParam;
+ if (!mir_wstrcmp(szNewName, TranslateT("Default container")))
+ szNewName = CGlobals::m_default_container_name;
+
+ int iOldItems = TabCtrl_GetItemCount(m_hwndParent);
+ if (!wcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
+ break;
+
+ TContainerData *pNewContainer = FindContainerByName(szNewName);
+ if (pNewContainer == NULL)
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == NULL)
+ break;
+
+ db_set_ws(m_hContact, SRMSGMOD_T, "containerW", szNewName);
+ m_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);
+ SetForegroundWindow(pNewContainer->hwnd);
+ SetActiveWindow(pNewContainer->hwnd);
+ }
+ return 0;
+
+ case DM_ACTIVATETOOLTIP:
+ // 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
+ if (!IsIconic(m_pContainer->hwnd) && m_pContainer->hwndActive == m_hwnd)
+ m_pPanel->showTip(wParam, lParam);
+ return 0;
+
+ case DM_STATUSBARCHANGED:
+ UpdateStatusBar();
+ break;
+
+ case DM_CHECKAUTOHIDE:
+ // This is broadcasted by the container to all child windows to check if the
+ // container can be autohidden or -closed.
+ //
+ // wParam is the autohide timeout (in seconds)
+ // lParam points to a BOOL and a session which wants to prevent auto-hiding
+ // the container must set it to FALSE.
+ //
+ // If no session in the container disagrees, the container will be hidden.
+
+ if (lParam) {
+ BOOL *fResult = (BOOL*)lParam;
+ // text entered in the input area -> prevent autohide/cose
+ if (GetWindowTextLength(m_message.GetHwnd()) > 0)
+ *fResult = FALSE;
+ // unread events, do not hide or close the container
+ else if (m_dwUnread)
+ *fResult = FALSE;
+ // time since last activity did not yet reach the threshold.
+ else if (((GetTickCount() - m_dwLastActivity) / 1000) <= wParam)
+ *fResult = FALSE;
+ }
+ return 0;
+
+ case DM_GETWINDOWSTATE:
+ {
+ UINT state = MSG_WINDOW_STATE_EXISTS;
+ if (IsWindowVisible(m_hwnd))
+ state |= MSG_WINDOW_STATE_VISIBLE;
+ if (GetForegroundWindow() == m_pContainer->hwnd)
+ state |= MSG_WINDOW_STATE_FOCUS;
+ if (IsIconic(m_pContainer->hwnd))
+ state |= MSG_WINDOW_STATE_ICONIC;
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state);
+ }
+ return true;
+
+ case DM_SPLITTERGLOBALEVENT:
+ DM_SplitterGlobalEvent(wParam, lParam);
+ return 0;
+ }
+
+ return CSrmmBaseDialog::DlgProc(msg, wParam, lParam);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// service function. Sets a status bar text for a contact
@@ -165,7 +307,7 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) if (hwnd = M.FindWindow(hContact))
SetStatusTextWorker((CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
}
- else SetStatusTextWorker(si->dat, (StatusTextData*)lParam);
+ else SetStatusTextWorker((CTabBaseDlg*)si->dat, (StatusTextData*)lParam);
return 0;
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index ef7d394969..74c61465a5 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -256,9 +256,10 @@ protected: CCtrlEdit m_log, m_message;
TNewWindowData *newData;
+ void DM_AddDivider();
void DM_DismissTip(const POINT& pt);
+ void DM_ErrorDetected(int type, int flag);
bool DM_GenericHotkeysCheck(MSG *message);
- void DM_SaveLogAsRTF() const;
int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam);
void DM_UpdateLastMessage() const;
void DM_UpdateTitle(WPARAM wParam, LPARAM lParam);
@@ -357,7 +358,7 @@ public: bool m_fEditNotesActive;
bool m_bActualHistory;
- CInfoPanel *m_Panel;
+ CInfoPanel *m_pPanel;
CContactCache *m_cache;
AVATARCACHEENTRY *m_ace, *m_ownAce;
CProxyWindow *m_pWnd; // proxy window object (win7+, for taskbar support).
@@ -373,8 +374,13 @@ public: char *m_enteredText;
public:
+ __forceinline void* operator new(size_t size) { return calloc(1, size); }
+ __forceinline void operator delete(void* p) { free(p); }
+
CTabBaseDlg(TNewWindowData*, int);
+ virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+
virtual CThumbBase* CreateThumb(CProxyWindow*) const = 0;
virtual void ClearLog() = 0;
@@ -386,6 +392,7 @@ public: void DM_NotifyTyping(int mode);
void DM_RecalcPictureSize();
void DM_SaveLocale(WPARAM wParam, LPARAM lParam);
+ void DM_SaveLogAsRTF() const;
void DM_ScrollToBottom(WPARAM wParam, LPARAM lParam);
void DM_Typing(bool fForceOff);
@@ -393,7 +400,6 @@ public: LRESULT DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam);
void DM_HandleAutoSizeRequest(REQRESIZE* rr);
- void DM_CheckAutoHide(WPARAM wParam, LPARAM lParam) const;
void DM_FreeTheme();
void DM_ThemeChanged();
@@ -434,6 +440,7 @@ public: void SendNudge() const;
void SetMessageLog();
void ShowPicture(bool showNewPic);
+ void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s);
void UpdateReadChars() const;
void UpdateStatusBar() const;
@@ -445,13 +452,13 @@ public: void UpdateToolbarBG();
};
-class CSrmmWindow : public CTabBaseDlg, public MZeroedObject
+class CSrmmWindow : public CTabBaseDlg
{
virtual CThumbBase* CreateThumb(CProxyWindow *pProxy) const override;
virtual void ClearLog() override;
- void DM_OptionsApplied(WPARAM wParam, LPARAM lParam);
void MsgWindowUpdateState(UINT msg);
+ void ReplayQueue();
public:
int msgTop, rcLogBottom;
@@ -466,12 +473,14 @@ public: virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
- void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s);
+ void DM_OptionsApplied(WPARAM wParam, LPARAM lParam);
};
-class CChatRoomDlg : public CTabBaseDlg, public MZeroedObject
+class CChatRoomDlg : public CTabBaseDlg
{
bool m_bWasDeleted;
+ CCtrlButton m_btnFilter, m_btnHistory, m_btnOk;
+ CCtrlButton m_btnBold, m_btnItalic, m_btnUnderline, m_btnColor, m_btnBkColor;
virtual CThumbBase* CreateThumb(CProxyWindow *pProxy) const override;
virtual void ClearLog() override;
@@ -486,6 +495,14 @@ public: virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ void OnClick_Filter(CCtrlButton*);
+ void OnClick_History(CCtrlButton*);
+ void OnClick_BIU(CCtrlButton*);
+ void OnClick_OK(CCtrlButton*);
+ void OnClick_Color(CCtrlButton*);
+ void OnClick_BkColor(CCtrlButton*);
+ void OnChange_Message(CCtrlEdit*);
+
void StreamInEvents(LOGINFO* lin, SESSION_INFO *si, bool bRedraw);
void UpdateWindowState(UINT msg);
};
@@ -638,8 +655,6 @@ struct TIconDescW #define DM_OPTIONSAPPLIED (TM_USER+14)
#define DM_SPLITTERMOVED (TM_USER+15)
#define DM_UPDATETITLE (TM_USER+16)
-#define DM_APPENDTOLOG (TM_USER+17)
-#define DM_ERRORDECIDED (TM_USER+18)
#define DM_SPLITSENDACK (TM_USER+19)
#define DM_TYPING (TM_USER+20)
#define DM_UPDATEWINICON (TM_USER+21)
@@ -649,13 +664,11 @@ struct TIconDescW #define DM_CLOSETABATMOUSE (TM_USER+24)
#define DM_STATUSICONCHANGE (TM_USER+25)
#define DM_SETLOCALE (TM_USER+26)
-#define DM_SESSIONLIST (TM_USER+27)
#define DM_QUERYLASTUNREAD (TM_USER+28)
#define DM_QUERYPENDING (TM_USER+29)
#define DM_UPDATEPICLAYOUT (TM_USER+30)
#define DM_QUERYCONTAINER (TM_USER+31)
#define DM_MUCFLASHWORKER (TM_USER+32)
-#define DM_INVALIDATEPANEL (TM_USER+33)
#define DM_APPENDMCEVENT (TM_USER+34)
#define DM_CHECKINFOTIP (TM_USER+35)
#define DM_SAVESIZE (TM_USER+36)
@@ -669,24 +682,15 @@ struct TIconDescW #define DM_QUERYCLIENTAREA (TM_USER+45)
#define DM_QUERYRECENT (TM_USER+47)
#define DM_ACTIVATEME (TM_USER+46)
-#define DM_SENDLATER_RESEND (TM_USER+49)
-#define DM_ADDDIVIDER (TM_USER+50)
#define DM_STATUSMASKSET (TM_USER+51)
-#define DM_CONTACTSETTINGCHANGED (TM_USER+52)
#define DM_UPDATESTATUSMSG (TM_USER+53)
-#define DM_PROTOACK (TM_USER+54)
#define DM_OWNNICKCHANGED (TM_USER+55)
#define DM_CONFIGURETOOLBAR (TM_USER+56)
#define DM_ACTIVATETOOLTIP (TM_USER+58)
#define DM_UINTOCLIPBOARD (TM_USER+59)
-#define DM_SENDMESSAGECOMMAND (TM_USER+61)
#define DM_FORCEDREMAKELOG (TM_USER+62)
#define DM_STATUSBARCHANGED (TM_USER+64)
-#define DM_SAVEMESSAGELOG (TM_USER+65)
-#define DM_CHECKAUTOCLOSE (TM_USER+66)
-#define DM_UPDATEMETACONTACTINFO (TM_USER+67)
#define DM_SETICON (TM_USER+68)
-#define DM_CLOSEIFMETA (TM_USER+69)
#define DM_CHECKQUEUEFORCLOSE (TM_USER+70)
#define DM_CHECKAUTOHIDE (TM_USER+71)
#define DM_SETPARENTDIALOG (TM_USER+72)
@@ -695,19 +699,13 @@ struct TIconDescW #define DM_REMOVECLISTEVENT (TM_USER+75)
#define DM_GETWINDOWSTATE (TM_USER+76)
#define DM_DOCREATETAB (TM_USER+77)
-#define DM_DELAYEDSCROLL (TM_USER+78)
-#define DM_REPLAYQUEUE (TM_USER+79)
#define DM_REFRESHTABINDEX (TM_USER+83)
#define DM_SMILEYOPTIONSCHANGED (TM_USER+85)
#define DM_MYAVATARCHANGED (TM_USER+86)
-#define DM_PRINTCLIENT (TM_USER+87)
#define DM_IEVIEWOPTIONSCHANGED (TM_USER+88)
#define DM_SPLITTERGLOBALEVENT (TM_USER+89)
-#define DM_DOCREATETAB_CHAT (TM_USER+90)
#define DM_CLIENTCHANGED (TM_USER+91)
-#define DM_PLAYINCOMINGSOUND (TM_USER+92)
#define DM_SENDMESSAGECOMMANDW (TM_USER+93)
-#define DM_REMOVEPOPUPS (TM_USER+94)
#define DM_LOGSTATUSCHANGE (TM_USER+98)
#define DM_SC_BUILDLIST (TM_USER+100)
#define DM_SC_INITDIALOG (TM_USER+101)
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 824d9eedc2..b88e1e9d9a 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -35,7 +35,7 @@ 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 CSrmmWindow *dat) const +int SendQueue::findNextFailed(const CTabBaseDlg *dat) const { if (dat) for (int i = 0; i < NR_SENDJOBS; i++) @@ -45,7 +45,7 @@ int SendQueue::findNextFailed(const CSrmmWindow *dat) const return -1; } -void SendQueue::handleError(CSrmmWindow *dat, const int iEntry) const +void SendQueue::handleError(CTabBaseDlg *dat, const int iEntry) const { if (!dat) return; @@ -63,7 +63,7 @@ void SendQueue::handleError(CSrmmWindow *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(CSrmmWindow *dat, size_t iLen, int dwFlags) +int SendQueue::addTo(CTabBaseDlg *dat, size_t iLen, int dwFlags) { int i; int iFound = NR_SENDJOBS; @@ -190,7 +190,7 @@ size_t SendQueue::getSendLength(const int iEntry) return p.iSendLength; } -int SendQueue::sendQueued(CSrmmWindow *dat, const int iEntry) +int SendQueue::sendQueued(CTabBaseDlg *dat, const int iEntry) { HWND hwndDlg = dat->GetHwnd(); CContactCache *ccActive = CContactCache::getContactCache(dat->m_hContact); @@ -321,15 +321,15 @@ 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 CSrmmWindow *dat) const +void SendQueue::checkQueue(const CTabBaseDlg *dat) const { if (dat) { HWND hwndDlg = dat->GetHwnd(); if (dat->m_iOpenJobs == 0) - ::HandleIconFeedback(const_cast<CSrmmWindow *>(dat), (HICON)INVALID_HANDLE_VALUE); + ::HandleIconFeedback(const_cast<CTabBaseDlg*>(dat), (HICON)INVALID_HANDLE_VALUE); else if (!(dat->m_sendMode & SMODE_NOACK)) - ::HandleIconFeedback(const_cast<CSrmmWindow *>(dat), PluginConfig.g_IconSend); + ::HandleIconFeedback(const_cast<CTabBaseDlg*>(dat), PluginConfig.g_IconSend); if (dat->m_pContainer->hwndActive == hwndDlg) dat->UpdateReadChars(); @@ -340,7 +340,7 @@ void SendQueue::checkQueue(const CSrmmWindow *dat) const // logs an error message to the message window.Optionally, appends the original message // from the given sendJob (queue index) -void SendQueue::logError(CSrmmWindow *dat, int iSendJobIndex, const wchar_t *szErrMsg) const +void SendQueue::logError(CTabBaseDlg *dat, int iSendJobIndex, const wchar_t *szErrMsg) const { if (dat == 0) return; @@ -370,7 +370,7 @@ void SendQueue::logError(CSrmmWindow *dat, int iSendJobIndex, const wchar_t *szE // ) multisend contact list instance // ) send button -void SendQueue::EnableSending(const CSrmmWindow *dat, bool bMode) +void SendQueue::EnableSending(const CTabBaseDlg *dat, bool bMode) { if (dat) { HWND hwndDlg = dat->GetHwnd(); @@ -383,7 +383,7 @@ void SendQueue::EnableSending(const CSrmmWindow *dat, bool bMode) ///////////////////////////////////////////////////////////////////////////////////////// // show or hide the error control button bar on top of the window -void SendQueue::showErrorControls(CSrmmWindow *dat, const int showCmd) const +void SendQueue::showErrorControls(CTabBaseDlg *dat, const int showCmd) const { UINT myerrorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER }; HWND hwndDlg = dat->GetHwnd(); @@ -411,7 +411,7 @@ void SendQueue::showErrorControls(CSrmmWindow *dat, const int showCmd) const EnableSending(dat, TRUE); } -void SendQueue::recallFailed(const CSrmmWindow *dat, int iEntry) const +void SendQueue::recallFailed(const CTabBaseDlg *dat, int iEntry) const { if (dat == NULL) return; @@ -424,11 +424,11 @@ void SendQueue::recallFailed(const CSrmmWindow *dat, int iEntry) const // message area is empty, so we can recall the failed message... SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer); - UpdateSaveAndSendButton(const_cast<CSrmmWindow *>(dat)); + UpdateSaveAndSendButton(const_cast<CTabBaseDlg *>(dat)); SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_SETSEL, (WPARAM)-1, (LPARAM)-1); } -void SendQueue::UpdateSaveAndSendButton(CSrmmWindow *dat) +void SendQueue::UpdateSaveAndSendButton(CTabBaseDlg *dat) { if (dat) { HWND hwndDlg = dat->GetHwnd(); @@ -459,7 +459,7 @@ void SendQueue::UpdateSaveAndSendButton(CSrmmWindow *dat) } } -void SendQueue::NotifyDeliveryFailure(const CSrmmWindow *dat) +void SendQueue::NotifyDeliveryFailure(const CTabBaseDlg *dat) { if (M.GetByte("adv_noErrorPopups", 0)) return; @@ -507,7 +507,7 @@ int SendQueue::RTL_Detect(const WCHAR *pszwText) return(n >= 2 ? 1 : 0); } -int SendQueue::ackMessage(CSrmmWindow *dat, WPARAM wParam, LPARAM lParam) +int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) { ACKDATA *ack = (ACKDATA *)lParam; @@ -631,7 +631,7 @@ LRESULT SendQueue::WarnPendingJobs(unsigned int) // // @return the index on success, -1 on failure -int SendQueue::doSendLater(int iJobIndex, CSrmmWindow *dat, MCONTACT hContact, bool fIsSendLater) +int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, bool fIsSendLater) { bool fAvail = sendLater->isAvail(); diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index db914f214c..04afa5d41e 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 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);
+ int findNextFailed(const CTabBaseDlg *dat) const;
+ void handleError(CTabBaseDlg *dat, const int iEntry) const;
+ int addTo(CTabBaseDlg *dat, size_t iLen, int dwFlags);
+ int sendQueued(CTabBaseDlg *dat, const int iEntry);
size_t getSendLength(const int iEntry);
- 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);
+ void checkQueue(const CTabBaseDlg *dat) const;
+ void logError(CTabBaseDlg *dat, int iSendJobIndex, const wchar_t *szErrMsg) const;
+ void recallFailed(const CTabBaseDlg *dat, int iEntry) const;
+ void showErrorControls(CTabBaseDlg *dat, const int showCmd) const;
+ int ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam);
+ int doSendLater(int iIndex, CTabBaseDlg *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 CSrmmWindow *dat);
- static void TSAPI UpdateSaveAndSendButton(CSrmmWindow *dat);
- static void TSAPI EnableSending(const CSrmmWindow *dat, bool bMode);
+ static void TSAPI NotifyDeliveryFailure(const CTabBaseDlg *dat);
+ static void TSAPI UpdateSaveAndSendButton(CTabBaseDlg *dat);
+ static void TSAPI EnableSending(const CTabBaseDlg *dat, bool bMode);
private:
SendJob m_jobs[NR_SENDJOBS];
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 647d4ddf80..55676f6cdf 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -333,7 +333,7 @@ int CSideBarButton::testCloseButton() const void CSideBarButton::activateSession() const
{
if (m_dat)
- ::SendMessage(m_dat->GetHwnd(), DM_ACTIVATEME, 0, 0); // the child window will activate itself
+ ::SendMessage(m_dat->GetHwnd(), DM_ACTIVATEME, 0, 0);
}
// show the context menu (same as on tabs
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 893ba28a8e..e6f1409721 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -487,7 +487,7 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP fShouldHide = false;
else
ShowWindow(dat->m_pContainer->hwnd, SW_HIDE);
- SendMessage(hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ dat->DM_OptionsApplied(0, 0);
SendMessage(hwnd, DM_DEFERREDREMAKELOG, (WPARAM)hwnd, 0);
if (fShouldHide)
ShowWindow(dat->m_pContainer->hwnd, SW_SHOWNORMAL);
|