diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-22 17:54:29 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-22 17:54:29 +0300 |
commit | f59a84dc9b6e843da1024f108cba16aa9544b10c (patch) | |
tree | aacb5df6ff7fcf6f9a66fcdd8a6529f6b56aae0e | |
parent | 75876f6d7a4b4597e95a72315aa82dc3a8ffc57d (diff) |
- more SRMM buttons went to mir_app;
- history button handler also moved to mir_app;
-rw-r--r-- | include/m_chat_int.h | 17 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 42 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 6 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 5 | ||||
-rw-r--r-- | plugins/Scriver/src/resource.h | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/buttonsbar.cpp | 7 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 22 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/infopanel.cpp | 10 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/resource.h | 3 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 25 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/resource.h | 3 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 116 |
20 files changed, 119 insertions, 159 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 203c6b343b..5088fc69d5 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -365,7 +365,10 @@ struct CHAT_MANAGER void (*OnFlashHighlight)(SESSION_INFO*, int bInactive);
};
+#ifndef MIR_APP_EXPORTS
extern CHAT_MANAGER *pci;
+#endif
+
extern int hLangpack;
EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pData = NULL, int = hLangpack);
@@ -389,6 +392,9 @@ EXTERN_C MIR_APP_DLL(void) Chat_UpdateOptions(); #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
class MIR_APP_EXPORT CSrmmBaseDialog : public CDlgBase
{
@@ -410,12 +416,15 @@ protected: SESSION_INFO *m_si;
COLORREF m_clrInputBG, m_clrInputFG;
- CCtrlButton m_btnColor, m_btnBkColor, m_btnFilter;
+ CCtrlButton m_btnColor, m_btnBkColor;
CCtrlButton m_btnBold, m_btnItalic, m_btnUnderline;
+ CCtrlButton m_btnHistory, m_btnChannelMgr, m_btnNickList, m_btnFilter;
+
+ void onClick_BIU(CCtrlButton*);
+ void onClick_Color(CCtrlButton*);
+ void onClick_BkColor(CCtrlButton*);
- void onClick_BIU(CCtrlButton *pButton);
- void onClick_Color(CCtrlButton *pButton);
- void onClick_BkColor(CCtrlButton *pButton);
+ void onClick_History(CCtrlButton*);
public:
MCONTACT m_hContact;
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index d0bd3109b5..8bfbe4b327 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -198,19 +198,19 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w return TRUE;
if (wParam == 0x4e && isCtrl && !isAlt) { // ctrl-n (nicklist)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_SHOWNICKLIST)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, 0), 0);
+ if (pDlg->m_btnNickList.Enabled())
+ pDlg->m_btnNickList.OnClick(&pDlg->m_btnNickList);
return TRUE;
}
if (wParam == 0x48 && isCtrl && !isAlt) { // ctrl-h (history)
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_HISTORY, 0), 0);
+ pDlg->m_btnHistory.OnClick(&pDlg->m_btnHistory);
return TRUE;
}
if (wParam == 0x4f && isCtrl && !isAlt) { // ctrl-o (options)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHANMGR)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, 0), 0);
+ if (pDlg->m_btnChannelMgr.Enabled())
+ pDlg->m_btnChannelMgr.OnClick(&pDlg->m_btnChannelMgr);
return TRUE;
}
@@ -700,15 +700,15 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) ShowWindow(m_nickList.GetHwnd(), SW_HIDE);
if (m_si->iType == GCW_SERVER) {
- m_btnShowList.Enable(false);
+ m_btnNickList.Enable(false);
m_btnFilter.Enable(false);
- m_btnChanMgr.Enable(false);
+ m_btnChannelMgr.Enable(false);
}
else {
- m_btnShowList.Enable(true);
+ m_btnNickList.Enable(true);
m_btnFilter.Enable(true);
if (m_si->iType == GCW_CHATROOM)
- m_btnChanMgr.Enable(pci->MM_FindModule(m_si->pszModule)->bChanMgr);
+ m_btnChannelMgr.Enable(pci->MM_FindModule(m_si->pszModule)->bChanMgr);
}
int toolbarTopY = bToolbar ? h - m_pParent->iSplitterY - toolbarHeight : h - m_pParent->iSplitterY;
@@ -752,19 +752,15 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) m_splitterX(this, IDC_SPLITTERX),
m_splitterY(this, IDC_SPLITTERY),
- m_btnOk(this, IDOK),
- m_btnHistory(this, IDC_HISTORY),
- m_btnChanMgr(this, IDC_CHANMGR),
- m_btnShowList(this, IDC_SHOWNICKLIST)
+ m_btnOk(this, IDOK)
{
m_pLog = &m_log;
m_pEntry = &m_message;
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_btnChanMgr.OnClick = Callback(this, &CChatRoomDlg::onClick_ChanMgr);
- m_btnShowList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowList);
+ m_btnChannelMgr.OnClick = Callback(this, &CChatRoomDlg::onClick_ChanMgr);
+ m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowList);
m_nickList.OnDblClick = Callback(this, &CChatRoomDlg::onDblClick_List);
@@ -948,16 +944,6 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) SetFocus(m_message.GetHwnd());
}
-void CChatRoomDlg::onClick_History(CCtrlButton *pButton)
-{
- if (!pButton->Enabled())
- return;
-
- MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
- if (pInfo)
- ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW);
-}
-
void CChatRoomDlg::onClick_ChanMgr(CCtrlButton *pButton)
{
if (pButton->Enabled())
@@ -1073,7 +1059,7 @@ void CChatRoomDlg::UpdateNickList() void CChatRoomDlg::UpdateOptions()
{
- m_btnShowList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
+ m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2"));
{
MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
@@ -1084,7 +1070,7 @@ void CChatRoomDlg::UpdateOptions() m_btnColor.Enable(pInfo->bColor);
m_btnBkColor.Enable(pInfo->bBkgColor);
if (m_si->iType == GCW_CHATROOM)
- m_btnChanMgr.Enable(pInfo->bChanMgr);
+ m_btnChannelMgr.Enable(pInfo->bChanMgr);
}
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2e0f3c5742..3684c2c52a 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -629,7 +629,6 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitia m_btnAdd(this, IDC_ADD),
m_btnQuote(this, IDC_QUOTE),
m_btnDetails(this, IDC_DETAILS),
- m_btnHistory(this, IDC_HISTORY),
m_btnUserMenu(this, IDC_USERMENU)
{
m_pLog = &m_log;
@@ -643,7 +642,6 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitia m_btnAdd.OnClick = Callback(this, &CSrmmWindow::onClick_Add);
m_btnQuote.OnClick = Callback(this, &CSrmmWindow::onClick_Quote);
m_btnDetails.OnClick = Callback(this, &CSrmmWindow::onClick_Details);
- m_btnHistory.OnClick = Callback(this, &CSrmmWindow::onClick_History);
m_btnUserMenu.OnClick = Callback(this, &CSrmmWindow::onClick_UserMenu);
m_message.OnChange = Callback(this, &CSrmmWindow::onChange_Message);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index a4cc4edb4c..3be8670a67 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -475,7 +475,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) Srmm_AddButton(&bbd);
bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.dwButtonID = IDC_HISTORY;
+ bbd.dwButtonID = IDC_SRMM_HISTORY;
bbd.dwDefPos = 50;
bbd.hIcon = IcoLib_GetIconHandle("scriver_HISTORY");
bbd.pwszText = LPGENW("&History");
@@ -520,14 +520,14 @@ int RegisterToolbarIcons(WPARAM, LPARAM) Srmm_AddButton(&bbd);
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
- bbd.dwButtonID = IDC_CHANMGR;
+ bbd.dwButtonID = IDC_SRMM_CHANMGR;
bbd.dwDefPos = 30;
bbd.hIcon = IcoLib_GetIconHandle("chat_settings");
bbd.pwszText = LPGENW("&Room settings");
bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_SHOWNICKLIST;
+ bbd.dwButtonID = IDC_SRMM_NICKLIST;
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 9656a9b54d..5fba8353a2 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -103,7 +103,7 @@ public: class CSrmmWindow : public CScriverWindow
{
CCtrlEdit m_log, m_message;
- CCtrlButton m_btnOk, m_btnAdd, m_btnUserMenu, m_btnQuote, m_btnHistory, m_btnDetails;
+ CCtrlButton m_btnOk, m_btnAdd, m_btnUserMenu, m_btnQuote, m_btnDetails;
CSplitter m_splitter;
wchar_t *m_wszInitialText;
@@ -178,7 +178,7 @@ public: class CChatRoomDlg : public CScriverWindow
{
CCtrlEdit m_message, m_log;
- CCtrlButton m_btnOk, m_btnHistory, m_btnShowList, m_btnChanMgr;
+ CCtrlButton m_btnOk;
CCtrlListBox m_nickList;
CSplitter m_splitterX, m_splitterY;
@@ -213,7 +213,6 @@ public: void onClick_Ok(CCtrlButton*);
void onClick_Filter(CCtrlButton*);
- void onClick_History(CCtrlButton*);
void onClick_ChanMgr(CCtrlButton*);
void onClick_ShowList(CCtrlButton*);
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 0e6cdd399c..cd2b9afb0a 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -96,7 +96,6 @@ #define IDC_USERELATIVEDATE 1025
#define IDC_USEIEVIEW 1026
#define IDC_FONTSCOLORS 1027
-#define IDC_CHANMGR 1030
#define IDC_SHOWLOGICONS 1032
#define IDC_SHOWTIMES 1033
#define IDC_SHOWDATES 1034
@@ -122,7 +121,6 @@ #define IDC_ADD 1070
#define IDC_USERMENU 1071
#define IDC_QUOTE 1072
-#define IDC_HISTORY 1080
#define IDC_REMEMBER 1082
#define IDC_INFOBAR_NAME 1090
#define IDC_INFOBAR_STATUS 1091
@@ -173,7 +171,6 @@ #define IDC_INPUTLINESSPIN 1648
#define IDC_SPLITTERX 5006
#define IDC_SPLITTERY 5008
-#define IDC_SHOWNICKLIST 5016
#define IDC_CHAT_CHECKBOXES 5021
#define IDC_CHAT_NICKROW 5024
#define IDC_CHAT_LOGLIMIT 5024
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 832f985288..5531463a5a 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -74,7 +74,7 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) Srmm_AddButton(&bbd); bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID; - bbd.dwButtonID = IDC_HISTORY; + bbd.dwButtonID = IDC_SRMM_HISTORY; bbd.dwDefPos = 50; bbd.hIcon = PluginConfig.g_buttonBarIconHandles[0]; bbd.pwszTooltip = LPGENW("View user's history"); @@ -119,7 +119,7 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) Srmm_AddButton(&bbd); bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID; - bbd.dwButtonID = IDC_SHOWNICKLIST; + bbd.dwButtonID = IDC_SRMM_NICKLIST; bbd.dwDefPos = 22; bbd.hIcon = PluginConfig.g_buttonBarIconHandles[19]; bbd.pwszTooltip = LPGENW("Toggle nick list"); @@ -131,12 +131,11 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("Event filter - right click to setup, left click to activate/deactivate"); Srmm_AddButton(&bbd); - bbd.dwButtonID = IDC_CHANMGR; + bbd.dwButtonID = IDC_SRMM_CHANMGR; bbd.dwDefPos = 33; bbd.hIcon = PluginConfig.g_buttonBarIconHandles[17]; bbd.pwszTooltip = LPGENW("Channel manager"); Srmm_AddButton(&bbd); - return 0; } diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 331bd3da2e..b9e94532df 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -1379,10 +1379,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_btnHistory(this, IDC_HISTORY), - m_btnChannelMgr(this, IDC_CHANMGR), - m_btnNickList(this, IDC_SHOWNICKLIST) + m_list(this, IDC_LIST) { m_szProto = GetContactProto(m_hContact); m_bFilterEnabled = db_get_b(m_hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled) != 0; @@ -1390,7 +1387,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) 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_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowNickList); m_btnChannelMgr.OnClick = Callback(this, &CChatRoomDlg::onClick_ChanMgr); @@ -1618,22 +1614,6 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) db_set_b(m_si->hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled); } -void CChatRoomDlg::onClick_History(CCtrlButton *pButton) -{ - if (!pButton->Enabled()) - return; - - MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule); - if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(m_si->pszModule, "IRC")) { - char szName[MAX_PATH]; - WideCharToMultiByte(CP_ACP, 0, m_si->ptszName, -1, szName, MAX_PATH, 0, 0); - szName[MAX_PATH - 1] = 0; - CallService("MSP/HTMLlog/ViewLog", (WPARAM)m_si->pszModule, (LPARAM)szName); - } - else if (pInfo) - ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW); -} - void CChatRoomDlg::onClick_ShowNickList(CCtrlButton *pButton) { if (!pButton->Enabled()) diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 4855dc94c7..7b1ebaedf1 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -126,7 +126,7 @@ bool CTabBaseDlg::DM_GenericHotkeysCheck(MSG *message) return true; case TABSRMM_HK_HISTORY: - SendMessage(m_hwnd, WM_COMMAND, IDC_HISTORY, 0); + m_btnHistory.OnClick(&m_btnHistory); return true; case TABSRMM_HK_CONTAINEROPTIONS: @@ -237,7 +237,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)(m_cache->getActiveContact()), 0); break; - case IDC_HISTORY: + case IDC_SRMM_HISTORY: CallService(MS_HISTORY_SHOWCONTACTHISTORY, m_hContact, 0); break; diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index fd806a7b25..e75a5d13a1 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -713,13 +713,13 @@ 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_HISTORY : IDC_HISTORY, 0);
+ Utils::addMenuItem(m, mii, ::Skin_LoadIcon(SKINICON_OTHER_HISTORY), TranslateT("Open history..."), IDC_SRMM_HISTORY, 0);
if (!m_isChat)
Utils::addMenuItem(m, mii, PluginConfig.g_iconContainer, TranslateT("Messaging settings..."), ID_MESSAGELOGSETTINGS_FORTHISCONTACT, 1);
else {
- ::AppendMenu(m, MF_STRING, IDC_CHANMGR, TranslateT("Room settings..."));
+ ::AppendMenu(m, MF_STRING, IDC_SRMM_CHANMGR, TranslateT("Room settings..."));
if (GCW_SERVER & m_dat->m_si->iType)
- ::EnableMenuItem(m, IDC_CHANMGR, MF_BYCOMMAND | MF_GRAYED);
+ ::EnableMenuItem(m, IDC_SRMM_CHANMGR, MF_BYCOMMAND | MF_GRAYED);
}
::AppendMenu(m, MF_SEPARATOR, 1000, 0);
Utils::addMenuItem(m, mii, PluginConfig.g_buttonBarIcons[6], TranslateT("Close session"), IDC_SAVE, 4);
@@ -752,8 +752,8 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd) }
break;
- case IDC_HISTORY:
- case IDC_CHANMGR:
+ case IDC_SRMM_HISTORY:
+ case IDC_SRMM_CHANMGR:
if (m_isChat) {
SendMessage(m_dat->GetHwnd(), WM_COMMAND, cmd, 0);
return(S_OK);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index c009e50a5d..cbd24d1ca3 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -483,7 +483,7 @@ public: class CChatRoomDlg : public CTabBaseDlg
{
HWND m_hwndFilter;
- CCtrlButton m_btnHistory, m_btnChannelMgr, m_btnNickList, m_btnOk;
+ CCtrlButton m_btnOk;
CCtrlListBox m_list;
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -520,7 +520,6 @@ public: void onClick_OK(CCtrlButton*);
void onClick_Filter(CCtrlButton*);
- void onClick_History(CCtrlButton*);
void onClick_ChanMgr(CCtrlButton*);
void onClick_ShowNickList(CCtrlButton*);
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index 4bff4ada73..648645486d 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -81,7 +81,6 @@ #define IDC_FASTGRADIENT 1008
#define IDC_SPLITTERY 1008
#define IDC_CHKNOTIFY_URL 1009
-#define IDC_CHANMGR 1010
#define IDC_USESKIN 1011
#define IDC_AUTOCLOSE 1012
#define IDC_CHKNOTIFY_OTHER 1013
@@ -101,7 +100,6 @@ #define IDC_CHKACTR_DISMISS 1026
#define IDC_CHKACTR_OPEN 1028
#define IDC_CONTACTPIC 1029
-#define IDC_SHOWNICKLIST 1030
#define IDC_ST_ENTERMSG 1031
#define IDC_PANELNICK 1032
#define IDC_CHKWINDOWCHECK 1032
@@ -181,7 +179,6 @@ #define IDC_DELAY_ERR 1102
#define IDC_RTL 1103
#define IDC_PIC 1104
-#define IDC_HISTORY 1111
#define IDC_CANCELADD 1112
#define IDC_FONTSTRIKEOUT 1113
#define IDC_MATH_BKGCOLOUR 1124
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 00d2d4ad99..c2b527e629 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -208,7 +208,6 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w SendMessage(hwndDlg, GC_SWITCHTAB, 0, (int)wParam - (int)VK_NUMPAD1); if (wParam == VK_TAB && !isCtrl && !isShift) { // tab-autocomplete - wchar_t *pszText = nullptr; LRESULT lResult = (LRESULT)SendMessage(hwnd, EM_GETSEL, 0, 0); SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); @@ -221,14 +220,14 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w gtl.codepage = CP_ACP; int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0); if (iLen > 0) { - pszText = (wchar_t *)mir_alloc(sizeof(wchar_t)*(iLen + 100)); + wchar_t *pszText = (wchar_t *)mir_alloc(sizeof(wchar_t)*(iLen + 100)); GETTEXTEX gt = {}; gt.cb = iLen + 99; gt.flags = GT_DEFAULT; gt.codepage = 1200; - SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)>, (LPARAM)pszText); + while (start > 0 && pszText[start - 1] != ' ' && pszText[start - 1] != 13 && pszText[start - 1] != VK_TAB) start--; while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end - 1] != VK_TAB) @@ -282,11 +281,6 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w return TRUE; } - if (wParam == 0x48 && isCtrl && !isAlt) { // ctrl-h (history) - pDlg->onClick_History(&pDlg->m_btnHistory); - return TRUE; - } - if (wParam == 0x4f && isCtrl && !isAlt) { // ctrl-o (options) pDlg->onClick_Options(&pDlg->m_btnChannelMgr); return TRUE; @@ -695,10 +689,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : m_log(this, IDC_LOG), m_btnOk(this, IDOK), - - m_btnHistory(this, IDC_HISTORY), - m_btnNickList(this, IDC_SHOWNICKLIST), - m_btnChannelMgr(this, IDC_CHANMGR), m_splitterX(this, IDC_SPLITTERX), m_splitterY(this, IDC_SPLITTERY) @@ -712,7 +702,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : 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_btnChannelMgr.OnClick = Callback(this, &CChatRoomDlg::onClick_Options); m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_NickList); @@ -812,16 +801,6 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) RedrawLog(); } -void CChatRoomDlg::onClick_History(CCtrlButton *pButton) -{ - if (!pButton->Enabled()) - return; - - MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule); - if (pInfo) - ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW); -} - void CChatRoomDlg::onClick_NickList(CCtrlButton *pButton) { if (!pButton->Enabled() || m_si->iType == GCW_SERVER) diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index ec6b384b59..1b3896ee31 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1320,10 +1320,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
break;
- case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, m_hContact, 0);
- break;
-
case IDC_DETAILS:
CallService(MS_USERINFO_SHOWDIALOG, m_hContact, 0);
break;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index e81d16e3a9..906b0270a4 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -307,7 +307,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) Srmm_AddButton(&bbd);
bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.dwButtonID = IDC_HISTORY;
+ bbd.dwButtonID = IDC_SRMM_HISTORY;
bbd.dwDefPos = 40;
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_HISTORY);
bbd.pwszText = LPGENW("&History");
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index d07e2b302a..bd06f80531 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -70,11 +70,8 @@ #define IDC_AUTOMIN 1005
#define IDC_DONOTSTEALFOCUS 1006
#define IDC_SPLITTERY 1008
-#define IDC_CHANMGR 1014
-#define IDC_SHOWNICKLIST 1016
#define IDC_CHECKBOXES 1018
#define IDC_NICKLISTBKG 1021
-#define IDC_HISTORY 1022
#define IDC_NICKROW 1024
#define IDC_LOGLIMIT 1024
#define IDC_NICKROW2 1025
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index c665cbb2b8..750bbefcf5 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -218,7 +218,6 @@ class CChatRoomDlg : public CSrmmBaseDialog CCtrlEdit m_message, m_log;
CCtrlListBox m_nickList;
CCtrlButton m_btnOk;
- CCtrlButton m_btnChannelMgr, m_btnNickList, m_btnHistory;
CSplitter m_splitterX, m_splitterY;
HWND getCaptionWindow() const
@@ -253,7 +252,6 @@ public: void onClick_Ok(CCtrlButton*);
void onClick_Filter(CCtrlButton*);
- void onClick_History(CCtrlButton*);
void onClick_Options(CCtrlButton*);
void onClick_NickList(CCtrlButton*);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index d7637765fe..08d7355403 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -430,3 +430,4 @@ Chat_UpdateOptions @418 NONAME ?onClick_Color@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @432 NONAME
?RefreshButtonStatus@CSrmmBaseDialog@@IAEXXZ @433 NONAME
?ProcessHotkeys@CSrmmBaseDialog@@IAE_NH_N00@Z @434 NONAME
+?onClick_History@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @435 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a158a3409b..380bc88347 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -430,3 +430,4 @@ Chat_UpdateOptions @418 NONAME ?onClick_Color@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @432 NONAME
?RefreshButtonStatus@CSrmmBaseDialog@@IEAAXXZ @433 NONAME
?ProcessHotkeys@CSrmmBaseDialog@@IEAA_NH_N00@Z @434 NONAME
+?onClick_History@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @435 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 6299bb6bf0..faf40ef1b3 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -24,15 +24,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "chat.h" +#include <m_history.h> extern HCURSOR g_hCurHyperlinkHand; CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si) : CDlgBase(hInst, idDialog), m_btnFilter(this, IDC_SRMM_FILTER), + m_btnHistory(this, IDC_SRMM_HISTORY), + m_btnNickList(this, IDC_SRMM_NICKLIST), + m_btnChannelMgr(this, IDC_SRMM_CHANMGR), + m_btnColor(this, IDC_SRMM_COLOR), m_btnBkColor(this, IDC_SRMM_BKGCOLOR), m_btnBold(this, IDC_SRMM_BOLD), + m_btnItalic(this, IDC_SRMM_ITALICS), m_btnUnderline(this, IDC_SRMM_UNDERLINE), @@ -50,6 +56,8 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si m_btnBkColor.OnClick = Callback(this, &CSrmmBaseDialog::onClick_BkColor); m_btnBold.OnClick = m_btnItalic.OnClick = m_btnUnderline.OnClick = Callback(this, &CSrmmBaseDialog::onClick_BIU); + m_btnHistory.OnClick = Callback(this, &CSrmmBaseDialog::onClick_History); + if (si) { m_hContact = si->hContact; @@ -69,8 +77,9 @@ 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_btnFilter(0, 0), - m_btnBold(0, 0), m_btnItalic(0, 0), m_btnUnderline(0, 0) + m_btnColor(0, 0), m_btnBkColor(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) { } @@ -309,58 +318,73 @@ void CSrmmBaseDialog::onClick_BIU(CCtrlButton *pButton) m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } -///////////////////////////////////////////////////////////////////////////////////////// - -bool CSrmmBaseDialog::ProcessHotkeys(int key, bool /*isShift*/, bool isCtrl, bool isAlt) +void CSrmmBaseDialog::onClick_History(CCtrlButton *pButton) { - if (key == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab) - CloseTab(); - return true; - } - - if (key == VK_ESCAPE && !isCtrl && !isAlt) { // Esc (close tab) - CloseTab(); - return true; - } - - if (key == 0x42 && isCtrl && !isAlt) { // ctrl-b (bold) - m_btnBold.Push(!m_btnBold.IsPushed()); - onClick_BIU(&m_btnBold); - return true; - } - - if (key == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics) - m_btnItalic.Push(!m_btnItalic.IsPushed()); - onClick_BIU(&m_btnItalic); - return true; - } + if (!pButton->Enabled()) + return; - if (key == 0x55 && isCtrl && !isAlt) { // ctrl-u (paste clean text) - m_btnUnderline.Push(!m_btnUnderline.IsPushed()); - onClick_BIU(&m_btnUnderline); - return true; + if (m_si != nullptr) { + MODULEINFO *pInfo = chatApi.MM_FindModule(m_si->pszModule); + if (pInfo) + ShellExecute(m_hwnd, nullptr, chatApi.GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW); } + else CallService(MS_HISTORY_SHOWCONTACTHISTORY, m_hContact, 0); +} - if (key == 0x4b && isCtrl && !isAlt) { // ctrl-k (paste clean text) - m_btnColor.Push(!m_btnColor.IsPushed()); - onClick_Color(&m_btnColor); - return true; - } +///////////////////////////////////////////////////////////////////////////////////////// - if (key == 0x4c && isCtrl && !isAlt) { // ctrl-l (paste clean text) - m_btnBkColor.Push(!m_btnBkColor.IsPushed()); - onClick_BkColor(&m_btnBkColor); +bool CSrmmBaseDialog::ProcessHotkeys(int key, bool isShift, bool isCtrl, bool isAlt) +{ + // Esc (close tab) + if (key == VK_ESCAPE && !isShift && !isCtrl && !isAlt) { + CloseTab(); return true; } - if (key == VK_SPACE && isCtrl && !isAlt) { // ctrl-space (paste clean text) - m_btnBold.Push(false); onClick_BIU(&m_btnBold); - m_btnItalic.Push(false); onClick_BIU(&m_btnItalic); - m_btnUnderline.Push(false); onClick_BIU(&m_btnUnderline); - - m_btnColor.Push(false); onClick_Color(&m_btnColor); - m_btnBkColor.Push(false); onClick_BkColor(&m_btnBkColor); - return true; + if (isCtrl && !isAlt) { + switch (key) { + case VK_SPACE: // ctrl-space (paste clean text) + m_btnBold.Push(false); onClick_BIU(&m_btnBold); + m_btnItalic.Push(false); onClick_BIU(&m_btnItalic); + m_btnUnderline.Push(false); onClick_BIU(&m_btnUnderline); + + m_btnColor.Push(false); onClick_Color(&m_btnColor); + m_btnBkColor.Push(false); onClick_BkColor(&m_btnBkColor); + return true; + + case 0x42: // ctrl-b (bold) + m_btnBold.Push(!m_btnBold.IsPushed()); + onClick_BIU(&m_btnBold); + return true; + + case 0x48: // ctrl-h (history) + onClick_History(&m_btnHistory); + return true; + + case 0x49: // ctrl-i (italics) + m_btnItalic.Push(!m_btnItalic.IsPushed()); + onClick_BIU(&m_btnItalic); + return true; + + case 0x4b: // ctrl-k (paste clean text) + m_btnColor.Push(!m_btnColor.IsPushed()); + onClick_Color(&m_btnColor); + return true; + + case 0x4c: // ctrl-l (back color) + m_btnBkColor.Push(!m_btnBkColor.IsPushed()); + onClick_BkColor(&m_btnBkColor); + return true; + + case 0x55: // ctrl-u (underlining) + m_btnUnderline.Push(!m_btnUnderline.IsPushed()); + onClick_BIU(&m_btnUnderline); + return true; + + case VK_F4: // ctrl-F4 (close tab) + CloseTab(); + return true; + } } return false; |