summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-21 18:23:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-21 18:23:08 +0300
commitb3a736917686b19b55c684c1b15c1e83cd0261e5 (patch)
tree2b71bed0ce0058f33a389a46b2be7dc67accab0b /src
parent03ba85dcd2d47cf31d6181b40620e278f7f30427 (diff)
some common code moved into mir_app
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_window.cpp150
-rw-r--r--src/core/stdmsg/src/msgs.cpp12
-rw-r--r--src/core/stdmsg/src/msgs.h2
-rw-r--r--src/core/stdmsg/src/resource.h6
-rw-r--r--src/core/stdmsg/src/stdafx.h6
-rw-r--r--src/mir_app/src/colorchooser.cpp2
-rw-r--r--src/mir_app/src/mir_app.def7
-rw-r--r--src/mir_app/src/mir_app64.def7
-rw-r--r--src/mir_app/src/srmm_base.cpp96
-rw-r--r--src/mir_app/src/srmm_util.cpp17
10 files changed, 170 insertions, 135 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index eac363e812..bb721319a0 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -280,52 +280,52 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (wParam == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics)
- CheckDlgButton(hwndDlg, IDC_ITALICS, IsDlgButtonChecked(hwndDlg, IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
+ CheckDlgButton(hwndDlg, IDC_SRMM_ITALICS, IsDlgButtonChecked(hwndDlg, IDC_SRMM_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_ITALICS, 0), 0);
return TRUE;
}
if (wParam == 0x42 && isCtrl && !isAlt) { // ctrl-b (bold)
- CheckDlgButton(hwndDlg, IDC_BOLD, IsDlgButtonChecked(hwndDlg, IDC_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BOLD, IsDlgButtonChecked(hwndDlg, IDC_SRMM_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_BOLD, 0), 0);
return TRUE;
}
if (wParam == 0x55 && isCtrl && !isAlt) { // ctrl-u (paste clean text)
- CheckDlgButton(hwndDlg, IDC_UNDERLINE, IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0);
+ CheckDlgButton(hwndDlg, IDC_SRMM_UNDERLINE, IsDlgButtonChecked(hwndDlg, IDC_SRMM_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_UNDERLINE, 0), 0);
return TRUE;
}
if (wParam == 0x4b && isCtrl && !isAlt) { // ctrl-k (paste clean text)
- CheckDlgButton(hwndDlg, IDC_COLOR, IsDlgButtonChecked(hwndDlg, IDC_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
+ CheckDlgButton(hwndDlg, IDC_SRMM_COLOR, IsDlgButtonChecked(hwndDlg, IDC_SRMM_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_COLOR, 0), 0);
return TRUE;
}
if (wParam == VK_SPACE && isCtrl && !isAlt) { // ctrl-space (paste clean text)
- CheckDlgButton(hwndDlg, IDC_BKGCOLOR, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_COLOR, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BOLD, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_UNDERLINE, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ITALICS, BST_UNCHECKED);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BKGCOLOR, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_COLOR, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BOLD, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_UNDERLINE, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_ITALICS, BST_UNCHECKED);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_BKGCOLOR, 0), 0);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_COLOR, 0), 0);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_BOLD, 0), 0);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_UNDERLINE, 0), 0);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_ITALICS, 0), 0);
return TRUE;
}
if (wParam == 0x4c && isCtrl && !isAlt) { // ctrl-l (paste clean text)
- CheckDlgButton(hwndDlg, IDC_BKGCOLOR, IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BKGCOLOR, IsDlgButtonChecked(hwndDlg, IDC_SRMM_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_BKGCOLOR, 0), 0);
return TRUE;
}
if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (paste clean text)
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILTER)))
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, 0), 0);
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SRMM_FILTER)))
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SRMM_FILTER, 0), 0);
return TRUE;
}
@@ -492,7 +492,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (pmi->bColor) {
int index = GetColorIndex(dat->si->pszModule, cf.crTextColor);
- UINT u = IsDlgButtonChecked(hwndDlg, IDC_COLOR);
+ UINT u = IsDlgButtonChecked(hwndDlg, IDC_SRMM_COLOR);
if (index >= 0) {
pDlg->m_bFGSet = true;
@@ -500,54 +500,54 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (u == BST_UNCHECKED && cf.crTextColor != g_Settings.MessageAreaColor)
- CheckDlgButton(hwndDlg, IDC_COLOR, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_COLOR, BST_CHECKED);
else if (u == BST_CHECKED && cf.crTextColor == g_Settings.MessageAreaColor)
- CheckDlgButton(hwndDlg, IDC_COLOR, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_COLOR, BST_UNCHECKED);
}
if (pmi->bBkgColor) {
int index = GetColorIndex(dat->si->pszModule, cf.crBackColor);
COLORREF crB = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- UINT u = IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR);
+ UINT u = IsDlgButtonChecked(hwndDlg, IDC_SRMM_BKGCOLOR);
if (index >= 0) {
pDlg->m_bBGSet = TRUE;
pDlg->m_iBG = index;
}
if (u == BST_UNCHECKED && cf.crBackColor != crB)
- CheckDlgButton(hwndDlg, IDC_BKGCOLOR, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BKGCOLOR, BST_CHECKED);
else if (u == BST_CHECKED && cf.crBackColor == crB)
- CheckDlgButton(hwndDlg, IDC_BKGCOLOR, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BKGCOLOR, BST_UNCHECKED);
}
if (pmi->bBold) {
- UINT u = IsDlgButtonChecked(hwndDlg, IDC_BOLD);
+ UINT u = IsDlgButtonChecked(hwndDlg, IDC_SRMM_BOLD);
UINT u2 = cf.dwEffects;
u2 &= CFE_BOLD;
if (u == BST_UNCHECKED && u2)
- CheckDlgButton(hwndDlg, IDC_BOLD, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BOLD, BST_CHECKED);
else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(hwndDlg, IDC_BOLD, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_BOLD, BST_UNCHECKED);
}
if (pmi->bItalics) {
- UINT u = IsDlgButtonChecked(hwndDlg, IDC_ITALICS);
+ UINT u = IsDlgButtonChecked(hwndDlg, IDC_SRMM_ITALICS);
UINT u2 = cf.dwEffects;
u2 &= CFE_ITALIC;
if (u == BST_UNCHECKED && u2)
- CheckDlgButton(hwndDlg, IDC_ITALICS, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_ITALICS, BST_CHECKED);
else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(hwndDlg, IDC_ITALICS, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_ITALICS, BST_UNCHECKED);
}
if (pmi->bUnderline) {
- UINT u = IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE);
+ UINT u = IsDlgButtonChecked(hwndDlg, IDC_SRMM_UNDERLINE);
UINT u2 = cf.dwEffects;
u2 &= CFE_UNDERLINE;
if (u == BST_UNCHECKED && u2)
- CheckDlgButton(hwndDlg, IDC_UNDERLINE, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_UNDERLINE, BST_CHECKED);
else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(hwndDlg, IDC_UNDERLINE, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SRMM_UNDERLINE, BST_UNCHECKED);
}
}
break;
@@ -819,14 +819,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) :
m_btnOk(this, IDOK),
- m_btnBold(this, IDC_BOLD),
- m_btnItalic(this, IDC_ITALICS),
- m_btnUnderline(this, IDC_UNDERLINE),
-
- m_btnColor(this, IDC_COLOR),
- m_btnBkColor(this, IDC_BKGCOLOR),
-
- m_btnFilter(this, IDC_FILTER),
m_btnHistory(this, IDC_HISTORY),
m_btnNickList(this, IDC_SHOWNICKLIST),
m_btnChannelMgr(this, IDC_CHANMGR),
@@ -836,9 +828,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) :
{
m_pLog = &m_log;
m_pEntry = &m_message;
- m_pColor = &m_btnColor;
- m_pBkColor = &m_btnBkColor;
- m_pFilter = &m_btnFilter;
m_autoClose = 0;
m_forceResizable = true;
@@ -847,9 +836,6 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) :
m_btnItalic.OnClick = Callback(this, &CChatRoomDlg::onClick_Bold);
m_btnUnderline.OnClick = Callback(this, &CChatRoomDlg::onClick_Bold);
- m_btnColor.OnClick = Callback(this, &CChatRoomDlg::onClick_Color);
- m_btnBkColor.OnClick = Callback(this, &CChatRoomDlg::onClick_BkColor);
-
m_btnOk.OnClick = Callback(this, &CChatRoomDlg::onClick_Ok);
m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::onClick_Filter);
@@ -953,63 +939,13 @@ void CChatRoomDlg::onClick_Bold(CCtrlButton *pButton)
cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
cf.dwEffects = 0;
switch (pButton->GetCtrlId()) {
- case IDC_BOLD: cf.dwEffects |= CFE_BOLD; break;
- case IDC_ITALICS: cf.dwEffects |= CFE_ITALIC; break;
- case IDC_UNDERLINE: cf.dwEffects |= CFE_UNDERLINE; break;
+ case IDC_SRMM_BOLD: cf.dwEffects |= CFE_BOLD; break;
+ case IDC_SRMM_ITALICS: cf.dwEffects |= CFE_ITALIC; break;
+ case IDC_SRMM_UNDERLINE: cf.dwEffects |= CFE_UNDERLINE; break;
}
m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
-void CChatRoomDlg::onClick_Color(CCtrlButton *pButton)
-{
- if (!pButton->Enabled())
- return;
-
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
-
- if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) {
- if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
- ShowColorChooser(IDC_COLOR);
- else if (m_bFGSet) {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_iFG];
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = g_Settings.MessageAreaColor;
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
-}
-
-void CChatRoomDlg::onClick_BkColor(CCtrlButton *pButton)
-{
- if (!pButton->Enabled())
- return;
-
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
-
- if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) {
- if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
- ShowColorChooser(IDC_BKGCOLOR);
- else if (m_bBGSet) {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_iBG];
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
-}
-
void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton)
{
if (!pButton->Enabled())
@@ -1208,6 +1144,12 @@ void CChatRoomDlg::CloseTab()
Close();
}
+void CChatRoomDlg::LoadSettings()
+{
+ m_clrInputBG = db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &m_clrInputFG);
+}
+
void CChatRoomDlg::RedrawLog()
{
m_si->LastTime = 0;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 4e46cc2188..e81d16e3a9 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -316,35 +316,35 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
// chat buttons
bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID;
- bbd.dwButtonID = IDC_BOLD;
+ bbd.dwButtonID = IDC_SRMM_BOLD;
bbd.dwDefPos = 10;
bbd.hIcon = GetIconHandle("bold");
bbd.pwszText = LPGENW("&Bold");
bbd.pwszTooltip = LPGENW("Make the text bold (CTRL+B)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_ITALICS;
+ bbd.dwButtonID = IDC_SRMM_ITALICS;
bbd.dwDefPos = 15;
bbd.hIcon = GetIconHandle("italics");
bbd.pwszText = LPGENW("&Italic");
bbd.pwszTooltip = LPGENW("Make the text italicized (CTRL+I)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_UNDERLINE;
+ bbd.dwButtonID = IDC_SRMM_UNDERLINE;
bbd.dwDefPos = 20;
bbd.hIcon = GetIconHandle("underline");
bbd.pwszText = LPGENW("&Underline");
bbd.pwszTooltip = LPGENW("Make the text underlined (CTRL+U)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_COLOR;
+ bbd.dwButtonID = IDC_SRMM_COLOR;
bbd.dwDefPos = 25;
bbd.hIcon = GetIconHandle("fgcol");
bbd.pwszText = LPGENW("&Color");
bbd.pwszTooltip = LPGENW("Select a foreground color for the text (CTRL+K)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_BKGCOLOR;
+ bbd.dwButtonID = IDC_SRMM_BKGCOLOR;
bbd.dwDefPos = 30;
bbd.hIcon = GetIconHandle("bkgcol");
bbd.pwszText = LPGENW("&Background color");
@@ -366,7 +366,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
bbd.pwszTooltip = LPGENW("Show/hide the nick list (CTRL+N)");
Srmm_AddButton(&bbd);
- bbd.dwButtonID = IDC_FILTER;
+ bbd.dwButtonID = IDC_SRMM_FILTER;
bbd.dwDefPos = 10;
bbd.hIcon = GetIconHandle("filter");
bbd.pwszText = LPGENW("&Filter");
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index f170e5213f..5d12330fe3 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -102,6 +102,7 @@ public:
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ virtual void LoadSettings() override {}
virtual void UpdateTitle() override {}
void OnSplitterMoved(CSplitter*);
@@ -119,7 +120,6 @@ public:
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
int DbEventIsShown(DBEVENTINFO *dbei);
-void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend);
int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact);
INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar);
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h
index 9a6ad1345f..d07e2b302a 100644
--- a/src/core/stdmsg/src/resource.h
+++ b/src/core/stdmsg/src/resource.h
@@ -70,15 +70,9 @@
#define IDC_AUTOMIN 1005
#define IDC_DONOTSTEALFOCUS 1006
#define IDC_SPLITTERY 1008
-#define IDC_BOLD 1010
-#define IDC_ITALICS 1011
-#define IDC_UNDERLINE 1012
-#define IDC_FILTER 1013
#define IDC_CHANMGR 1014
#define IDC_SHOWNICKLIST 1016
-#define IDC_COLOR 1017
#define IDC_CHECKBOXES 1018
-#define IDC_BKGCOLOR 1019
#define IDC_NICKLISTBKG 1021
#define IDC_HISTORY 1022
#define IDC_NICKROW 1024
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 7e7f77e9c7..ec0d18a764 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -219,8 +219,7 @@ class CChatRoomDlg : public CSrmmBaseDialog
CCtrlEdit m_message, m_log;
CCtrlListBox m_nickList;
CCtrlButton m_btnOk;
- CCtrlButton m_btnFilter, m_btnChannelMgr, m_btnNickList, m_btnHistory;
- CCtrlButton m_btnBold, m_btnItalic, m_btnUnderline, m_btnColor, m_btnBkColor;
+ CCtrlButton m_btnChannelMgr, m_btnNickList, m_btnHistory;
CSplitter m_splitterX, m_splitterY;
HWND getCaptionWindow() const
@@ -242,6 +241,7 @@ public:
virtual int Resizer(UTILRESIZECONTROL *urc) override;
virtual void CloseTab() override;
+ virtual void LoadSettings() override;
virtual void RedrawLog() override;
virtual void StreamInEvents(LOGINFO* lin, bool bRedraw) override;
virtual void ScrollToBottom() override;
@@ -252,8 +252,6 @@ public:
virtual void UpdateTitle() override;
void onClick_Bold(CCtrlButton*);
- void onClick_Color(CCtrlButton*);
- void onClick_BkColor(CCtrlButton*);
void onClick_Ok(CCtrlButton*);
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp
index 731239b8c1..6422e4020a 100644
--- a/src/mir_app/src/colorchooser.cpp
+++ b/src/mir_app/src/colorchooser.cpp
@@ -267,6 +267,6 @@ public:
void CSrmmBaseDialog::ShowColorChooser(int iCtrlId)
{
- CColorChooserDlg *pDialog = new CColorChooserDlg(m_si, iCtrlId == m_pColor->GetCtrlId(), m_hwnd, m_pEntry->GetHwnd(), GetDlgItem(m_hwnd, iCtrlId));
+ CColorChooserDlg *pDialog = new CColorChooserDlg(m_si, iCtrlId == IDC_SRMM_COLOR, m_hwnd, m_pEntry->GetHwnd(), GetDlgItem(m_hwnd, iCtrlId));
pDialog->Show();
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 1d15af6551..fb6970252c 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -400,9 +400,9 @@ ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QAEXK@Z @402 NONAME
??0CSrmmBaseDialog@@IAE@PAUHINSTANCE__@@HPAUSESSION_INFO@@@Z @403 NONAME
-??0CSrmmBaseDialog@@QAE@ABV0@@Z @404 NONAME
+??0CSrmmBaseDialog@@AAE@ABV0@@Z @404 NONAME
??1CSrmmBaseDialog@@UAE@XZ @405 NONAME
-??4CSrmmBaseDialog@@QAEAAV0@ABV0@@Z @406 NONAME
+??4CSrmmBaseDialog@@AAEAAV0@ABV0@@Z @406 NONAME
??_7CSrmmBaseDialog@@6B@ @407 NONAME
?DlgProc@CSrmmBaseDialog@@MAEHIIJ@Z @408 NONAME
??2CSrmmBaseDialog@@SAPAXI@Z @409 NONAME
@@ -426,3 +426,6 @@ _Srmm_ButtonSubclassProc@16 @423 NONAME
?ScrollToBottom@CSrmmBaseDialog@@UAEXXZ @427 NONAME
?UpdateNickList@CSrmmBaseDialog@@UAEXXZ @428 NONAME
Clist_ClearSearch @429 NONAME
+?onClick_BIU@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @430 NONAME
+?onClick_BkColor@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @431 NONAME
+?onClick_Color@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @432 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 0802a90a7f..7f8659dd96 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -400,9 +400,9 @@ ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QEAAXK@Z @402 NONAME
??0CSrmmBaseDialog@@IEAA@PEAUHINSTANCE__@@HPEAUSESSION_INFO@@@Z @403 NONAME
-??0CSrmmBaseDialog@@QEAA@AEBV0@@Z @404 NONAME
+??0CSrmmBaseDialog@@AEAA@AEBV0@@Z @404 NONAME
??1CSrmmBaseDialog@@UEAA@XZ @405 NONAME
-??4CSrmmBaseDialog@@QEAAAEAV0@AEBV0@@Z @406 NONAME
+??4CSrmmBaseDialog@@AEAAAEAV0@AEBV0@@Z @406 NONAME
??_7CSrmmBaseDialog@@6B@ @407 NONAME
?DlgProc@CSrmmBaseDialog@@MEAA_JI_K_J@Z @408 NONAME
??2CSrmmBaseDialog@@SAPEAX_K@Z @409 NONAME
@@ -426,3 +426,6 @@ Srmm_ButtonSubclassProc @423 NONAME
?ScrollToBottom@CSrmmBaseDialog@@UEAAXXZ @427 NONAME
?UpdateNickList@CSrmmBaseDialog@@UEAAXXZ @428 NONAME
Clist_ClearSearch @429 NONAME
+?onClick_BIU@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @430 NONAME
+?onClick_BkColor@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @431 NONAME
+?onClick_Color@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @432 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 8df17b3fd7..d95ed32a65 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -29,18 +29,27 @@ extern HCURSOR g_hCurHyperlinkHand;
CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si)
: CDlgBase(hInst, idDialog),
+ m_btnFilter(this, IDC_SRMM_FILTER),
+ 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),
+
m_si(si),
m_pLog(nullptr),
m_pEntry(nullptr),
- m_pFilter(nullptr),
- m_pColor(nullptr),
- m_pBkColor(nullptr),
- m_hContact(0)
+ m_hContact(0),
+ m_clrInputBG(GetSysColor(COLOR_WINDOW))
{
m_bFilterEnabled = db_get_b(0, CHAT_MODULE, "FilterEnabled", 0) != 0;
m_bNicklistEnabled = db_get_b(0, CHAT_MODULE, "ShowNicklist", 1) != 0;
m_iLogFilterFlags = db_get_dw(0, CHAT_MODULE, "FilterFlags", 0x03E0);
+ m_btnColor.OnClick = Callback(this, &CSrmmBaseDialog::onClick_Color);
+ m_btnBkColor.OnClick = Callback(this, &CSrmmBaseDialog::onClick_BkColor);
+ m_btnBold.OnClick = m_btnItalic.OnClick = m_btnUnderline.OnClick = Callback(this, &CSrmmBaseDialog::onClick_BIU);
+
if (si) {
m_hContact = si->hContact;
@@ -58,6 +67,18 @@ 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)
+{
+}
+
+CSrmmBaseDialog& CSrmmBaseDialog::operator=(const CSrmmBaseDialog&)
+{
+ return *this;
+}
+
INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -180,3 +201,70 @@ void CSrmmBaseDialog::RedrawLog2()
if (m_si->pLog)
StreamInEvents(m_si->pLogEnd, TRUE);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CSrmmBaseDialog::onClick_Color(CCtrlButton *pButton)
+{
+ if (!pButton->Enabled())
+ return;
+
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
+ cf.dwMask = CFM_COLOR;
+
+ if (IsDlgButtonChecked(m_hwnd, pButton->GetCtrlId())) {
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0) {
+ ShowColorChooser(pButton->GetCtrlId());
+ return;
+ }
+ if (m_bFGSet)
+ cf.crTextColor = chatApi.MM_FindModule(m_si->pszModule)->crColors[m_iFG];
+ }
+ else cf.crTextColor = m_clrInputFG;
+
+ m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+}
+
+void CSrmmBaseDialog::onClick_BkColor(CCtrlButton *pButton)
+{
+ if (!pButton->Enabled())
+ return;
+
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
+ cf.dwMask = CFM_BACKCOLOR;
+
+ if (IsDlgButtonChecked(m_hwnd, pButton->GetCtrlId())) {
+ if (!db_get_b(0, CHAT_MODULE, "RightClickFilter", 0)) {
+ ShowColorChooser(pButton->GetCtrlId());
+ return;
+ }
+ if (m_bBGSet)
+ cf.crBackColor = chatApi.MM_FindModule(m_si->pszModule)->crColors[m_iBG];
+ }
+ else cf.crBackColor = m_clrInputBG;
+
+ m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+}
+
+void CSrmmBaseDialog::onClick_BIU(CCtrlButton *pButton)
+{
+ if (!pButton->Enabled())
+ return;
+
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
+ cf.dwEffects = 0;
+
+ if (IsDlgButtonChecked(m_hwnd, IDC_SRMM_BOLD))
+ cf.dwEffects |= CFE_BOLD;
+ if (IsDlgButtonChecked(m_hwnd, IDC_SRMM_ITALICS))
+ cf.dwEffects |= CFE_ITALIC;
+ if (IsDlgButtonChecked(m_hwnd, IDC_SRMM_UNDERLINE))
+ cf.dwEffects |= CFE_UNDERLINE;
+ m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+}
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp
index e9aeffc33c..d1b8be54cd 100644
--- a/src/mir_app/src/srmm_util.cpp
+++ b/src/mir_app/src/srmm_util.cpp
@@ -82,12 +82,19 @@ EXTERN_C MIR_APP_DLL(LRESULT) CALLBACK Srmm_ButtonSubclassProc(HWND hwnd, UINT m
if (pDlg == nullptr)
break;
- if (hwnd == pDlg->m_pFilter->GetHwnd())
+ switch (GetDlgCtrlID(hwnd)) {
+ case IDC_SRMM_FILTER:
pDlg->ShowFilterMenu();
- else if (hwnd == pDlg->m_pColor->GetHwnd())
- pDlg->ShowColorChooser(pDlg->m_pColor->GetCtrlId());
- else if (hwnd == pDlg->m_pBkColor->GetHwnd())
- pDlg->ShowColorChooser(pDlg->m_pBkColor->GetCtrlId());
+ break;
+
+ case IDC_SRMM_COLOR:
+ pDlg->ShowColorChooser(IDC_SRMM_COLOR);
+ break;
+
+ case IDC_SRMM_BKGCOLOR:
+ pDlg->ShowColorChooser(IDC_SRMM_BKGCOLOR);
+ break;
+ }
}
break;
}