summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h6
-rw-r--r--plugins/Scriver/src/chat_window.cpp2
-rw-r--r--plugins/TabSRMM/src/chat.h3
-rw-r--r--plugins/TabSRMM/src/chat_log.cpp11
-rw-r--r--plugins/TabSRMM/src/chat_options.cpp1
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp13
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp2
-rw-r--r--protocols/AimOscar/src/chat.cpp4
-rw-r--r--protocols/Discord/src/proto.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/IRCG/src/ircproto.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp4
-rw-r--r--protocols/MSN/src/msn_proto.cpp4
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp6
-rw-r--r--src/core/stdmsg/src/chat_window.cpp2
-rw-r--r--src/core/stdmsg/src/stdafx.h2
-rw-r--r--src/mir_app/src/chat.h4
-rw-r--r--src/mir_app/src/chat_log.cpp5
-rw-r--r--src/mir_app/src/chat_manager.cpp16
-rw-r--r--src/mir_app/src/chat_svc.cpp10
-rw-r--r--src/mir_app/src/chat_tools.cpp42
-rw-r--r--src/mir_app/src/clc.h6
-rw-r--r--src/mir_app/src/clcutils.cpp4
-rw-r--r--src/mir_app/src/colorchooser.cpp60
-rw-r--r--src/mir_app/src/srmm_base.cpp18
25 files changed, 57 insertions, 180 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index c1bee5babe..25824d40e8 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -94,8 +94,6 @@ struct GCModuleInfoBase
bool bChanMgr, bAckMsg;
int iMaxText;
- int nColorCount;
- COLORREF *crColors;
};
struct COMMANDINFO
@@ -274,7 +272,6 @@ struct CHAT_MANAGER
MODULEINFO* (*MM_AddModule)(const char *pszModule);
MODULEINFO* (*MM_FindModule)(const char *pszModule);
- void (*MM_FixColors)();
void (*MM_FontsChanged)(void);
void (*MM_IconsChanged)(void);
BOOL (*MM_RemoveAll)(void);
@@ -308,7 +305,7 @@ struct CHAT_MANAGER
MCONTACT (*FindRoom)(const char *pszModule, const wchar_t *pszRoom);
char* (*Log_CreateRTF)(LOGSTREAMDATA *streamData);
- char* (*Log_CreateRtfHeader)(MODULEINFO *mi);
+ char* (*Log_CreateRtfHeader)(void);
void (*LoadMsgDlgFont)(int i, LOGFONT *lf, COLORREF *color);
wchar_t* (*MakeTimeStamp)(wchar_t *pszStamp, time_t time);
@@ -318,7 +315,6 @@ struct CHAT_MANAGER
int (*ShowPopup)(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, wchar_t* pszRoomName, COLORREF crBkg, const wchar_t* fmt, ...);
BOOL (*LogToFile)(SESSION_INFO *si, GCEVENT *gce);
wchar_t* (*GetChatLogsFilename)(SESSION_INFO *si, time_t tTime);
- int (*GetColorIndex)(const char *pszModule, COLORREF cr);
char* (*Log_SetStyle)(int style);
bool (*IsHighlighted)(SESSION_INFO *si, GCEVENT *pszText);
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index 87e7c52d51..4f0c190a0c 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -327,7 +327,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
cmdList = tcmdlist_append(cmdList, pszRtf, 20, FALSE);
CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
- pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
+ pci->DoRtfToTags(ptszText, 0, nullptr);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h
index 987f30696d..209f935638 100644
--- a/plugins/TabSRMM/src/chat.h
+++ b/plugins/TabSRMM/src/chat.h
@@ -97,7 +97,7 @@ extern TMUCSettings g_Settings;
//////////////////////////////////////////////////////////////////////////////////
// log.c
-char* Log_CreateRtfHeader(MODULEINFO *mi);
+char* Log_CreateRtfHeader(void);
char* Log_CreateRTF(LOGSTREAMDATA *streamData);
// options.c
@@ -122,7 +122,6 @@ int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus);
// tools.c
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
-int Chat_GetColorIndex(const char* pszModule, COLORREF cr);
wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2);
bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex);
diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp
index cda3695494..182c8f2618 100644
--- a/plugins/TabSRMM/src/chat_log.cpp
+++ b/plugins/TabSRMM/src/chat_log.cpp
@@ -631,7 +631,7 @@ static void AddEventToBuffer(CMStringA &str, LOGSTREAMDATA *streamData)
}
}
-char* Log_CreateRtfHeader(MODULEINFO *mi)
+char* Log_CreateRtfHeader(void)
{
// get the number of pixels per logical inch
if (pci->logPixelSY == 0) {
@@ -654,9 +654,6 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
for (int i = 0; i < OPTIONS_FONTCOUNT; i++)
str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(pci->aFonts[i].color), GetGValue(pci->aFonts[i].color), GetBValue(pci->aFonts[i].color));
- for (int i = 0; i < mi->nColorCount; i++)
- str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(mi->crColors[i]), GetGValue(mi->crColors[i]), GetBValue(mi->crColors[i]));
-
for (int i = 0; i < STATUSICONCOUNT; i++)
str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(g_Settings.nickColors[i]), GetGValue(g_Settings.nickColors[i]), GetBValue(g_Settings.nickColors[i]));
@@ -702,11 +699,11 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
// ### RTF HEADER
- if (0 == mi->pszHeader)
- mi->pszHeader = Log_CreateRtfHeader(mi);
+ if (mi->pszHeader == nullptr)
+ mi->pszHeader = Log_CreateRtfHeader();
char *header = mi->pszHeader;
- streamData->crCount = mi->nColorCount;
+ streamData->crCount = 0;
CMStringA str;
if (header)
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp
index 24e66f19cf..8d459906bd 100644
--- a/plugins/TabSRMM/src/chat_options.cpp
+++ b/plugins/TabSRMM/src/chat_options.cpp
@@ -881,7 +881,6 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
pci->ReloadSettings();
pci->MM_FontsChanged();
- pci->MM_FixColors();
Chat_UpdateOptions();
PluginConfig.reloadSettings();
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index 463b48320f..2377e9a7e4 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -451,19 +451,6 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
return TRUE;
}
-int Chat_GetColorIndex(const char* pszModule, COLORREF cr)
-{
- MODULEINFO *pMod = pci->MM_FindModule(pszModule);
- if (!pMod || pMod->nColorCount == 0)
- return -1;
-
- for (int i = 0; i < pMod->nColorCount; i++)
- if (pMod->crColors[i] == cr)
- return i;
-
- return -1;
-}
-
wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2)
{
int i, j, k;
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index cb105d1aee..2a9c2a8698 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -639,7 +639,7 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*)
if (ptszText.IsEmpty())
return;
- DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
+ DoRtfToTags(ptszText, 0, nullptr);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index 75940fdd18..79cb6d6af1 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -18,14 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-static const COLORREF crCols[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
-
void CAimProto::chat_register(void)
{
GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
- gcr.nColors = 16;
- gcr.pColors = (COLORREF*)crCols;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index a2550ec601..59fd938409 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -572,14 +572,10 @@ HANDLE CDiscordProto::SendFile(MCONTACT hContact, const wchar_t *szDescription,
/////////////////////////////////////////////////////////////////////////////////////////
-static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-
int CDiscordProto::OnModulesLoaded(WPARAM, LPARAM)
{
GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
- gcr.nColors = _countof(crCols);
- gcr.pColors = &crCols[0];
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index ef239bd76b..281aad172a 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -451,14 +451,10 @@ int FacebookProto::OnModulesLoaded(WPARAM, LPARAM)
// Register group chat
GCREGISTER gcr = {};
- gcr.dwFlags = 0; //GC_ACKMSG;
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = FACEBOOK_MESSAGE_LIMIT;
- gcr.nColors = 0;
- gcr.pColors = NULL;
Chat_Register(&gcr);
-
return 0;
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index de93e74c1f..85ea258941 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -156,8 +156,6 @@ CIrcProto::~CIrcProto()
////////////////////////////////////////////////////////////////////////////////////////
// OnModulesLoaded - performs hook registration
-static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-
static int sttCheckPerform(const char *szSetting, LPARAM lParam)
{
if (!_strnicmp(szSetting, "PERFORM:", 8)) {
@@ -194,8 +192,6 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
GCREGISTER gcr = {};
gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR;
- gcr.nColors = 16;
- gcr.pColors = colors;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 3194c2a93e..e6a7ab5ba3 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -200,8 +200,6 @@ CJabberProto::~CJabberProto()
////////////////////////////////////////////////////////////////////////////////////////
// OnModulesLoadedEx - performs hook registration
-static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-
int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
{
HookProtoEvent(ME_USERINFO_INITIALISE, &CJabberProto::OnUserInfoInit);
@@ -212,8 +210,6 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
- gcr.nColors = _countof(crCols);
- gcr.pColors = &crCols[0];
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index dbce865552..ac9a861cf7 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include "msn_proto.h"
-static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-
int msn_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
int msn_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags);
PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*)(void*, size_t));
@@ -186,8 +184,6 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM)
GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.iMaxText = 0;
- gcr.nColors = _countof(crCols);
- gcr.pColors = crCols;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 0edae1c719..99a0cdf0d0 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -31,7 +31,6 @@ static int sttCompareAsyncHttpRequest(const AsyncHttpRequest *p1, const AsyncHtt
LIST<CVkProto> vk_Instances(1, sttCompareProtocols);
mir_cs csInstances;
-static COLORREF sttColors[] = { 0, 1, 2, 3, 4, 5, 6 };
CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
PROTO<CVkProto>(szModuleName, pwszUserName),
@@ -109,17 +108,18 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM)
GCREGISTER gcr = {};
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- gcr.nColors = _countof(sttColors);
- gcr.pColors = sttColors;
Chat_Register(&gcr);
+
CreateProtoService(PS_LEAVECHAT, &CVkProto::OnLeaveChat);
CreateProtoService(PS_JOINCHAT, &CVkProto::OnJoinChat);
HookProtoEvent(ME_GC_EVENT, &CVkProto::OnChatEvent);
HookProtoEvent(ME_GC_BUILDMENU, &CVkProto::OnGcMenuHook);
+
// Other hooks
HookProtoEvent(ME_MSG_WINDOWEVENT, &CVkProto::OnProcessSrmmEvent);
HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CVkProto::OnDbEventRead);
HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged);
+
//Sounds
Skin_AddSound("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event"));
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 99b46e48d7..3c130511ed 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -149,7 +149,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
pci->SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf);
CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
- pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
+ pci->DoRtfToTags(ptszText, 0, nullptr);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 280bbf0263..7c8348f6e8 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -122,7 +122,7 @@ void Unload_ChatModule(void);
void Load_ChatModule(void);
// log.cpp
-char* Log_CreateRtfHeader(MODULEINFO *mi);
+char* Log_CreateRtfHeader(void);
// window.cpp
SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si);
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 290f4f6efa..6e773a0efb 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -54,7 +54,7 @@ void FreeMsgLogBitmaps(void);
void ValidateFilename (wchar_t *filename);
wchar_t* MakeTimeStamp(wchar_t *pszStamp, time_t time);
wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
-char* Log_CreateRtfHeader(MODULEINFO *mi);
+char* Log_CreateRtfHeader();
char* Log_CreateRTF(LOGSTREAMDATA *streamData);
char* Log_SetStyle(int style);
@@ -105,8 +105,6 @@ void UnloadChatModule(void);
int DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors);
wchar_t *RemoveFormatting(const wchar_t* pszText);
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
-int GetColorIndex(const char *pszModule, COLORREF cr);
-void CheckColorsInModule(const char *pszModule);
int GetRichTextLength(HWND hwnd);
bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
BOOL IsEventSupported(int eventType);
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index d60428a28b..5b6f1a79f8 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -382,7 +382,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
return buf.Detach();
}
-char* Log_CreateRtfHeader(MODULEINFO *mi)
+char* Log_CreateRtfHeader()
{
// guesstimate amount of memory for the RTF header
CMStringA buf;
@@ -406,9 +406,6 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
for (int i = 0; i < OPTIONS_FONTCOUNT; i++)
buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(chatApi.aFonts[i].color), GetGValue(chatApi.aFonts[i].color), GetBValue(chatApi.aFonts[i].color));
- for (int i = 0; i < mi->nColorCount; i++)
- buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(mi->crColors[i]), GetGValue(mi->crColors[i]), GetBValue(mi->crColors[i]));
-
// new paragraph
buf.Append("}\\pard");
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 93f9ebe728..b61eadf7ff 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -183,7 +183,7 @@ BOOL SM_SetOffline(const char *pszModule, SESSION_INFO *si)
return TRUE;
}
-static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
+static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO *ui)
{
if (!ui || !si)
return nullptr;
@@ -575,7 +575,7 @@ static void MM_FontsChanged()
{
for (int i = 0; i < g_arModules.getCount(); i++) {
MODULEINFO *mi = g_arModules[i];
- mi->pszHeader = chatApi.Log_CreateRtfHeader(mi);
+ mi->pszHeader = chatApi.Log_CreateRtfHeader();
}
}
@@ -587,15 +587,6 @@ static MODULEINFO* MM_FindModule(const char *pszModule)
return g_arModules.find((MODULEINFO*)&pszModule);
}
-// stupid thing..
-static void MM_FixColors()
-{
- for (int i = 0; i < g_arModules.getCount(); i++) {
- MODULEINFO *mi = g_arModules[i];
- CheckColorsInModule(mi->pszModule);
- }
-}
-
static BOOL MM_RemoveAll(void)
{
for (int i = 0; i < g_arModules.getCount(); i++) {
@@ -606,7 +597,6 @@ static BOOL MM_RemoveAll(void)
mir_free(mi->pszModule);
mir_free(mi->ptszModDispName);
mir_free(mi->pszHeader);
- mir_free(mi->crColors);
mir_free(mi);
}
return TRUE;
@@ -1059,7 +1049,6 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _
chatApi.MM_AddModule = MM_AddModule;
chatApi.MM_FindModule = MM_FindModule;
- chatApi.MM_FixColors = MM_FixColors;
chatApi.MM_FontsChanged = MM_FontsChanged;
chatApi.MM_IconsChanged = MM_IconsChanged;
chatApi.MM_RemoveAll = MM_RemoveAll;
@@ -1104,7 +1093,6 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _
chatApi.ShowPopup = ShowPopup;
chatApi.LogToFile = LogToFile;
chatApi.GetChatLogsFilename = GetChatLogsFilename;
- chatApi.GetColorIndex = GetColorIndex;
chatApi.Log_SetStyle = Log_SetStyle;
chatApi.IsHighlighted = IsHighlighted;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 2b4458593d..c9c6653c1f 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -88,7 +88,6 @@ static int FontsChanged(WPARAM, LPARAM)
g_Settings->bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
chatApi.MM_FontsChanged();
- chatApi.MM_FixColors();
Chat_UpdateOptions();
return 0;
}
@@ -175,15 +174,8 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
mi->bAckMsg = (gcr->dwFlags & GC_ACKMSG) != 0;
mi->bChanMgr = (gcr->dwFlags & GC_CHANMGR) != 0;
mi->iMaxText = gcr->iMaxText;
- mi->nColorCount = gcr->nColors;
- if (gcr->nColors > 0) {
- mi->crColors = (COLORREF *)mir_alloc(sizeof(COLORREF)* gcr->nColors);
- memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF)* gcr->nColors);
- }
-
- mi->pszHeader = chatApi.Log_CreateRtfHeader(mi);
+ mi->pszHeader = chatApi.Log_CreateRtfHeader();
- CheckColorsInModule((char*)gcr->pszModule);
chatApi.SetAllOffline(TRUE, gcr->pszModule);
return 0;
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index e3869a7097..a2293e6d84 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -358,48 +358,6 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
return TRUE;
}
-int GetColorIndex(const char *pszModule, COLORREF cr)
-{
- MODULEINFO *pMod = chatApi.MM_FindModule(pszModule);
- int i = 0;
-
- if (!pMod || pMod->nColorCount == 0)
- return -1;
-
- for (i = 0; i < pMod->nColorCount; i++)
- if (pMod->crColors[i] == cr)
- return i;
-
- return -1;
-}
-
-// obscure function that is used to make sure that any of the colors
-// passed by the protocol is used as fore- or background color
-// in the messagebox. THis is to vvercome limitations in the richedit
-// that I do not know currently how to fix
-
-void CheckColorsInModule(const char *pszModule)
-{
- MODULEINFO *pMod = chatApi.MM_FindModule(pszModule);
- if (!pMod)
- return;
-
- int i = 0;
- COLORREF crFG;
- COLORREF crBG = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
-
- LoadMsgDlgFont(17, nullptr, &crFG);
-
- for (i = 0; i < pMod->nColorCount; i++) {
- if (pMod->crColors[i] == crFG || pMod->crColors[i] == crBG) {
- if (pMod->crColors[i] == RGB(255, 255, 255))
- pMod->crColors[i]--;
- else
- pMod->crColors[i]++;
- }
- }
-}
-
const wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2)
{
int i, j, k;
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h
index 47656c78b1..29a8ceb0f6 100644
--- a/src/mir_app/src/clc.h
+++ b/src/mir_app/src/clc.h
@@ -89,8 +89,8 @@ int fnClcStatusToPf2(int status);
int fnIsHiddenMode(struct ClcData *dat, int status);
void fnHideInfoTip(HWND hwnd, struct ClcData *dat);
void fnNotifyNewContact(HWND hwnd, MCONTACT hContact);
-void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour);
-void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour);
+void fnGetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour);
+void fnGetFontSetting(int i, LOGFONT *lf, COLORREF *colour);
void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
void fnSetGroupChildCheckboxes(ClcGroup *group, int checked);
@@ -119,7 +119,7 @@ void RebuildMenuOrder(void);
/* clistsettings.c */
wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode);
-void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF * colour);
+void fnGetDefaultFontSetting(int i, LOGFONT *lf, COLORREF * colour);
void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact);
ClcCacheEntry* fnGetCacheEntry(MCONTACT hContact);
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index 2ba391576b..c38203642f 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -674,7 +674,7 @@ DWORD fnGetDefaultExStyle(void)
#define DBFONTF_ITALIC 2
#define DBFONTF_UNDERLINE 4
-void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour)
+void fnGetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour)
{
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), lf, FALSE);
*colour = GetSysColor(COLOR_WINDOWTEXT);
@@ -698,7 +698,7 @@ void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour)
}
}
-void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour)
+void fnGetFontSetting(int i, LOGFONT *lf, COLORREF *colour)
{
cli.pfnGetDefaultFontSetting(i, lf, colour);
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp
index 311f61ea69..e437c4a5a2 100644
--- a/src/mir_app/src/colorchooser.cpp
+++ b/src/mir_app/src/colorchooser.cpp
@@ -24,12 +24,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "chat.h"
+static COLORREF colorTable[] =
+{
+ RGB(0,0,0), RGB(0,0,128), RGB(0,128,128), RGB(128,0,128),
+ RGB(0,128,0), RGB(128,128,0), RGB(128,0,0), RGB(128,128,128),
+ RGB(192,192,192), RGB(0,0,255), RGB(0,255,255), RGB(255,0,255),
+ RGB(0,255,0), RGB(255,255,0), RGB(255,0,0), RGB(255,255,255)
+};
+
class CColorChooserDlg : public CDlgBase
{
CCtrlBase m_text;
- GCSessionInfoBase *m_si;
- MODULEINFO *m_pModule;
+ CSrmmBaseDialog *m_pDlg;
int m_xPosition, m_yPosition;
int iCurrentHotTrack, iRows, iColumns;
@@ -38,14 +45,14 @@ class CColorChooserDlg : public CDlgBase
int CalculateCoordinatesToButton(POINT pt)
{
- int iSquareRoot = (int)sqrt(static_cast<float>(m_pModule->nColorCount));
- int nCols = iSquareRoot * iSquareRoot < m_pModule->nColorCount ? iSquareRoot + 1 : iSquareRoot;
+ int iSquareRoot = (int)sqrt(static_cast<float>(16));
+ int nCols = iSquareRoot * iSquareRoot < 16 ? iSquareRoot + 1 : iSquareRoot;
int col = pt.x / 25;
int row = (pt.y - 20) / 20;
int pos = nCols * row + col;
- if (pt.y < 20 && pos >= m_pModule->nColorCount)
+ if (pt.y < 20 && pos >= 16)
pos = -1;
return pos;
@@ -53,8 +60,8 @@ class CColorChooserDlg : public CDlgBase
RECT CalculateButtonToCoordinates(int buttonPosition)
{
- int iSquareRoot = (int)sqrt(static_cast<float>(m_pModule->nColorCount));
- int nCols = iSquareRoot * iSquareRoot < m_pModule->nColorCount ? iSquareRoot + 1 : iSquareRoot;
+ int iSquareRoot = (int)sqrt(static_cast<float>(16));
+ int nCols = iSquareRoot * iSquareRoot < 16 ? iSquareRoot + 1 : iSquareRoot;
int row = buttonPosition / nCols;
int col = buttonPosition % nCols;
@@ -69,9 +76,13 @@ class CColorChooserDlg : public CDlgBase
}
public:
- CColorChooserDlg(SESSION_INFO *si, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser) :
+ CColorChooserDlg(CSrmmBaseDialog *pDlg, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser) :
CDlgBase(g_hInst, IDD_COLORCHOOSER),
m_text(this, IDC_COLORTEXT),
+ m_pDlg(pDlg),
+ m_hwndTarget(hwndTarget),
+ m_hwndChooser(hwndChooser),
+ m_bForeground(bFG),
iCurrentHotTrack(-2),
bChoosing(false)
{
@@ -81,20 +92,15 @@ public:
m_text.UseSystemColors();
m_hwndParent = hwndDlg;
- m_hwndTarget = hwndTarget;
- m_pModule = chatApi.MM_FindModule(si->pszModule);
m_xPosition = rc.left + 3;
m_yPosition = IsWindowVisible(hwndChooser) ? rc.top - 1 : rc.top + 20;
- m_bForeground = bFG;
- m_hwndChooser = hwndChooser;
- m_si = si;
}
virtual void OnInitDialog() override
{
- int iSquareRoot = (int)sqrt(static_cast<float>(m_pModule->nColorCount));
+ int iSquareRoot = (int)sqrt(static_cast<float>(16));
- iColumns = iSquareRoot * iSquareRoot == m_pModule->nColorCount ? iSquareRoot : iSquareRoot + 1;
+ iColumns = iSquareRoot * iSquareRoot == 16 ? iSquareRoot : iSquareRoot + 1;
iRows = iSquareRoot;
RECT rc;
@@ -130,7 +136,7 @@ public:
break;
case WM_LBUTTONUP:
- if (iCurrentHotTrack >= 0 && iCurrentHotTrack < m_pModule->nColorCount && m_hwndTarget != nullptr) {
+ if (iCurrentHotTrack >= 0 && iCurrentHotTrack < 16 && m_hwndTarget != nullptr) {
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = 0;
@@ -140,20 +146,20 @@ public:
int ctrlId = GetDlgCtrlID(m_hwndChooser);
if (m_bForeground) {
- m_si->pDlg->m_bFGSet = true;
- m_si->pDlg->m_iFG = iCurrentHotTrack;
+ m_pDlg->m_bFGSet = true;
+ m_pDlg->m_iFG = colorTable[iCurrentHotTrack];
if (IsDlgButtonChecked(hWindow, ctrlId)) {
cf.dwMask = CFM_COLOR;
- cf.crTextColor = m_pModule->crColors[iCurrentHotTrack];
+ cf.crTextColor = colorTable[iCurrentHotTrack];
SendMessage(m_hwndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
else {
- m_si->pDlg->m_bBGSet = true;
- m_si->pDlg->m_iBG = iCurrentHotTrack;
+ m_pDlg->m_bBGSet = true;
+ m_pDlg->m_iBG = colorTable[iCurrentHotTrack];
if (IsDlgButtonChecked(hWindow, ctrlId)) {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = m_pModule->crColors[iCurrentHotTrack];
+ cf.crBackColor = colorTable[iCurrentHotTrack];
SendMessage(m_hwndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
@@ -216,7 +222,7 @@ public:
// fill background
FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- for (int i = 0; i < m_pModule->nColorCount; i++) {
+ for (int i = 0; i < 16; i++) {
// decide place to draw the color block in the window
iThisColumn++;
if (iThisColumn > iColumns) {
@@ -224,7 +230,7 @@ public:
iThisRow++;
}
- if (m_bForeground && m_si->pDlg->m_bFGSet && m_si->pDlg->m_iFG == i || !m_bForeground && m_si->pDlg->m_bBGSet && m_si->pDlg->m_iBG == i) {
+ if (m_bForeground && m_pDlg->m_bFGSet && m_pDlg->m_iFG == i || !m_bForeground && m_pDlg->m_bBGSet && m_pDlg->m_iBG == i) {
rc.top = (iThisRow - 1) * 20 + 1 + 20;
rc.left = (iThisColumn - 1) * 25 + 1 + 1;
rc.bottom = iThisRow * 20 - 1 + 20;
@@ -237,16 +243,14 @@ public:
rc.left = (iThisColumn - 1) * 25 + 3 + 1;
rc.bottom = iThisRow * 20 - 3 + 20;
rc.right = iThisColumn * 25 - 3;
-
FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
- HBRUSH hbr = CreateSolidBrush(m_pModule->crColors[i]);
-
rc.top = (iThisRow - 1) * 20 + 4 + 20;
rc.left = (iThisColumn - 1) * 25 + 4 + 1;
rc.bottom = iThisRow * 20 - 4 + 20;
rc.right = iThisColumn * 25 - 4;
+ HBRUSH hbr = CreateSolidBrush(colorTable[i]);
FillRect(hdc, &rc, hbr);
DeleteObject(hbr);
}
@@ -267,6 +271,6 @@ public:
void CSrmmBaseDialog::ShowColorChooser(int iCtrlId)
{
- CColorChooserDlg *pDialog = new CColorChooserDlg(m_si, iCtrlId == IDC_SRMM_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, iCtrlId));
+ CColorChooserDlg *pDialog = new CColorChooserDlg(this, iCtrlId == IDC_SRMM_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, iCtrlId));
pDialog->Show();
}
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 77e611242e..41b854e354 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -759,7 +759,7 @@ void CSrmmBaseDialog::onClick_Color(CCtrlButton *pButton)
return;
}
if (m_bFGSet)
- cf.crTextColor = chatApi.MM_FindModule(m_si->pszModule)->crColors[m_iFG];
+ cf.crTextColor = m_iFG;
}
else cf.crTextColor = m_clrInputFG;
@@ -782,7 +782,7 @@ void CSrmmBaseDialog::onClick_BkColor(CCtrlButton *pButton)
return;
}
if (m_bBGSet)
- cf.crBackColor = chatApi.MM_FindModule(m_si->pszModule)->crColors[m_iBG];
+ cf.crBackColor = m_iBG;
}
else cf.crBackColor = m_clrInputBG;
@@ -942,14 +942,7 @@ void CSrmmBaseDialog::RefreshButtonStatus(void)
return;
if (mi->bColor) {
- int index = GetColorIndex(m_si->pszModule, cf.crTextColor);
bool bState = m_btnColor.IsPushed();
-
- if (index >= 0) {
- m_bFGSet = true;
- m_iFG = index;
- }
-
if (!bState && cf.crTextColor != m_clrInputFG)
m_btnColor.Push(true);
else if (bState && cf.crTextColor == m_clrInputFG)
@@ -957,14 +950,7 @@ void CSrmmBaseDialog::RefreshButtonStatus(void)
}
if (mi->bBkgColor) {
- int index = GetColorIndex(m_si->pszModule, cf.crBackColor);
bool bState = m_btnBkColor.IsPushed();
-
- if (index >= 0) {
- m_bBGSet = true;
- m_iBG = index;
- }
-
if (!bState && cf.crBackColor != m_clrInputBG)
m_btnBkColor.Push(true);
else if (bState && cf.crBackColor == m_clrInputBG)