diff options
author | George Hazan <ghazan@miranda.im> | 2017-07-26 21:16:34 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-07-26 21:16:34 +0300 |
commit | 2fdfdda14b5703240f08a0b4e278185807681e1d (patch) | |
tree | 001cc8a34765d17033fab731c87487ceb85a4680 /plugins/TabSRMM/src/msgdlgutils.cpp | |
parent | fb92f8a1757fe24e3407bfbae042376d3e0233a9 (diff) |
TabSMM: wrongly removed functionality returned back (color chooser in SRMM dialog)
Diffstat (limited to 'plugins/TabSRMM/src/msgdlgutils.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index a3f47459f5..9800e43e42 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -823,15 +823,6 @@ static void CreateColorMap(CMStringW &Text, int iCount, COLORREF *pSrc, int *pDs }
}
-static int GetRtfIndex(int iCol, int iCount, int *pIndex)
-{
- for (int i = 0; i < iCount; i++)
- if (pIndex[i] == iCol)
- return i;
-
- return -1;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// convert rich edit code to bbcode (if wanted). Otherwise, strip all RTF formatting
// tags and return plain text
@@ -876,12 +867,17 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pCol if (!wcsncmp(p, L"\\cf", 3)) { // foreground color
int iCol = _wtoi(p + 3);
- int iInd = GetRtfIndex(iCol, iNumColors, pIndex);
+ int iInd = -1;
+ for (int i = 0; i < iNumColors; i++)
+ if (pIndex[i] == iCol) {
+ iInd = i;
+ break;
+ }
if (iCol && !isChat())
- res.AppendFormat((iInd > 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_ctable[iInd - 1].szName);
+ res.AppendFormat((iInd >= 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_ctable[iInd].szName);
- bInsideColor = iInd > 0;
+ bInsideColor = iInd >= 0;
}
else if (!wcsncmp(p, L"\\highlight", 10)) { //background color
wchar_t szTemp[20];
|