diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-22 12:32:10 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-22 12:32:10 +0300 |
commit | 114e7ce32efdc1f4a33f8160efb5d5c797e45d3f (patch) | |
tree | af9a965410868e3cccd108d32dc2100d5577cf5e /plugins/TabSRMM | |
parent | ffdb84b18d41ef3b41b5f76849c249b70a1794e6 (diff) |
code cleaning
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 14 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 2 |
4 files changed, 17 insertions, 23 deletions
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index efd782565d..1549d03e63 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -173,7 +173,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara case IDC_SRMM_ITALICS:
case IDC_SRMM_UNDERLINE:
case IDC_FONTSTRIKEOUT:
- if (m_SendFormat != 0) { // dont use formatting if disabled
+ if (m_bSendFormat) { // dont use formatting if disabled
CHARFORMAT2 cf, cfOld;
memset(&cf, 0, sizeof(CHARFORMAT2));
memset(&cfOld, 0, sizeof(CHARFORMAT2));
@@ -246,7 +246,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara submenu = GetSubMenu(PluginConfig.g_hMenuContext, 4);
{
bool iOldGlobalSendFormat = g_plugin.bSendFormat;
- int iLocalFormat = M.GetDword(m_hContact, "sendformat", 0);
+ int iLocalFormat = M.GetDword(m_hContact, "sendformat", -1);
int iNewLocalFormat = iLocalFormat;
GetWindowRect(GetDlgItem(m_hwnd, IDC_PROTOCOL), &rc);
@@ -291,7 +291,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara break;
case ID_THISCONTACT_GLOBALSETTING:
- iNewLocalFormat = 0;
+ iNewLocalFormat = -1;
break;
case ID_THISCONTACT_BBCODE:
@@ -299,19 +299,17 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara break;
case ID_THISCONTACT_OFF:
- iNewLocalFormat = -1;
+ iNewLocalFormat = SENDFORMAT_NONE;
break;
}
- if (iNewLocalFormat == 0)
+ if (iNewLocalFormat == -1)
db_unset(m_hContact, SRMSGMOD_T, "sendformat");
else if (iNewLocalFormat != iLocalFormat)
db_set_dw(m_hContact, SRMSGMOD_T, "sendformat", iNewLocalFormat);
if (iNewLocalFormat != iLocalFormat || g_plugin.bSendFormat != iOldGlobalSendFormat) {
- m_SendFormat = M.GetDword(m_hContact, "sendformat", g_plugin.bSendFormat);
- if (m_SendFormat == -1) // per contact override to disable it..
- m_SendFormat = 0;
+ GetSendFormat();
Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1);
}
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 5d34a57ecd..990bb3f80d 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -127,7 +127,7 @@ void CMsgDialog::SetDialogToType() ShowMultipleControls(m_hwnd, errorControls, _countof(errorControls), m_bErrorState ? SW_SHOW : SW_HIDE);
- if (!m_SendFormat)
+ if (!m_bSendFormat)
ShowMultipleControls(m_hwnd, formatControls, _countof(formatControls), SW_HIDE);
if (m_pContainer->m_hwndActive == m_hwnd)
@@ -574,7 +574,7 @@ bool CMsgDialog::OnInitDialog() UpdateTitle();
m_hTabIcon = m_hTabStatusIcon;
- if (!m_SendFormat)
+ if (!m_bSendFormat)
ShowMultipleControls(m_hwnd, formatControls, _countof(formatControls), SW_HIDE);
UpdateNickList();
@@ -780,7 +780,7 @@ void CMsgDialog::onClick_Ok(CCtrlButton *) fi.chrg.cpMin = 0;
fi.chrg.cpMax = -1;
fi.lpstrText = L"{";
- final_sendformat = m_message.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? m_SendFormat : 0;
+ final_sendformat = m_message.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? m_bSendFormat : 0;
fi.lpstrText = L"}";
final_sendformat = m_message.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
}
@@ -865,7 +865,7 @@ void CMsgDialog::onClick_Ok(CCtrlButton *) if (m_sendMode & SMODE_CONTAINER && m_pContainer->m_hwndActive == m_hwnd && GetForegroundWindow() == m_pContainer->m_hwnd) {
int tabCount = TabCtrl_GetItemCount(m_hwndParent);
- ptrA szFromStream(m_message.GetRichTextRtf(!m_SendFormat));
+ ptrA szFromStream(m_message.GetRichTextRtf(!m_bSendFormat));
for (int i = 0; i < tabCount; i++) {
// get the contact from the tabs lparam which hopefully is the tabs hwnd so we can get its userdata.... hopefully
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index ab8093c632..d6e595d351 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -343,7 +343,7 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else {
if (!(lf.lfWeight == FW_BOLD)) // only allow bold if the font itself isn't a bold one, otherwise just strip it..
- if (m_SendFormat)
+ if (m_bSendFormat)
res.Append((p[2] != '0') ? L"[b]" : L"[/b]");
}
}
@@ -353,12 +353,12 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const res.Append((p[2] != '0') ? L"%i" : L"%I");
}
else {
- if (!lf.lfItalic && m_SendFormat)
+ if (!lf.lfItalic && m_bSendFormat)
res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
}
}
else if (!wcsncmp(p, L"\\strike", 7)) { // strike-out
- if (!lf.lfStrikeOut && m_SendFormat)
+ if (!lf.lfStrikeOut && m_bSendFormat)
res.Append((p[7] != '0') ? L"[s]" : L"[/s]");
}
else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
@@ -367,7 +367,7 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const res.Append((p[3] != '0') ? L"%u" : L"%U");
}
else {
- if (!lf.lfUnderline && m_SendFormat) {
+ if (!lf.lfUnderline && m_bSendFormat) {
if (p[3] == 0 || wcschr(tszRtfBreaks, p[3])) {
res.Append(L"[u]");
bInsideUl = true;
@@ -1217,11 +1217,7 @@ LRESULT CMsgDialog::GetSendButtonState() void CMsgDialog::GetSendFormat()
{
- m_SendFormat = M.GetDword(m_hContact, "sendformat", g_plugin.bSendFormat);
- if (m_SendFormat == -1) // per contact override to disable it..
- m_SendFormat = 0;
- else if (m_SendFormat == 0)
- m_SendFormat = g_plugin.bSendFormat;
+ m_bSendFormat = M.GetDword(m_hContact, "sendformat", g_plugin.bSendFormat) != 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -2205,7 +2201,7 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) hSubMenu = GetSubMenu(hMenu, 0);
else {
hSubMenu = GetSubMenu(hMenu, 2);
- EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, m_SendFormat != 0 ? MF_ENABLED : MF_GRAYED);
+ EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, m_bSendFormat ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(hSubMenu, ID_EDITOR_PASTEANDSENDIMMEDIATELY, g_plugin.bPasteAndSend ? MF_ENABLED : MF_GRAYED);
CheckMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, PluginConfig.m_visualMessageSizeIndicator ? MF_CHECKED : MF_UNCHECKED);
EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, m_pContainer->m_hwndStatus ? MF_ENABLED : MF_GRAYED);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 0ac4ab7ea3..3d39d57333 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -469,12 +469,12 @@ class CMsgDialog : public CSrmmBaseDialog bool m_bInsertMode, m_bInitMode = true;
bool m_bDeferredScroll;
bool m_bWasBackgroundCreate;
+ bool m_bSendFormat;
int m_iRealAvatarHeight;
int m_iButtonBarReallyNeeds;
uint32_t m_dwLastActivity;
MEVENT m_hFlashingEvent;
- int m_SendFormat;
LCID m_lcid;
wchar_t m_lcID[10];
int m_iPanelAvatarX, m_iPanelAvatarY;
|