From 76e7322839a1145eace5fdc90a37cbb7e2de3b04 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 17 Jan 2014 22:06:40 +0000 Subject: - colored nicks in tabSRMM; - color registration removed from core due to some conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@7701 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/main.cpp | 28 ++++++++++++++++++++++++++++ plugins/TabSRMM/src/chat/window.cpp | 25 ++++++++++++++----------- src/core/stdchat/src/chat.h | 1 + src/core/stdchat/src/main.cpp | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 11 deletions(-) diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index fab57d653a..b8d2dbc0b4 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -116,6 +116,34 @@ static void OnCreateModule(MODULEINFO *mi) mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE); } +static void RegisterFonts() +{ + ColourIDT colourid = { sizeof(colourid) }; + strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup)); + _tcsncpy(colourid.group, LPGENT("Messaging")_T("/")LPGENT("Group chats"), SIZEOF(colourid.group)); + + strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); + mir_sntprintf(colourid.group, SIZEOF(colourid.group), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats")); + colourid.defcolour = GetSysColor(COLOR_WINDOW); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("User list background"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_WINDOW); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("User list lines"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("User list background (selected)"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); + ColourRegisterT(&colourid); +} + int Chat_Load() { CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats") }; diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 0f36e33eed..5a5e192ef6 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -45,6 +45,7 @@ extern HMENU g_hMenu; static HKL hkl = NULL; static HCURSOR hCurHyperlinkHand; +static char szIndicators[] = { '+', '%', '@', '!', 0, '*' }; struct MESSAGESUBDATA { @@ -2252,7 +2253,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (dis->CtlID == IDC_LIST) { int x_offset = 0; int index = dis->itemID; - char szIndicator = 0; USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, index); if (ui == NULL) @@ -2268,21 +2268,24 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar HFONT hOldFont = (HFONT) SelectObject(dis->hDC, hFont); SetBkMode(dis->hDC, TRANSPARENT); + int nickIndex = -1; + for (int i = 0; i < 6; i++) { + if (hIcon == pci->hIcons[ICON_STATUS1 + i]) { + nickIndex = i; + break; + } + } + if (dis->itemState & ODS_SELECTED) { FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush); SetTextColor(dis->hDC, g_Settings.nickColors[6]); } else { FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush); - if (g_Settings.bColorizeNicks && szIndicator != 0) { - for (int i = 0; i < 6; i++) { - if (hIcon == pci->hIcons[ICON_STATUS0 + i]) { - SetTextColor(dis->hDC, g_Settings.nickColors[i]); - break; - } - } - } - else SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]); + if (g_Settings.bColorizeNicks && nickIndex != -1) + SetTextColor(dis->hDC, g_Settings.nickColors[nickIndex]); + else + SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]); } x_offset = 2; @@ -2296,7 +2299,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (g_Settings.bClassicIndicators) { char szTemp[3]; szTemp[1] = 0; - szTemp[0] = szIndicator; + szTemp[0] = szIndicators[nickIndex]; if (szTemp[0]) { SIZE szUmode; GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode); diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index f7f8a5ef09..4b1ce18173 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -60,6 +60,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include "m_ieview.h" #include "m_smileyadd.h" diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 9d70355fd8..3fbbc0c281 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -257,12 +257,45 @@ static void OnLoadSettings() g_TabSession.bBGSet = TRUE; } +static void RegisterFonts() +{ + ColourIDT colourid = { sizeof(colourid) }; + strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup)); + _tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group)); + + strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_WINDOW); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Message background"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_WINDOW); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("User list background"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_WINDOW); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("User list lines"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("User list background (selected)"), SIZEOF(colourid.name)); + colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); + ColourRegisterT(&colourid); +} + extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); mir_getCLI(); AddIcons(); + RegisterFonts(); CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module") }; mir_getCI(&data); -- cgit v1.2.3