diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-09 12:26:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-09 12:26:25 +0300 |
commit | 12061fa56dbbd3b59d78c554f6b0208d656ce6cd (patch) | |
tree | 31e154fcb5ab89ce4c3975f985725021e81e13e5 /plugins/Scriver/src | |
parent | 941ff9f0edad23f8f81523b35b022d8bd5d5033a (diff) |
CSrmmBaseDialog::RefreshButtonStatus() is called now from the base class directly
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 112 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 124 |
2 files changed, 117 insertions, 119 deletions
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index b36284b504..b3ff9bea07 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -130,32 +130,6 @@ void CMsgDialog::FixTabIcons() /////////////////////////////////////////////////////////////////////////////////////////
-void CMsgDialog::onClick_ShowList(CCtrlButton *pButton)
-{
- if (!pButton->Enabled() || m_si->iType == GCW_SERVER)
- return;
-
- m_bNicklistEnabled = !m_bNicklistEnabled;
- pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2));
- ScrollToBottom();
- Resize();
-}
-
-void CMsgDialog::onClick_Filter(CCtrlButton *pButton)
-{
- if (!pButton->Enabled())
- return;
-
- m_bFilterEnabled = !m_bFilterEnabled;
- pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2));
- if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
- ShowFilterMenu();
- else
- RedrawLog();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
static void __cdecl phase2(SESSION_INFO *si)
{
Thread_SetName("Scriver: phase2");
@@ -341,92 +315,6 @@ INT_PTR CALLBACK CMsgDialog::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPara /////////////////////////////////////////////////////////////////////////////////////////
-LRESULT CMsgDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int result = InputAreaShortcuts(m_nickList.GetHwnd(), msg, wParam, lParam);
- if (result != -1)
- return result;
-
- switch (msg) {
- case WM_GETDLGCODE:
- {
- BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt;
-
- LPMSG lpmsg;
- if ((lpmsg = (LPMSG)lParam) != nullptr) {
- if (lpmsg->message == WM_KEYDOWN
- && (lpmsg->wParam == VK_RETURN || lpmsg->wParam == VK_ESCAPE || (lpmsg->wParam == VK_TAB && (isAlt || isCtrl))))
- return DLGC_WANTALLKEYS;
- }
- }
- break;
-
- case WM_KEYDOWN:
- if (wParam == VK_RETURN) {
- int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
- if (index != LB_ERR) {
- USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
- Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
- }
- break;
- }
-
- if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT || wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END)
- m_wszSearch[0] = 0;
- break;
-
- case WM_CHAR:
- case WM_UNICHAR:
- /*
- * simple incremental search for the user (nick) - list control
- * typing esc or movement keys will clear the current search string
- */
- if (wParam == 27 && m_wszSearch[0]) { // escape - reset everything
- m_wszSearch[0] = 0;
- break;
- }
- else if (wParam == '\b' && m_wszSearch[0]) // backspace
- m_wszSearch[mir_wstrlen(m_wszSearch) - 1] = '\0';
- else if (wParam < ' ')
- break;
- else {
- wchar_t szNew[2];
- szNew[0] = (wchar_t)wParam;
- szNew[1] = '\0';
- if (mir_wstrlen(m_wszSearch) >= _countof(m_wszSearch) - 2) {
- MessageBeep(MB_OK);
- break;
- }
- mir_wstrcat(m_wszSearch, szNew);
- }
- if (m_wszSearch[0]) {
- // iterate over the (sorted) list of nicknames and search for the
- // string we have
- int iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0);
- for (int i = 0; i < iItems; i++) {
- USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, i);
- if (ui) {
- if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) {
- m_nickList.SendMsg(LB_SETCURSEL, i, 0);
- InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE);
- return 0;
- }
- }
- }
-
- MessageBeep(MB_OK);
- m_wszSearch[mir_wstrlen(m_wszSearch) - 1] = '\0';
- return 0;
- }
- break;
- }
-
- return CSuper::WndProc_Nicklist(msg, wParam, lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void ShowRoom(SESSION_INFO *si)
{
if (si == nullptr)
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 60cf4659b9..699f8d4436 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -326,6 +326,9 @@ bool CMsgDialog::OnInitDialog() UpdateNickList();
}
else {
+ m_nickList.Hide();
+ m_splitterX.Hide();
+
bool notifyUnread = false;
if (m_hContact) {
int historyMode = g_plugin.iHistoryMode;
@@ -640,6 +643,34 @@ void CMsgDialog::onChange_Message(CCtrlEdit*) }
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CMsgDialog::onClick_ShowList(CCtrlButton *pButton)
+{
+ if (!pButton->Enabled() || m_si->iType == GCW_SERVER)
+ return;
+
+ m_bNicklistEnabled = !m_bNicklistEnabled;
+ pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2));
+ ScrollToBottom();
+ Resize();
+}
+
+void CMsgDialog::onClick_Filter(CCtrlButton *pButton)
+{
+ if (!pButton->Enabled())
+ return;
+
+ m_bFilterEnabled = !m_bFilterEnabled;
+ pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2));
+ if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ ShowFilterMenu();
+ else
+ RedrawLog();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CMsgDialog::onChange_SplitterX(CSplitter *pSplitter)
{
RECT rc;
@@ -1342,13 +1373,6 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) m_iLastEnterTime = 0;
break;
- case WM_KEYUP:
- case WM_LBUTTONUP:
- case WM_RBUTTONUP:
- case WM_MBUTTONUP:
- RefreshButtonStatus();
- break;
-
case WM_SYSCHAR:
m_iLastEnterTime = 0;
if ((wParam == 's' || wParam == 'S') && (GetKeyState(VK_MENU) & 0x8000)) {
@@ -1383,6 +1407,92 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
+LRESULT CMsgDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ int result = InputAreaShortcuts(m_nickList.GetHwnd(), msg, wParam, lParam);
+ if (result != -1)
+ return result;
+
+ switch (msg) {
+ case WM_GETDLGCODE:
+ {
+ BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
+ BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt;
+
+ LPMSG lpmsg;
+ if ((lpmsg = (LPMSG)lParam) != nullptr) {
+ if (lpmsg->message == WM_KEYDOWN
+ && (lpmsg->wParam == VK_RETURN || lpmsg->wParam == VK_ESCAPE || (lpmsg->wParam == VK_TAB && (isAlt || isCtrl))))
+ return DLGC_WANTALLKEYS;
+ }
+ }
+ break;
+
+ case WM_KEYDOWN:
+ if (wParam == VK_RETURN) {
+ int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
+ if (index != LB_ERR) {
+ USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
+ Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
+ }
+ break;
+ }
+
+ if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT || wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END)
+ m_wszSearch[0] = 0;
+ break;
+
+ case WM_CHAR:
+ case WM_UNICHAR:
+ /*
+ * simple incremental search for the user (nick) - list control
+ * typing esc or movement keys will clear the current search string
+ */
+ if (wParam == 27 && m_wszSearch[0]) { // escape - reset everything
+ m_wszSearch[0] = 0;
+ break;
+ }
+ else if (wParam == '\b' && m_wszSearch[0]) // backspace
+ m_wszSearch[mir_wstrlen(m_wszSearch) - 1] = '\0';
+ else if (wParam < ' ')
+ break;
+ else {
+ wchar_t szNew[2];
+ szNew[0] = (wchar_t)wParam;
+ szNew[1] = '\0';
+ if (mir_wstrlen(m_wszSearch) >= _countof(m_wszSearch) - 2) {
+ MessageBeep(MB_OK);
+ break;
+ }
+ mir_wstrcat(m_wszSearch, szNew);
+ }
+ if (m_wszSearch[0]) {
+ // iterate over the (sorted) list of nicknames and search for the
+ // string we have
+ int iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0);
+ for (int i = 0; i < iItems; i++) {
+ USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, i);
+ if (ui) {
+ if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) {
+ m_nickList.SendMsg(LB_SETCURSEL, i, 0);
+ InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE);
+ return 0;
+ }
+ }
+ }
+
+ MessageBeep(MB_OK);
+ m_wszSearch[mir_wstrlen(m_wszSearch) - 1] = '\0';
+ return 0;
+ }
+ break;
+ }
+
+ return CSuper::WndProc_Nicklist(msg, wParam, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
PARAFORMAT2 pf2;
|