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 /src/mir_app | |
parent | 429859059db4093bf95dbe2695e205025dd7b3a7 (diff) |
nick list moved to mir_app
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
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) |