summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/msgdialog.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-07-26 21:16:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-07-26 21:16:34 +0300
commit2fdfdda14b5703240f08a0b4e278185807681e1d (patch)
tree001cc8a34765d17033fab731c87487ceb85a4680 /plugins/TabSRMM/src/msgdialog.cpp
parentfb92f8a1757fe24e3407bfbae042376d3e0233a9 (diff)
TabSMM: wrongly removed functionality returned back (color chooser in SRMM dialog)
Diffstat (limited to 'plugins/TabSRMM/src/msgdialog.cpp')
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 6d7abf92cd..3af970f9d9 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -581,6 +581,7 @@ CSrmmWindow::CSrmmWindow()
m_btnOk.OnClick = Callback(this, &CSrmmWindow::onClick_Ok);
m_btnAdd.OnClick = Callback(this, &CSrmmWindow::onClick_Add);
m_btnQuote.OnClick = Callback(this, &CSrmmWindow::onClick_Quote);
+ m_btnColor.OnClick = Callback(this, &CSrmmWindow::onClick_Color);
m_btnCancelAdd.OnClick = Callback(this, &CSrmmWindow::onClick_CancelAdd);
m_message.OnChange = Callback(this, &CSrmmWindow::onChange_Message);
@@ -1187,6 +1188,42 @@ void CSrmmWindow::onClick_Add(CCtrlButton*)
}
}
+void CSrmmWindow::onClick_Color(CCtrlButton *pButton)
+{
+ CHARFORMAT2 cf;
+ ZeroMemory(&cf, sizeof(CHARFORMAT2));
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_COLOR;
+ cf.dwEffects = 0;
+
+ RECT rc;
+ GetWindowRect(pButton->GetHwnd(), &rc);
+ int iSelection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 7), TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL);
+ if (iSelection == ID_FONT_CLEARALLFORMATTING) {
+ cf.dwMask = CFM_BOLD | CFM_COLOR | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT;
+ cf.crTextColor = M.GetDword(FONTMODULE, "Font16Col", 0);
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ return;
+ }
+
+ if (iSelection == ID_FONT_DEFAULTCOLOR) {
+ cf.crTextColor = M.GetDword(FONTMODULE, "Font16Col", 0);
+ for (int i = 0; i < Utils::rtf_ctable_size; i++)
+ if (Utils::rtf_ctable[i].clr == cf.crTextColor)
+ cf.crTextColor = RGB(GetRValue(cf.crTextColor), GetGValue(cf.crTextColor), GetBValue(cf.crTextColor) == 0 ? GetBValue(cf.crTextColor) + 1 : GetBValue(cf.crTextColor) - 1);
+
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ return;
+ }
+
+ for (int i = 0; i < RTF_CTABLE_DEFSIZE; i++) {
+ if (Utils::rtf_ctable[i].menuid == iSelection) {
+ cf.crTextColor = Utils::rtf_ctable[i].clr;
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ }
+}
+
void CSrmmWindow::onClick_Quote(CCtrlButton*)
{
CHARRANGE sel;