diff options
Diffstat (limited to 'plugins/TabSRMM/src/msgdialog.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 37 |
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;
|