summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-22 19:47:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-22 19:47:48 +0300
commit45eed63e9c7a99c9c88e6a98678c0098a06de27a (patch)
treeab46a406a0c4e85c0baa721e76ce005f41a2fee5 /src
parent429859059db4093bf95dbe2695e205025dd7b3a7 (diff)
nick list moved to mir_app
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/res/resource.rc5
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp2
-rw-r--r--src/core/stdmsg/src/chat_window.cpp34
-rw-r--r--src/core/stdmsg/src/msgs.cpp2
-rw-r--r--src/core/stdmsg/src/resource.h1
-rw-r--r--src/core/stdmsg/src/stdafx.h4
-rw-r--r--src/mir_app/src/srmm_base.cpp35
7 files changed, 44 insertions, 39 deletions
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)