diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-22 19:47:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-22 19:47:48 +0300 |
commit | 45eed63e9c7a99c9c88e6a98678c0098a06de27a (patch) | |
tree | ab46a406a0c4e85c0baa721e76ce005f41a2fee5 | |
parent | 429859059db4093bf95dbe2695e205025dd7b3a7 (diff) |
nick list moved to mir_app
-rw-r--r-- | include/chat_resource.h | 34 | ||||
-rw-r--r-- | include/m_chat_int.h | 14 | ||||
-rw-r--r-- | plugins/Scriver/res/resource.rc | 3 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_main.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 34 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 3 | ||||
-rw-r--r-- | plugins/Scriver/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/res/chat.rc | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/buttonsbar.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_resource.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 54 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 3 | ||||
-rw-r--r-- | src/core/stdmsg/res/resource.rc | 5 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_manager.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 34 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/resource.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 4 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 35 |
23 files changed, 109 insertions, 140 deletions
diff --git a/include/chat_resource.h b/include/chat_resource.h new file mode 100644 index 0000000000..60e340c9c1 --- /dev/null +++ b/include/chat_resource.h @@ -0,0 +1,34 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (?) 2012-17 Miranda NG project (http://miranda-ng.org) +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#define IDC_SRMM_COLOR 3001 +#define IDC_SRMM_BKGCOLOR 3002 +#define IDC_SRMM_BOLD 3003 +#define IDC_SRMM_ITALICS 3004 +#define IDC_SRMM_UNDERLINE 3005 +#define IDC_SRMM_FILTER 3006 +#define IDC_SRMM_CHANMGR 3007 +#define IDC_SRMM_SHOWNICKLIST 3008 +#define IDC_SRMM_HISTORY 3009 +#define IDC_SRMM_NICKLIST 3010 diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 47200cdc94..a43327e6a0 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -209,6 +209,7 @@ struct GlobalLogSettingsBase bool bTimeStampEventColour;
bool bShowContactStatus;
bool bContactStatusFirst;
+ bool bDoubleClick4Privat; // send a private message on dblclick in a nick list
DWORD dwIconFlags;
DWORD dwTrayIconFlags;
DWORD dwPopupFlags;
@@ -386,15 +387,7 @@ EXTERN_C MIR_APP_DLL(void) Chat_UpdateOptions(); /////////////////////////////////////////////////////////////////////////////////////////
-#define IDC_SRMM_COLOR 3001
-#define IDC_SRMM_BKGCOLOR 3002
-#define IDC_SRMM_BOLD 3003
-#define IDC_SRMM_ITALICS 3004
-#define IDC_SRMM_UNDERLINE 3005
-#define IDC_SRMM_FILTER 3006
-#define IDC_SRMM_CHANMGR 3007
-#define IDC_SRMM_NICKLIST 3008
-#define IDC_SRMM_HISTORY 3009
+#include <chat_resource.h>
class MIR_APP_EXPORT CSrmmBaseDialog : public CDlgBase
{
@@ -416,6 +409,7 @@ protected: SESSION_INFO *m_si;
COLORREF m_clrInputBG, m_clrInputFG;
+ CCtrlListBox m_nickList;
CCtrlButton m_btnColor, m_btnBkColor;
CCtrlButton m_btnBold, m_btnItalic, m_btnUnderline;
CCtrlButton m_btnHistory, m_btnChannelMgr, m_btnNickList, m_btnFilter;
@@ -427,6 +421,8 @@ protected: void onClick_ChanMgr(CCtrlButton*);
void onClick_History(CCtrlButton*);
+ void onDblClick_List(CCtrlListBox*);
+
public:
MCONTACT m_hContact;
int m_iLogFilterFlags;
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index 1b2e4a6de6..97fc4a8d18 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -1,6 +1,7 @@ // Microsoft Visual C++ generated resource script.
//
#include "..\src\resource.h"
+#include "..\..\include\chat_resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -229,7 +230,7 @@ BEGIN CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,23,164,73,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
- LISTBOX IDC_CHAT_LIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
+ LISTBOX IDC_SRMM_NICKLIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END
IDD_FILTER DIALOGEX 0, 0, 83, 125
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp index f4b4755e56..5d0cb3b0e3 100644 --- a/plugins/Scriver/src/chat_main.cpp +++ b/plugins/Scriver/src/chat_main.cpp @@ -51,7 +51,7 @@ void LoadModuleIcons(MODULEINFO *mi) static void OnReplaceSession(SESSION_INFO *si)
{
if (si->pDlg)
- RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_CHAT_LIST), nullptr, nullptr, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), nullptr, nullptr, RDW_INVALIDATE);
}
static void OnNewUser(SESSION_INFO *si, USERINFO*)
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index 6c43be27ca..12ff411673 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -176,7 +176,7 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w else dat->lastEnterTime = 0;
if (wParam == VK_TAB && isShift && !isCtrl) { // SHIFT-TAB (go to nick list)
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_LIST));
+ SetFocus(pDlg->m_nickList.GetHwnd());
return TRUE;
}
@@ -747,7 +747,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
- m_nickList(this, IDC_CHAT_LIST),
m_splitterX(this, IDC_SPLITTERX),
m_splitterY(this, IDC_SPLITTERY),
@@ -761,8 +760,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::onClick_Filter);
m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowList);
- m_nickList.OnDblClick = Callback(this, &CChatRoomDlg::onDblClick_List);
-
m_message.OnChange = Callback(this, &CChatRoomDlg::onChange_Message);
m_splitterX.OnChange = Callback(this, &CChatRoomDlg::OnSplitterX);
@@ -877,33 +874,6 @@ void CChatRoomDlg::OnSplitterY(CSplitter *pSplitter) m_pParent->iSplitterY = rc.bottom - pSplitter->GetPos();
}
-void CChatRoomDlg::onDblClick_List(CCtrlListBox*)
-{
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(m_nickList.GetHwnd(), &hti.pt);
-
- int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui) {
- if (GetKeyState(VK_SHIFT) & 0x8000) {
- LRESULT lResult = (LRESULT)m_message.SendMsg(EM_GETSEL, 0, 0);
- int start = LOWORD(lResult);
- size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 4);
- wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
- if (start == 0)
- mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
- else
- mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
-
- m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)pszName);
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- }
- else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
- }
-}
-
void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
{
if (!pButton->Enabled())
@@ -1244,7 +1214,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (dis->CtlType == ODT_MENU)
return Menu_DrawItem(lParam);
- if (dis->CtlID == IDC_CHAT_LIST) {
+ if (dis->CtlID == IDC_SRMM_NICKLIST) {
int index = dis->itemID;
USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
if (ui) {
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 3be8670a67..c2ef1ab5c5 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -527,7 +527,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_SRMM_NICKLIST;
+ bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST;
bbd.dwDefPos = 20;
bbd.hIcon = IcoLib_GetIconHandle("chat_nicklist");
bbd.pwszText = LPGENW("&Show/hide nick list");
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index d742939075..a160e2c654 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -179,7 +179,6 @@ class CChatRoomDlg : public CScriverWindow {
CCtrlEdit m_message, m_log;
CCtrlButton m_btnOk;
- CCtrlListBox m_nickList;
CSplitter m_splitterX, m_splitterY;
void MessageDialogResize(int w, int h);
@@ -215,8 +214,6 @@ public: void onClick_Filter(CCtrlButton*);
void onClick_ShowList(CCtrlButton*);
- void onDblClick_List(CCtrlListBox*);
-
void OnSplitterX(CSplitter*);
void OnSplitterY(CSplitter*);
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index cd2b9afb0a..71f80fb75d 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -196,7 +196,6 @@ #define IDC_CHAT_TEXTO 5069
#define IDC_CHAT_LOGGING 5069
#define IDC_CHAT_COLORTEXT 5070
-#define IDC_CHAT_LIST 5072
#define IDC_CHAT_1 5075
#define IDC_CHAT_2 5076
#define IDC_CHAT_3 5077
diff --git a/plugins/TabSRMM/res/chat.rc b/plugins/TabSRMM/res/chat.rc index 87e0f3685f..5f0631b371 100644 --- a/plugins/TabSRMM/res/chat.rc +++ b/plugins/TabSRMM/res/chat.rc @@ -2,6 +2,7 @@ //
#include "..\src\chat_resource.h"
#include "..\src\resource.h"
+#include "..\..\include\chat_resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -33,7 +34,7 @@ BEGIN CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,132,251,6
CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,128,127,12,WS_EX_STATICEDGE
CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | 0x844,8,23,164,72,WS_EX_STATICEDGE
- LISTBOX IDC_LIST,182,23,69,73,LBS_MULTIPLESEL | LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
+ LISTBOX IDC_SRMM_NICKLIST,182,23,69,73,LBS_MULTIPLESEL | LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
CONTROL "",IDC_PANELSPLITTER,"Static",SS_ENHMETAFILE,0,32,252,1,WS_EX_TRANSPARENT
END
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 5531463a5a..742accd73e 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -119,7 +119,7 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) Srmm_AddButton(&bbd); bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID; - bbd.dwButtonID = IDC_SRMM_NICKLIST; + bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST; bbd.dwDefPos = 22; bbd.hIcon = PluginConfig.g_buttonBarIconHandles[19]; bbd.pwszTooltip = LPGENW("Toggle nick list"); diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h index 6e4df0f2b5..e9947ed8b3 100644 --- a/plugins/TabSRMM/src/chat.h +++ b/plugins/TabSRMM/src/chat.h @@ -72,7 +72,7 @@ struct TMUCSettings : public GlobalLogSettingsBase COLORREF nickColors[8];
HBRUSH SelectionBGBrush;
bool bOpenInDefault, bBBCodeInPopups;
- bool bDoubleClick4Privat, bShowContactStatus, bContactStatusFirst;
+ bool bShowContactStatus, bContactStatusFirst;
bool bLogClassicIndicators, bAlternativeSorting, bAnnoyingHighlight, bCreateWindowOnHighlight;
bool bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog;
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 3c0c487821..626c5aea5c 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -51,7 +51,7 @@ static void OnReplaceSession(SESSION_INFO *si) if (si->hContact)
Chat_SetFilters(si);
if (si->pDlg)
- RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_LIST), nullptr, nullptr, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), nullptr, nullptr, RDW_INVALIDATE);
}
static void OnSetTopic(SESSION_INFO *si)
diff --git a/plugins/TabSRMM/src/chat_resource.h b/plugins/TabSRMM/src/chat_resource.h index 2516ff30d4..1142bf12b6 100644 --- a/plugins/TabSRMM/src/chat_resource.h +++ b/plugins/TabSRMM/src/chat_resource.h @@ -37,7 +37,6 @@ #define IDC_LOGGING 1069
#define IDC_TEXTO2 1070
#define IDC_TEXTO3 1071
-#define IDC_LIST 1072
#define IDC_TEXTO4 1072
#define IDC_STATIC_ADD 1077
#define IDC_STATIC_ULIST 1078
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index c44124fda4..faa6d514f5 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -266,7 +266,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, SW_HIDE); if (m_si->iType != GCW_SERVER) { - Utils::showDlgControl(m_hwnd, IDC_LIST, m_bNicklistEnabled ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_SRMM_NICKLIST, m_bNicklistEnabled ? SW_SHOW : SW_HIDE); Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, m_bNicklistEnabled ? SW_SHOW : SW_HIDE); m_btnNickList.Enable(true); @@ -278,7 +278,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) } } else { - Utils::showDlgControl(m_hwnd, IDC_LIST, SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_SRMM_NICKLIST, SW_HIDE); Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, SW_HIDE); } @@ -314,7 +314,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) } return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - case IDC_LIST: + case IDC_SRMM_NICKLIST: urc->rcItem.top = 0; urc->rcItem.right = urc->dlgNewSize.cx; urc->rcItem.left = urc->dlgNewSize.cx - iSplitterX + 2; @@ -1378,8 +1378,7 @@ static void __cdecl phase2(void * lParam) CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : CTabBaseDlg(IDD_CHANNEL, si), - m_btnOk(this, IDOK), - m_list(this, IDC_LIST) + m_btnOk(this, IDOK) { m_szProto = GetContactProto(m_hContact); m_bFilterEnabled = db_get_b(m_hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled) != 0; @@ -1390,8 +1389,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowNickList); m_message.OnChange = Callback(this, &CChatRoomDlg::onChange_Message); - - m_list.OnDblClick = Callback(this, &CChatRoomDlg::onDblClick_List); } CThumbBase* CChatRoomDlg::tabCreateThumb(CProxyWindow *pProxy) const @@ -1470,7 +1467,7 @@ void CChatRoomDlg::OnInitDialog() mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), SplitterSubclassProc); mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERY), SplitterSubclassProc); - mir_subclassWindow(m_list.GetHwnd(), NicklistSubclassProc); + mir_subclassWindow(m_nickList.GetHwnd(), NicklistSubclassProc); mir_subclassWindow(m_log.GetHwnd(), LogSubclassProc); mir_subclassWindow(m_message.GetHwnd(), MessageSubclassProc); @@ -1650,33 +1647,6 @@ void CChatRoomDlg::onChange_Message(CCtrlEdit*) } } -void CChatRoomDlg::onDblClick_List(CCtrlListBox*) -{ - TVHITTESTINFO hti; - hti.pt.x = (short)LOWORD(GetMessagePos()); - hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(m_list.GetHwnd(), &hti.pt); - - int item = LOWORD(m_list.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); - USERINFO *ui = pci->UM_FindUserFromIndex(m_si->pUsers, item); - if (ui == nullptr) - return; - - bool bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; - if (g_Settings.bDoubleClick4Privat ? bShift : !bShift) { - int selStart = LOWORD(m_message.SendMsg(EM_GETSEL, 0, 0)); - CMStringW tszName(ui->pszNick); - if (selStart == 0) - tszName.AppendChar(':'); - tszName.AppendChar(' '); - - m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); - PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); - SetFocus(m_message.GetHwnd()); - } - else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0); -} - ///////////////////////////////////////////////////////////////////////////////////////// void CChatRoomDlg::AddLog() @@ -1787,9 +1757,9 @@ void CChatRoomDlg::ShowFilterMenu() void CChatRoomDlg::UpdateNickList() { - int i = m_list.SendMsg(LB_GETTOPINDEX, 0, 0); - m_list.SendMsg(LB_SETCOUNT, m_si->nUsersInNicklist, 0); - m_list.SendMsg(LB_SETTOPINDEX, i, 0); + int i = m_nickList.SendMsg(LB_GETTOPINDEX, 0, 0); + m_nickList.SendMsg(LB_SETCOUNT, m_si->nUsersInNicklist, 0); + m_nickList.SendMsg(LB_SETTOPINDEX, i, 0); UpdateTitle(); m_hTabIcon = m_hTabStatusIcon; } @@ -1811,8 +1781,8 @@ void CChatRoomDlg::UpdateOptions() DM_InitRichEdit(); m_btnOk.SendMsg(BUTTONSETASNORMAL, TRUE, 0); - m_list.SetItemHeight(0, g_Settings.iNickListFontHeight); - InvalidateRect(m_list.GetHwnd(), nullptr, TRUE); + m_nickList.SetItemHeight(0, g_Settings.iNickListFontHeight); + InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); @@ -2028,7 +1998,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return Menu_DrawItem(lParam); } - if (dis->CtlID == IDC_LIST) { + if (dis->CtlID == IDC_SRMM_NICKLIST) { int x_offset = 0; int index = dis->itemID; @@ -2550,7 +2520,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { HDC hdc = (HDC)wParam; UINT item_ids[3] = { ID_EXTBKUSERLIST, ID_EXTBKHISTORY, ID_EXTBKINPUTAREA }; - UINT ctl_ids[3] = { IDC_LIST, IDC_LOG, IDC_MESSAGE }; + UINT ctl_ids[3] = { IDC_SRMM_NICKLIST, IDC_LOG, IDC_MESSAGE }; HANDLE hbp = 0; HDC hdcMem = 0; HBITMAP hbm, hbmOld; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 7b1ebaedf1..091e13848b 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -880,9 +880,9 @@ LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) } if (isChat()) { // scroll nick list by just hovering it RECT rcNicklist; - GetWindowRect(GetDlgItem(m_hwnd, IDC_LIST), &rcNicklist); + GetWindowRect(m_nickList.GetHwnd(), &rcNicklist); if (PtInRect(&rcNicklist, pt)) { - SendDlgItemMessage(m_hwnd, IDC_LIST, WM_MOUSEWHEEL, wParam, lParam); + m_nickList.SendMsg(WM_MOUSEWHEEL, wParam, lParam); return 0; } } @@ -943,7 +943,7 @@ void CTabBaseDlg::DM_ThemeChanged() if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) { SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); if (isChat()) - SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); + SetWindowLongPtr(m_nickList.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_nickList.GetHwnd(), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); } if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 1bbefadf41..c2f7822141 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -484,7 +484,6 @@ class CChatRoomDlg : public CTabBaseDlg {
HWND m_hwndFilter;
CCtrlButton m_btnOk;
- CCtrlListBox m_list;
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -524,8 +523,6 @@ public: void onChange_Message(CCtrlEdit*);
- void onDblClick_List(CCtrlListBox*);
-
void UpdateWindowState(UINT msg);
};
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 1625e5163c..cab5c99329 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -1,6 +1,7 @@ // Microsoft Visual C++ generated resource script.
//
#include "..\src\resource.h"
+#include "..\..\include\chat_resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -202,7 +203,7 @@ BEGIN CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x2844,8,2,164,94,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
- LISTBOX IDC_LIST,182,2,69,94,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
+ LISTBOX IDC_SRMM_NICKLIST,182,2,69,94,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END
IDD_CHANNEL DIALOGEX 0, 0, 252, 140
@@ -214,7 +215,7 @@ BEGIN CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x2844,8,23,164,73,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
- LISTBOX IDC_LIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
+ LISTBOX IDC_SRMM_NICKLIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END
IDD_CONTAINER DIALOGEX 0, 0, 252, 140
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index dded4667bc..91d002492b 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -82,7 +82,7 @@ static void OnCreateModule(MODULEINFO *mi) static void OnReplaceSession(SESSION_INFO *si) { if (si->pDlg) - RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_LIST), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), NULL, NULL, RDW_INVALIDATE); } static void OnNewUser(SESSION_INFO *si, USERINFO*) diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index c2b527e629..a0fcc6a308 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -62,7 +62,7 @@ LBL_CalcBottom: urc->rcItem.bottom += 20; return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - case IDC_LIST: + case IDC_SRMM_NICKLIST: urc->rcItem.top = 2; urc->rcItem.right = urc->dlgNewSize.cx; urc->rcItem.left = urc->dlgNewSize.cx - m_iSplitterX + 2; @@ -179,7 +179,7 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w } if (wParam == VK_TAB && isShift && !isCtrl) { // SHIFT-TAB (go to nick list) - SetFocus(GetDlgItem(hwndDlg, IDC_LIST)); + SetFocus(pDlg->m_nickList.GetHwnd()); return TRUE; } @@ -501,7 +501,7 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa return(FALSE); } -static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK CChatRoomDlg::LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { CHARRANGE sel; @@ -621,7 +621,7 @@ LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM } else ScreenToClient(hwnd, &hti.pt); - int item = LOWORD(SendDlgItemMessage(GetParent(hwnd), IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); + int item = LOWORD(si->pDlg->m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, item); if (ui) { USERINFO uinew; @@ -684,7 +684,6 @@ static void __cdecl phase2(void *lParam) CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : CSrmmBaseDialog(g_hInst, g_Settings.bTabsEnable ? IDD_CHANNEL_TAB : IDD_CHANNEL, si), - m_nickList(this, IDC_LIST), m_message(this, IDC_MESSAGE), m_log(this, IDC_LOG), @@ -705,8 +704,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : m_btnChannelMgr.OnClick = Callback(this, &CChatRoomDlg::onClick_Options); m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_NickList); - m_nickList.OnDblClick = Callback(this, &CChatRoomDlg::onListDblclick); - m_splitterX.OnChange = Callback(this, &CChatRoomDlg::onSplitterX); m_splitterY.OnChange = Callback(this, &CChatRoomDlg::onSplitterY); @@ -852,27 +849,6 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) SetFocus(m_message.GetHwnd()); } -void CChatRoomDlg::onListDblclick(CCtrlListBox*) -{ - TVHITTESTINFO hti; - hti.pt.x = (short)LOWORD(GetMessagePos()); - hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(m_nickList.GetHwnd(), &hti.pt); - - int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); - USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item); - if (ui == nullptr) - return; - - if (GetKeyState(VK_SHIFT) & 0x8000) { - int start = LOWORD(m_message.SendMsg(EM_GETSEL, 0, 0)); - CMStringW buf(FORMAT, (start == 0) ? L"%s: " : L"%s ", ui->pszUID); - m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)buf.c_str()); - PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); - } - else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0); -} - void CChatRoomDlg::onSplitterX(CSplitter *pSplitter) { RECT rc; @@ -1246,7 +1222,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (dis->CtlType == ODT_MENU) return Menu_DrawItem(lParam); - if (dis->CtlID == IDC_LIST) { + if (dis->CtlID == IDC_SRMM_NICKLIST) { int index = dis->itemID; USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); if (ui) { diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 96e5600d9e..5e0c8e767d 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -359,7 +359,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_SRMM_NICKLIST;
+ bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST;
bbd.dwDefPos = 20;
bbd.hIcon = GetIconHandle("nicklist");
bbd.pwszText = LPGENW("&Show/hide nick list");
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index bd06f80531..af3f02dbc0 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -116,7 +116,6 @@ #define IDC_RADIO2 1068
#define IDC_RADIO3 1069
#define IDC_ADD 1070
-#define IDC_LIST 1072
#define IDC_TAB 1074
#define IDC_1 1075
#define IDC_2 1076
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 750bbefcf5..aee164620f 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -210,13 +210,13 @@ class CChatRoomDlg : public CSrmmBaseDialog friend struct CTabbedWindow;
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND m_hwndStatus;
CCtrlEdit m_message, m_log;
- CCtrlListBox m_nickList;
CCtrlButton m_btnOk;
CSplitter m_splitterX, m_splitterY;
@@ -255,8 +255,6 @@ public: void onClick_Options(CCtrlButton*);
void onClick_NickList(CCtrlButton*);
- void onListDblclick(CCtrlListBox*);
-
void onSplitterX(CSplitter*);
void onSplitterY(CSplitter*);
};
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index a527c3cbc4..fa37d7153f 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -30,9 +30,11 @@ extern HCURSOR g_hCurHyperlinkHand; CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si) : CDlgBase(hInst, idDialog), + m_nickList(this, IDC_SRMM_NICKLIST), + m_btnFilter(this, IDC_SRMM_FILTER), m_btnHistory(this, IDC_SRMM_HISTORY), - m_btnNickList(this, IDC_SRMM_NICKLIST), + m_btnNickList(this, IDC_SRMM_SHOWNICKLIST), m_btnChannelMgr(this, IDC_SRMM_CHANMGR), m_btnColor(this, IDC_SRMM_COLOR), @@ -59,6 +61,8 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si m_btnHistory.OnClick = Callback(this, &CSrmmBaseDialog::onClick_History); m_btnChannelMgr.OnClick = Callback(this, &CSrmmBaseDialog::onClick_ChanMgr); + m_nickList.OnDblClick = Callback(this, &CChatRoomDlg::onDblClick_List); + if (si) { m_hContact = si->hContact; @@ -78,7 +82,7 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si CSrmmBaseDialog::CSrmmBaseDialog(const CSrmmBaseDialog&) : CDlgBase(0, 0), - m_btnColor(0, 0), m_btnBkColor(0, 0), + m_btnColor(0, 0), m_btnBkColor(0, 0), m_nickList(0, 0), m_btnBold(0, 0), m_btnItalic(0, 0), m_btnUnderline(0, 0), m_btnFilter(0, 0), m_btnChannelMgr(0, 0), m_btnHistory(0, 0), m_btnNickList(0, 0) { @@ -338,6 +342,33 @@ void CSrmmBaseDialog::onClick_ChanMgr(CCtrlButton *pButton) DoEventHook(GC_USER_CHANMGR, nullptr, nullptr, 0); } +void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList) +{ + TVHITTESTINFO hti; + hti.pt.x = (short)LOWORD(GetMessagePos()); + hti.pt.y = (short)HIWORD(GetMessagePos()); + ScreenToClient(pList->GetHwnd(), &hti.pt); + + int item = LOWORD(pList->SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); + USERINFO *ui = chatApi.UM_FindUserFromIndex(m_si->pUsers, item); + if (ui == nullptr) + return; + + bool bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; + if (g_Settings->bDoubleClick4Privat ? bShift : !bShift) { + int selStart = LOWORD(m_pEntry->SendMsg(EM_GETSEL, 0, 0)); + CMStringW tszName(ui->pszNick); + if (selStart == 0) + tszName.AppendChar(':'); + tszName.AppendChar(' '); + + m_pEntry->SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); + SetFocus(m_pEntry->GetHwnd()); + } + else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0); +} + ///////////////////////////////////////////////////////////////////////////////////////// bool CSrmmBaseDialog::ProcessHotkeys(int key, bool isShift, bool isCtrl, bool isAlt) |