diff options
-rw-r--r-- | include/m_chat.h | 15 | ||||
-rw-r--r-- | include/m_chat_int.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 45 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_svc.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 90 |
6 files changed, 58 insertions, 101 deletions
diff --git a/include/m_chat.h b/include/m_chat.h index ea716ea040..49c3a41dfa 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -125,16 +125,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// Flags
-#define GC_BOLD 0x0001 // enable the 'bold' button
-#define GC_ITALICS 0x0002 // enable the 'italics' button
-#define GC_UNDERLINE 0x0004 // enable the 'underline' button
-#define GC_COLOR 0x0008 // enable the 'foreground color' button
-#define GC_BKGCOLOR 0x0010 // enable the 'background color' button
-#define GC_ACKMSG 0x0020 // the protocol must acknowlege messages sent
-#define GC_TYPNOTIF 0x0040 // enable typing notifications.
-#define GC_CHANMGR 0x0080 // enable the 'channel settings' button
-#define GC_DATABASE 0x0100 // all events are backed in the database
-#define GC_PERSISTENT 0x0200 // chat structure is stored offline not to retrieve it each time
+#define GC_CHANMGR 0x0001 // enable the 'channel settings' button
+#define GC_DATABASE 0x0002 // all events are backed in the database
+#define GC_PERSISTENT 0x0004 // chat structure is stored offline not to retrieve it each time
+#define GC_ACKMSG 0x0008 // the protocol must acknowlege messages sent
+#define GC_TYPNOTIF 0x0010 // enable typing notifications.
// Error messages
#define GC_ERROR 1 // An internal error occurred.
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 2d01f08ff4..bd9f340d41 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -103,8 +103,6 @@ struct MIR_APP_EXPORT GCModuleInfoBase : public MZeroedObject, public MNonCopyab char* pszModule;
wchar_t* ptszModDispName;
- bool bBold, bItalics, bUnderline;
- bool bColor, bBkgColor;
bool bChanMgr, bAckMsg, bDatabase, bPersistent;
int iMaxText;
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index f74673c8dd..e229888c22 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -260,8 +260,6 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else idx += 5;
- MODULEINFO *mi = (isChat()) ? m_si->pMI : nullptr;
-
bool bInsideColor = false, bInsideUl = false;
CMStringW res;
@@ -284,14 +282,12 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const if (iCol > 0) {
if (isChat()) {
- if (mi && mi->bColor) {
- if (iInd >= 0) {
- if (!(res.IsEmpty() && m_pContainer->m_theme.fontColors[MSGFONTID_MESSAGEAREA] == pColors[iInd]))
- res.AppendFormat(L"%%c%u", iInd);
- }
- else if (!res.IsEmpty())
- res.Append(L"%%C");
+ if (iInd >= 0) {
+ if (!(res.IsEmpty() && m_pContainer->m_theme.fontColors[MSGFONTID_MESSAGEAREA] == pColors[iInd]))
+ res.AppendFormat(L"%%c%u", iInd);
}
+ else if (!res.IsEmpty())
+ res.Append(L"%%C");
}
else res.AppendFormat((iInd >= 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_clrs[iInd].szName);
}
@@ -300,16 +296,14 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\highlight", 10)) { // background color
if (isChat()) {
- if (mi && mi->bBkgColor) {
- int iInd = RtfColorToIndex(iNumColors, pIndex, _wtoi(p + 10));
- if (iInd >= 0) {
- // if the entry field is empty & the color passed is the back color, skip it
- if (!(res.IsEmpty() && m_pContainer->m_theme.inputbg == pColors[iInd]))
- res.AppendFormat(L"%%f%u", iInd);
- }
- else if (!res.IsEmpty())
- res.AppendFormat(L"%%F");
+ int iInd = RtfColorToIndex(iNumColors, pIndex, _wtoi(p + 10));
+ if (iInd >= 0) {
+ // if the entry field is empty & the color passed is the back color, skip it
+ if (!(res.IsEmpty() && m_pContainer->m_theme.inputbg == pColors[iInd]))
+ res.AppendFormat(L"%%f%u", iInd);
}
+ else if (!res.IsEmpty())
+ res.AppendFormat(L"%%F");
}
}
else if (!wcsncmp(p, L"\\line", 5)) { // soft line break;
@@ -338,8 +332,7 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\b", 2)) { //bold
if (isChat()) {
- if (mi && mi->bBold)
- res.Append((p[2] != '0') ? L"%b" : L"%B");
+ res.Append((p[2] != '0') ? L"%b" : L"%B");
}
else {
if (!(lf.lfWeight == FW_BOLD)) // only allow bold if the font itself isn't a bold one, otherwise just strip it..
@@ -349,13 +342,10 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\i", 2)) { // italics
if (isChat()) {
- if (mi && mi->bItalics)
- res.Append((p[2] != '0') ? L"%i" : L"%I");
- }
- else {
- if (!lf.lfItalic && m_bSendFormat)
- res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
+ res.Append((p[2] != '0') ? L"%i" : L"%I");
}
+ else 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_bSendFormat)
@@ -363,8 +353,7 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
if (isChat()) {
- if (mi && mi->bUnderline)
- res.Append((p[3] != '0') ? L"%u" : L"%U");
+ res.Append((p[3] != '0') ? L"%u" : L"%U");
}
else {
if (!lf.lfUnderline && m_bSendFormat) {
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 284590ecba..8d8c4bd23f 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -67,7 +67,7 @@ CIrcProto::CIrcProto(const char* szModuleName, const wchar_t* tszUserName) : // group chats
GCREGISTER gcr = {};
- gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR;
+ gcr.dwFlags = GC_CHANMGR;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index b07278669d..368cdd51e0 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -178,11 +178,6 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr) return GC_ERROR;
mi->ptszModDispName = mir_wstrdup(gcr->ptszDispName);
- mi->bBold = (gcr->dwFlags & GC_BOLD) != 0;
- mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0;
- mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0;
- mi->bColor = (gcr->dwFlags & GC_COLOR) != 0;
- mi->bBkgColor = (gcr->dwFlags & GC_BKGCOLOR) != 0;
mi->bAckMsg = (gcr->dwFlags & GC_ACKMSG) != 0;
mi->bChanMgr = (gcr->dwFlags & GC_CHANMGR) != 0;
mi->bDatabase = (gcr->dwFlags & GC_DATABASE) != 0;
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 3002622535..0317da383b 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -73,14 +73,9 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, SESSION_IN if (si) {
m_hContact = si->hContact;
- if (si->pMI->bColor) {
- m_iFG = 4;
- m_bFGSet = true;
- }
- if (si->pMI->bBkgColor) {
- m_iBG = 2;
- m_bBGSet = true;
- }
+ m_iFG = 4;
+ m_iBG = 2;
+ m_bFGSet = m_bBGSet = true;
m_bFilterEnabled = db_get_b(m_hContact, CHAT_MODULE, "FilterEnabled", Chat::bFilterEnabled) != 0;
m_iLogFilterFlags = Chat::iFilterFlags;
@@ -689,11 +684,6 @@ void CSrmmBaseDialog::UpdateChatOptions() UpdateFilterButton();
MODULEINFO *mi = m_si->pMI;
- m_btnBold.Enable(mi->bBold);
- m_btnColor.Enable(mi->bColor);
- m_btnItalic.Enable(mi->bItalics);
- m_btnBkColor.Enable(mi->bBkgColor);
- m_btnUnderline.Enable(mi->bUnderline);
if (m_si->iType == GCW_CHATROOM)
m_btnChannelMgr.Enable(mi->bChanMgr);
@@ -1076,48 +1066,38 @@ void CSrmmBaseDialog::RefreshButtonStatus() cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR;
m_message.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- if (m_si->pMI->bColor) {
- bool bState = m_btnColor.IsPushed();
- if (!bState && cf.crTextColor != m_clrInputFG)
- m_btnColor.Push(true);
- else if (bState && cf.crTextColor == m_clrInputFG)
- m_btnColor.Push(false);
- }
-
- if (m_si->pMI->bBkgColor) {
- bool bState = m_btnBkColor.IsPushed();
- if (!bState && cf.crBackColor != m_clrInputBG)
- m_btnBkColor.Push(true);
- else if (bState && cf.crBackColor == m_clrInputBG)
- m_btnBkColor.Push(false);
- }
-
- if (m_si->pMI->bBold) {
- bool bState = m_btnBold.IsPushed();
- UINT u2 = cf.dwEffects & CFE_BOLD;
- if (!bState && u2 != 0)
- m_btnBold.Push(true);
- else if (bState && u2 == 0)
- m_btnBold.Push(false);
- }
-
- if (m_si->pMI->bItalics) {
- bool bState = m_btnItalic.IsPushed();
- UINT u2 = cf.dwEffects & CFE_ITALIC;
- if (!bState && u2 != 0)
- m_btnItalic.Push(true);
- else if (bState && u2 == 0)
- m_btnItalic.Push(false);
- }
-
- if (m_si->pMI->bUnderline) {
- bool bState = m_btnUnderline.IsPushed();
- UINT u2 = cf.dwEffects & CFE_UNDERLINE;
- if (!bState && u2 != 0)
- m_btnUnderline.Push(true);
- else if (bState && u2 == 0)
- m_btnUnderline.Push(false);
- }
+ bool bState = m_btnColor.IsPushed();
+ if (!bState && cf.crTextColor != m_clrInputFG)
+ m_btnColor.Push(true);
+ else if (bState && cf.crTextColor == m_clrInputFG)
+ m_btnColor.Push(false);
+
+ bState = m_btnBkColor.IsPushed();
+ if (!bState && cf.crBackColor != m_clrInputBG)
+ m_btnBkColor.Push(true);
+ else if (bState && cf.crBackColor == m_clrInputBG)
+ m_btnBkColor.Push(false);
+
+ bState = m_btnBold.IsPushed();
+ UINT u2 = cf.dwEffects & CFE_BOLD;
+ if (!bState && u2 != 0)
+ m_btnBold.Push(true);
+ else if (bState && u2 == 0)
+ m_btnBold.Push(false);
+
+ bState = m_btnItalic.IsPushed();
+ u2 = cf.dwEffects & CFE_ITALIC;
+ if (!bState && u2 != 0)
+ m_btnItalic.Push(true);
+ else if (bState && u2 == 0)
+ m_btnItalic.Push(false);
+
+ bState = m_btnUnderline.IsPushed();
+ u2 = cf.dwEffects & CFE_UNDERLINE;
+ if (!bState && u2 != 0)
+ m_btnUnderline.Push(true);
+ else if (bState && u2 == 0)
+ m_btnUnderline.Push(false);
}
void CSrmmBaseDialog::SetQuoteEvent(MEVENT hEvent)
|