summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src/utils.cpp')
-rw-r--r--plugins/TabSRMM/src/utils.cpp41
1 files changed, 7 insertions, 34 deletions
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 3608625705..df7dae8015 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -112,7 +112,7 @@ search_again:
c_closing = colorname.GetLength();
const wchar_t *wszColname = colorname.c_str();
if (endmark != -1 && c_closing > 2 && c_closing <= 6 && iswalnum(colorname[0]) && iswalnum(colorname[c_closing - 1])) {
- Utils::RTF_ColorAdd(wszColname, c_closing);
+ Utils::RTF_ColorAdd(wszColname);
if (!was_added) {
clr_was_added = was_added = true;
goto search_again;
@@ -414,49 +414,22 @@ int CTabBaseDlg::FindRTLLocale()
/////////////////////////////////////////////////////////////////////////////////////////
// init default color table. the table may grow when using custom colors via bbcodes
-static TRTFColorTable _rtf_ctable[] =
-{
- { L"black", 0, ID_FONT_BLACK },
- { L"", RGB(0,0,128), -1 },
- { L"", RGB(0,128,128), -1 },
- { L"", RGB(128,0,128), -1 },
- { L"", RGB(0,128,0), -1 },
- { L"", RGB(128,128,0), -1 },
- { L"", RGB(128,0,0), -1 },
- { L"", RGB(128,128,128), -1 },
-
- { L"", RGB(192,192,192), -1 },
- { L"blue", RGB(0, 0, 255), ID_FONT_BLUE },
- { L"cyan", RGB(0, 255, 255), ID_FONT_CYAN },
- { L"magenta", RGB(255, 0, 255), ID_FONT_MAGENTA },
- { L"green", RGB(0, 255, 0), ID_FONT_GREEN },
- { L"yellow", RGB(255, 255, 0), ID_FONT_YELLOW },
- { L"red", RGB(255, 0, 0), ID_FONT_RED },
- { L"white", RGB(255, 255, 255), ID_FONT_WHITE }
-};
-
void Utils::RTF_CTableInit()
{
- for (int i = 0; i < _countof(_rtf_ctable); i++)
- rtf_clrs.insert(new TRTFColorTable(_rtf_ctable[i]));
+ int iTableSize;
+ COLORREF *pTable = Srmm_GetColorTable(&iTableSize);
+ for (int i = 0; i < iTableSize; i++)
+ rtf_clrs.insert(new TRTFColorTable(L"", pTable[i]));
}
/////////////////////////////////////////////////////////////////////////////////////////
// add a color to the global rtf color table
-void Utils::RTF_ColorAdd(const wchar_t *tszColname, size_t length)
+void Utils::RTF_ColorAdd(const wchar_t *tszColname)
{
- TRTFColorTable *p = new TRTFColorTable;
-
wchar_t *stopped;
COLORREF clr = wcstol(tszColname, &stopped, 16);
- mir_snwprintf(p->szName, length + 1, L"%06x", clr);
- p->menuid = 0;
-
- clr = wcstol(tszColname, &stopped, 16);
- p->clr = (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr)));
-
- rtf_clrs.insert(p);
+ rtf_clrs.insert(new TRTFColorTable(tszColname, RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr))));
}
/////////////////////////////////////////////////////////////////////////////////////////