summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-06 12:10:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-06 12:10:42 +0000
commit3480ee282427850ceaee9ab38887b66c396cbf67 (patch)
tree9ae6d69ff176f0168a392546118ddf7769478561 /plugins/TabSRMM/src
parentecbda9bae58700987dcb77730f54dfc37b3ff9c5 (diff)
tabSRMM: code cleaning for chat fonts/colors
git-svn-id: http://svn.miranda-ng.org/main/trunk@5243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat/chat.h283
-rw-r--r--plugins/TabSRMM/src/chat/chatprototypes.h4
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp8
-rw-r--r--plugins/TabSRMM/src/chat/manager.cpp40
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp80
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp16
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp63
-rw-r--r--plugins/TabSRMM/src/msgs.h30
-rw-r--r--plugins/TabSRMM/src/themeio.cpp2
9 files changed, 253 insertions, 273 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index 4af20786c5..9a69a10f43 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -92,6 +92,14 @@
#define ICON_STATUS0 18
#define ICON_STATUS5 19
+enum TChatStatusEx
+{
+ CHAT_STATUS_NORMAL,
+ CHAT_STATUS_AWAY,
+ CHAT_STATUS_OFFLINE,
+ CHAT_STATUS_MAX
+};
+
// special service for tweaking performance
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
typedef INT_PTR (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
@@ -103,180 +111,151 @@ class CMUCHighlight;
//structs
-typedef struct MODULE_INFO_TYPE
+struct MODULEINFO
{
- char* pszModule;
- TCHAR* ptszModDispName;
- char* pszHeader;
- BOOL bBold;
- BOOL bUnderline;
- BOOL bItalics;
- BOOL bColor;
- BOOL bBkgColor;
- BOOL bChanMgr;
- BOOL bAckMsg;
- int nColorCount;
- COLORREF* crColors;
- /*
- HICON hOnlineIcon;
- HICON hOfflineIcon;
- HICON hOnlineTalkIcon;
- HICON hOfflineTalkIcon;
- int OnlineIconIndex;
- int OfflineIconIndex;
- */
- int iMaxText;
- DWORD idleTimeStamp;
- DWORD lastIdleCheck;
- TCHAR tszIdleMsg[60];
+ char* pszModule;
+ TCHAR* ptszModDispName;
+ char* pszHeader;
+ bool bBold, bUnderline, bItalics, bColor, bBkgColor, bChanMgr, bAckMsg;
+ int nColorCount;
+ COLORREF* crColors;
+
+ int iMaxText;
+ DWORD idleTimeStamp;
+ DWORD lastIdleCheck;
+ TCHAR tszIdleMsg[60];
CMUCHighlight* Highlight;
- struct MODULE_INFO_TYPE *next;
-}
- MODULEINFO;
+ MODULEINFO * next;
+};
-typedef struct COMMAND_INFO_TYPE
+struct COMMAND_INFO
{
char* lpCommand;
- struct COMMAND_INFO_TYPE *last, *next;
-}
- COMMAND_INFO;
+ COMMAND_INFO *last, *next;
+};
-typedef struct
+struct FONTINFO
{
LOGFONT lf;
COLORREF color;
-}
- FONTINFO;
+};
-typedef struct LOG_INFO_TYPE
+struct LOGINFO
{
- TCHAR* ptszText;
- TCHAR* ptszNick;
- TCHAR* ptszUID;
- TCHAR* ptszStatus;
- TCHAR* ptszUserInfo;
- BOOL bIsMe;
- BOOL bIsHighlighted;
- time_t time;
- int iType;
- DWORD dwFlags;
- struct LOG_INFO_TYPE *next;
- struct LOG_INFO_TYPE *prev;
-}
- LOGINFO;
-
-typedef struct STATUSINFO_TYPE
+ TCHAR* ptszText;
+ TCHAR* ptszNick;
+ TCHAR* ptszUID;
+ TCHAR* ptszStatus;
+ TCHAR* ptszUserInfo;
+ bool bIsMe, bIsHighlighted;
+ time_t time;
+ int iType;
+ DWORD dwFlags;
+ LOGINFO* next;
+ LOGINFO* prev;
+};
+
+struct STATUSINFO
{
TCHAR* pszGroup;
HICON hIcon;
WORD Status;
- struct STATUSINFO_TYPE *next;
-}
- STATUSINFO;
+ STATUSINFO* next;
+};
-typedef struct USERINFO_TYPE
+struct USERINFO
{
TCHAR* pszNick;
TCHAR* pszUID;
WORD Status;
- int iStatusEx;
WORD ContactStatus;
- struct USERINFO_TYPE *next;
-}
- USERINFO;
+ TChatStatusEx iStatusEx;
+ USERINFO* next;
+};
-typedef struct SESSIONINFO_TYPE
+struct SESSION_INFO
{
- HWND hWnd;
-
- BOOL bFGSet;
- BOOL bBGSet;
- BOOL bFilterEnabled;
- BOOL bNicklistEnabled;
- BOOL bInitDone;
-
- char* pszModule;
- TCHAR* ptszID;
- TCHAR* ptszName;
- TCHAR* ptszStatusbarText;
- TCHAR* ptszTopic;
- TCHAR pszLogFileName[MAX_PATH + 50];
-
- char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
- char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
-
- int iType;
- int iFG;
- int iBG;
- int iSplitterY;
- int iSplitterX;
- int iLogFilterFlags;
- int iLogPopupFlags;
- int iLogTrayFlags;
- int iDiskLogFlags;
- int nUsersInNicklist;
- int iEventCount;
- int iStatusCount;
-
- WORD wStatus;
- WORD wState;
- WORD wCommandsNum;
- DWORD dwItemData;
- DWORD dwFlags;
- HANDLE hContact;
- HWND hwndFilter;
- time_t LastTime;
- TCHAR szSearch[255];
- int iSearchItem;
- CMUCHighlight* Highlight;
- COMMAND_INFO* lpCommands;
- COMMAND_INFO* lpCurrentCommand;
- LOGINFO* pLog;
- LOGINFO* pLogEnd;
- USERINFO* pUsers;
- USERINFO* pMe;
- STATUSINFO* pStatuses;
- TContainerData *pContainer;
- TWindowData *dat;
- int wasTrimmed;
- SESSIONINFO_TYPE* next;
-} SESSION_INFO;
-
-typedef struct
+ HWND hWnd;
+
+ bool bFGSet, bBGSet, bFilterEnabled, bNicklistEnabled, bInitDone;
+
+ char* pszModule;
+ TCHAR* ptszID;
+ TCHAR* ptszName;
+ TCHAR* ptszStatusbarText;
+ TCHAR* ptszTopic;
+ TCHAR pszLogFileName[MAX_PATH + 50];
+
+ char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
+ char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
+
+ int iType;
+ int iFG;
+ int iBG;
+ int iSplitterY;
+ int iSplitterX;
+ int iLogFilterFlags;
+ int iLogPopupFlags;
+ int iLogTrayFlags;
+ int iDiskLogFlags;
+ int nUsersInNicklist;
+ int iEventCount;
+ int iStatusCount;
+
+ WORD wStatus;
+ WORD wState;
+ WORD wCommandsNum;
+ DWORD dwItemData;
+ DWORD dwFlags;
+ HANDLE hContact;
+ HWND hwndFilter;
+ time_t LastTime;
+ TCHAR szSearch[255];
+ int iSearchItem;
+ CMUCHighlight* Highlight;
+ COMMAND_INFO* lpCommands;
+ COMMAND_INFO* lpCurrentCommand;
+ LOGINFO* pLog;
+ LOGINFO* pLogEnd;
+ USERINFO* pUsers;
+ USERINFO* pMe;
+ STATUSINFO* pStatuses;
+ TContainerData* pContainer;
+ TWindowData* dat;
+ int wasTrimmed;
+ SESSION_INFO* next;
+};
+
+struct LOGSTREAMDATA
{
char* buffer;
int bufferOffset, bufferLen;
HWND hwnd;
LOGINFO* lin;
- BOOL bStripFormat;
- BOOL bRedraw;
+ bool bStripFormat, bRedraw;
SESSION_INFO* si;
int crCount;
TWindowData* dat;
-}
- LOGSTREAMDATA;
+};
-struct TMUCSettings {
+struct TMUCSettings
+{
HICON hIconOverlay;
- BOOL ShowTime;
- BOOL ShowTimeIfChanged;
- BOOL LoggingEnabled;
- BOOL FlashWindow;
- BOOL FlashWindowHightlight;
- BOOL OpenInDefault;
- BOOL HighlightEnabled;
- BOOL LogIndentEnabled;
- BOOL StripFormat;
- BOOL BBCodeInPopups;
- BOOL TrayIconInactiveOnly;
- BOOL AddColonToAutoComplete;
- BOOL LogLimitNames;
- BOOL TimeStampEventColour;
+ bool ShowTime, ShowTimeIfChanged, LoggingEnabled;
+ bool FlashWindow, FlashWindowHightlight;
+ bool OpenInDefault;
+ bool HighlightEnabled, LogIndentEnabled;
+ bool StripFormat;
+ bool BBCodeInPopups;
+ bool TrayIconInactiveOnly;
+ bool AddColonToAutoComplete;
+ bool LogLimitNames;
+ bool TimeStampEventColour;
DWORD dwIconFlags;
int LogTextIndent;
long LoggingLimit;
int iEventLimit;
- int iEventLimitThreshold;
+ int iEventLimitThreshold;
int iPopupStyle;
int iPopupTimeout;
int iSplitterX;
@@ -285,17 +264,17 @@ struct TMUCSettings {
TCHAR* pszTimeStampLog;
TCHAR* pszIncomingNick;
TCHAR* pszOutgoingNick;
- TCHAR pszLogDir[MAX_PATH + 20];
+ TCHAR pszLogDir[MAX_PATH + 20];
LONG iNickListFontHeight;
- HFONT UserListFont, UserListHeadingsFont;
HFONT NameFont;
- COLORREF crUserListColor;
COLORREF crUserListBGColor;
- COLORREF crUserListHeadingsColor;
COLORREF crPUTextColour;
COLORREF crPUBkgColour;
BYTE ClassicIndicators;
+ HFONT UserListFonts[CHAT_STATUS_MAX];
+ COLORREF UserListColors[CHAT_STATUS_MAX];
+
BYTE LogClassicIndicators;
BYTE AlternativeSorting;
BYTE AnnoyingHighlight;
@@ -308,35 +287,37 @@ struct TMUCSettings {
BYTE ScaleIcons;
BYTE UseDividers;
BYTE DividersUsePopupConfig;
- BYTE MathMod;
+ BYTE MathMod;
COLORREF nickColors[8];
HBRUSH SelectionBGBrush;
- BOOL DoubleClick4Privat;
- BOOL ShowContactStatus;
- BOOL ContactStatusFirst;
- HANDLE hGroup;
+ bool DoubleClick4Privat;
+ bool ShowContactStatus;
+ bool ContactStatusFirst;
+ HANDLE hGroup;
CMUCHighlight* Highlight;
};
-struct FLASH_PARAMS {
+struct FLASH_PARAMS
+{
HANDLE hContact;
const char* sound;
int iEvent;
HICON hNotifyIcon;
- BOOL bActiveTab, bHighlight, bInactive, bMustFlash, bMustAutoswitch;
+ bool bActiveTab, bHighlight, bInactive, bMustFlash, bMustAutoswitch;
HWND hWnd;
};
extern TMUCSettings g_Settings;
-typedef struct{
+struct COLORCHOOSER
+{
MODULEINFO* pModule;
int xPosition;
int yPosition;
HWND hWndTarget;
- BOOL bForeground;
+ bool bForeground;
SESSION_INFO* si;
-} COLORCHOOSER;
+};
#pragma comment(lib,"comctl32.lib")
diff --git a/plugins/TabSRMM/src/chat/chatprototypes.h b/plugins/TabSRMM/src/chat/chatprototypes.h
index 4f682ce6b4..863fe3e0c1 100644
--- a/plugins/TabSRMM/src/chat/chatprototypes.h
+++ b/plugins/TabSRMM/src/chat/chatprototypes.h
@@ -27,7 +27,7 @@ void UpgradeCheck(void);
INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
//log.c
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedraw, BOOL bPhaseTwo);
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, bool bRedraw, bool bPhaseTwo);
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
@@ -36,7 +36,7 @@ char* Log_CreateRtfHeader(MODULEINFO * mi);
//window.c
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
-int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth);
+int GetTextPixelSize( TCHAR* pszText, HFONT hFont, bool bWidth);
//options.c
enum { FONTSECTION_AUTO, FONTSECTION_CHAT, FONTSECTION_IM, FONTSECTION_IP };
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index 3cc58f65b8..52d938ac10 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -954,7 +954,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedraw, BOOL bPhaseTwo)
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, bool bRedraw, bool bPhaseTwo)
{
EDITSTREAM stream;
LOGSTREAMDATA streamData;
@@ -979,7 +979,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr
// bPhaseTwo = bRedraw && bPhaseTwo;
if (bRedraw || si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&lin->iType) != 0) {
- BOOL bFlag = FALSE, fDoReplace;
+ bool bFlag = false, fDoReplace;
ZeroMemory(&stream, sizeof(stream));
stream.pfnCallback = Log_StreamCallback;
@@ -1013,7 +1013,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr
logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(NULL, hdc);
SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
- bFlag = TRUE;
+ bFlag = true;
// SetCursor(LoadCursor(NULL, IDC_ARROW));
}
@@ -1222,7 +1222,7 @@ char * Log_CreateRtfHeader(MODULEINFO * mi)
szString[0] = 0x28;
LoadMsgDlgFont(FONTSECTION_CHAT, 17, &lf, NULL, CHAT_FONTMODULE);
hFont = CreateFontIndirect(&lf);
- iText = GetTextPixelSize(szString, hFont, TRUE) + 3;
+ iText = GetTextPixelSize(szString, hFont, true) + 3;
DeleteObject(hFont);
iIndent += (iText * 1440) / logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp
index f87b52962a..3b3c58d72f 100644
--- a/plugins/TabSRMM/src/chat/manager.cpp
+++ b/plugins/TabSRMM/src/chat/manager.cpp
@@ -313,9 +313,9 @@ BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT * gce, BOOL
li->ptszStatus = mir_tstrdup(gce->ptszStatus);
li->ptszUserInfo = mir_tstrdup(gce->ptszUserInfo);
- li->bIsMe = gce->bIsMe;
+ li->bIsMe = gce->bIsMe != 0;
+ li->bIsHighlighted = bIsHighlighted != 0;
li->time = gce->time;
- li->bIsHighlighted = bIsHighlighted;
if (g_Settings.iEventLimit > 0 && pTemp->iEventCount > g_Settings.iEventLimit + g_Settings.iEventLimitThreshold) {
LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - g_Settings.iEventLimit);
@@ -1363,28 +1363,30 @@ USERINFO* UM_SetContactStatus(USERINFO* pUserList, const TCHAR* pszUID, WORD sta
BOOL UM_SetStatusEx(USERINFO* pUserList, const TCHAR* pszText, int flags)
{
- USERINFO *pTemp = pUserList, *pLast = NULL;
- int bOnlyMe = (flags & GC_SSE_ONLYLISTED) != 0, bSetStatus = (flags & GC_SSE_ONLINE) != 0;
+ bool bOnlyMe = (flags & GC_SSE_ONLYLISTED) != 0, bAwaySetStatus = (flags & GC_SSE_ONLINE) != 0, bOfflineSetStatus = (flags & GC_SSE_OFFLINE) != 0;
char cDelimiter = (flags & GC_SSE_TABDELIMITED) ? '\t' : ' ';
- while (pTemp != NULL) {
+ for (USERINFO *p = pUserList; p != NULL; p = p->next) {
if (!bOnlyMe)
- pTemp->iStatusEx = 0;
-
- if (pszText != NULL) {
- TCHAR* s = (TCHAR *)_tcsstr(pszText, pTemp->pszUID);
- if (s) {
- pTemp->iStatusEx = 0;
- if (s == pszText || s[-1] == cDelimiter) {
- int len = lstrlen(pTemp->pszUID);
- if (s[len] == cDelimiter || s[len] == '\0')
- pTemp->iStatusEx = (!bOnlyMe || bSetStatus) ? 1 : 0;
- }
+ p->iStatusEx = CHAT_STATUS_NORMAL;
+
+ if (pszText == NULL)
+ continue;
+
+ TCHAR* s = (TCHAR *)_tcsstr(pszText, p->pszUID);
+ if (s == NULL)
+ continue;
+
+ p->iStatusEx = CHAT_STATUS_NORMAL;
+ if (s == pszText || s[-1] == cDelimiter) {
+ int len = lstrlen(p->pszUID);
+ if (s[len] == cDelimiter || s[len] == '\0') {
+ if (!bOnlyMe || bAwaySetStatus)
+ p->iStatusEx = CHAT_STATUS_AWAY;
+ else if (bOfflineSetStatus)
+ p->iStatusEx = CHAT_STATUS_OFFLINE;
}
}
-
- pLast = pTemp;
- pTemp = pTemp->next;
}
return TRUE;
}
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index 0acd694435..ffba6630ab 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -829,11 +829,11 @@ int FontServiceFontsChanged(WPARAM,LPARAM)
LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, TRUE);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0);
LoadGlobalSettings();
MM_FontsChanged();
@@ -1104,11 +1104,11 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, TRUE);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0);
LoadGlobalSettings();
MM_FontsChanged();
@@ -1246,26 +1246,27 @@ void LoadGlobalSettings(void)
LOGFONT lf;
char szBuf[40];
- g_Settings.LogLimitNames = M.GetByte("Chat", "LogLimitNames", 1);
- g_Settings.ShowTime = M.GetByte("Chat", "ShowTimeStamp", 1);
- g_Settings.ShowTimeIfChanged = (BOOL)M.GetByte("Chat", "ShowTimeStampIfChanged", 0);
- g_Settings.TimeStampEventColour = (BOOL)M.GetByte("Chat", "TimeStampEventColour", 0);
- g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
+ g_Settings.LogLimitNames = M.GetByte("Chat", "LogLimitNames", 1) != 0;
+ g_Settings.ShowTime = M.GetByte("Chat", "ShowTimeStamp", 1) != 0;
+ g_Settings.ShowTimeIfChanged = M.GetByte("Chat", "ShowTimeStampIfChanged", 0) != 0;
+ g_Settings.TimeStampEventColour = M.GetByte("Chat", "TimeStampEventColour", 0) != 0;
+ g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100) != 0;
g_Settings.iEventLimitThreshold = db_get_w(NULL, "Chat", "LogLimitThreshold", 20);
g_Settings.dwIconFlags = M.GetDword("Chat", "IconFlags", 0x0000);
g_Settings.LoggingLimit = (size_t)db_get_w(NULL, "Chat", "LoggingLimit", 100);
- g_Settings.LoggingEnabled = (BOOL)M.GetByte("Chat", "LoggingEnabled", 0);
- g_Settings.OpenInDefault = (BOOL)M.GetByte("Chat", "DefaultContainer", 1);
- g_Settings.FlashWindow = (BOOL)M.GetByte("Chat", "FlashWindow", 0);
- g_Settings.FlashWindowHightlight = (BOOL)M.GetByte("Chat", "FlashWindowHighlight", 0);
- g_Settings.HighlightEnabled = (BOOL)M.GetByte("Chat", "HighlightEnabled", 1);
- g_Settings.crUserListColor = (BOOL)M.GetDword(CHAT_FONTMODULE, "Font18Col", RGB(0, 0, 0));
- g_Settings.crUserListBGColor = (BOOL)M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR);
- g_Settings.crUserListHeadingsColor = (BOOL)M.GetDword(CHAT_FONTMODULE, "Font19Col", RGB(170, 170, 170));
- g_Settings.StripFormat = (BOOL)M.GetByte("Chat", "StripFormatting", 0);
- g_Settings.TrayIconInactiveOnly = (BOOL)M.GetByte("Chat", "TrayIconInactiveOnly", 1);
- g_Settings.BBCodeInPopups = (BOOL)M.GetByte("Chat", "BBCodeInPopups", 0);
- g_Settings.AddColonToAutoComplete = (BOOL)M.GetByte("Chat", "AddColonToAutoComplete", 1);
+ g_Settings.LoggingEnabled = M.GetByte("Chat", "LoggingEnabled", 0) != 0;
+ g_Settings.OpenInDefault = M.GetByte("Chat", "DefaultContainer", 1) != 0;
+ g_Settings.FlashWindow = M.GetByte("Chat", "FlashWindow", 0) != 0;
+ g_Settings.FlashWindowHightlight = M.GetByte("Chat", "FlashWindowHighlight", 0) != 0;
+ g_Settings.HighlightEnabled = M.GetByte("Chat", "HighlightEnabled", 1) != 0;
+ g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHAT_FONTMODULE, "Font18Col", RGB(0, 0, 0));
+ g_Settings.UserListColors[CHAT_STATUS_AWAY] = M.GetDword(CHAT_FONTMODULE, "Font19Col", RGB(170, 170, 170));
+ g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = M.GetDword(CHAT_FONTMODULE, "Font5Col", RGB(160, 90, 90));
+ g_Settings.crUserListBGColor = M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR);
+ g_Settings.StripFormat = M.GetByte("Chat", "StripFormatting", 0) != 0;
+ g_Settings.TrayIconInactiveOnly = M.GetByte("Chat", "TrayIconInactiveOnly", 1) != 0;
+ g_Settings.BBCodeInPopups = M.GetByte("Chat", "BBCodeInPopups", 0) != 0;
+ g_Settings.AddColonToAutoComplete = M.GetByte("Chat", "AddColonToAutoComplete", 1) != 0;
g_Settings.iPopupStyle = M.GetByte("Chat", "PopupStyle", 1);
g_Settings.iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
g_Settings.crPUBkgColour = M.GetDword("Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
@@ -1286,9 +1287,9 @@ void LoadGlobalSettings(void)
g_Settings.DividersUsePopupConfig = M.GetByte("Chat", "DividersUsePopupConfig", 1);
g_Settings.MathMod = ServiceExists(MATH_RTF_REPLACE_FORMULAE) && M.GetByte("Chat", "MathModSupport", 0);
- g_Settings.DoubleClick4Privat = (BOOL)M.GetByte("Chat", "DoubleClick4Privat", 0);
- g_Settings.ShowContactStatus = M.GetByte("Chat", "ShowContactStatus", 1);
- g_Settings.ContactStatusFirst = M.GetByte("Chat", "ContactStatusFirst", 0);
+ g_Settings.DoubleClick4Privat = M.GetByte("Chat", "DoubleClick4Privat", 0) != 0;
+ g_Settings.ShowContactStatus = M.GetByte("Chat", "ShowContactStatus", 1) != 0;
+ g_Settings.ContactStatusFirst = M.GetByte("Chat", "ContactStatusFirst", 0) != 0;
if (hListBkgBrush)
DeleteObject(hListBkgBrush);
@@ -1313,27 +1314,28 @@ void LoadGlobalSettings(void)
// nicklist
- if (g_Settings.UserListFont) {
- DeleteObject(g_Settings.UserListFont);
- DeleteObject(g_Settings.UserListHeadingsFont);
+ if (g_Settings.UserListFonts[0]) {
+ DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_NORMAL]);
+ DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_AWAY]);
+ DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_OFFLINE]);
}
LoadMsgDlgFont(FONTSECTION_CHAT, 18, &lf, NULL, CHAT_FONTMODULE);
- g_Settings.UserListFont = CreateFontIndirect(&lf);
+ g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf);
LoadMsgDlgFont(FONTSECTION_CHAT, 19, &lf, NULL, CHAT_FONTMODULE);
- g_Settings.UserListHeadingsFont = CreateFontIndirect(&lf);
+ g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf);
- int ih;
- int ih2;
+ LoadMsgDlgFont(FONTSECTION_CHAT, 5, &lf, NULL, CHAT_FONTMODULE);
+ g_Settings.UserListFonts[CHAT_STATUS_OFFLINE] = CreateFontIndirect(&lf);
- ih = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFont, FALSE);
- ih2 = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListHeadingsFont, FALSE);
+ int ih = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false);
+ int ih2 = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_AWAY], false);
g_Settings.iNickListFontHeight = max(M.GetByte("Chat", "NicklistRowDist", 12), (ih > ih2 ? ih : ih2));
for (int i=0; i < 7; i++) {
mir_snprintf(szBuf, 20, "NickColor%d", i);
- g_Settings.nickColors[i] = M.GetDword("Chat", szBuf, g_Settings.crUserListColor);
+ g_Settings.nickColors[i] = M.GetDword("Chat", szBuf, g_Settings.UserListColors[0]);
}
g_Settings.nickColors[5] = M.GetDword("Chat", "NickColor5", GetSysColor(COLOR_HIGHLIGHT));
g_Settings.nickColors[6] = M.GetDword("Chat", "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT));
@@ -1348,10 +1350,10 @@ static void FreeGlobalSettings(void)
mir_free(g_Settings.pszTimeStampLog);
mir_free(g_Settings.pszIncomingNick);
mir_free(g_Settings.pszOutgoingNick);
- if (g_Settings.UserListFont) {
- DeleteObject(g_Settings.UserListFont);
- DeleteObject(g_Settings.UserListHeadingsFont);
- }
+ for (int i=0; i < SIZEOF(g_Settings.UserListFonts); i++)
+ if (g_Settings.UserListFonts[i])
+ DeleteObject(g_Settings.UserListFonts[i]);
+
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
@@ -1395,7 +1397,7 @@ int OptionsInit(void)
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, TRUE);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index 7ffaa7da02..8e4d7182fe 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -173,12 +173,12 @@ INT_PTR Service_Register(WPARAM wParam, LPARAM lParam)
if (mi) {
mi->ptszModDispName = a2tf( gcr->ptszModuleDispName, gcr->dwFlags);
mi->bBold = gcr->dwFlags & GC_BOLD;
- mi->bUnderline = gcr->dwFlags & GC_UNDERLINE ;
- mi->bItalics = gcr->dwFlags & GC_ITALICS ;
- mi->bColor = gcr->dwFlags & GC_COLOR ;
- mi->bBkgColor = gcr->dwFlags & GC_BKGCOLOR ;
- mi->bAckMsg = gcr->dwFlags & GC_ACKMSG ;
- mi->bChanMgr = gcr->dwFlags & GC_CHANMGR ;
+ 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->iMaxText = gcr->iMaxText;
mi->nColorCount = gcr->nColors;
if (gcr->nColors > 0) {
@@ -226,8 +226,8 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
si->ptszName = a2tf(gcw->ptszName, gcw->dwFlags);
si->ptszStatusbarText = a2tf(gcw->ptszStatusbarText, gcw->dwFlags);
si->iSplitterX = g_Settings.iSplitterX;
- si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0));
- si->bNicklistEnabled = M.GetByte("Chat", "ShowNicklist", 1);
+ si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0)) != 0;
+ si->bNicklistEnabled = M.GetByte("Chat", "ShowNicklist", 1) != 0;
if (!(gcw->dwFlags & GC_UNICODE)) {
si->pszID = mir_strdup(gcw->pszID);
si->pszName = mir_strdup(gcw->pszName);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index f936e639d3..39ff4da0ea 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1863,19 +1863,17 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
* precise than using GetTextExtentPoint...()
*/
-int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
+int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth)
{
- HDC hdc;
- HFONT hOldFont;
- RECT rc = {0};
- int i;
-
if (!pszText || !hFont)
return 0;
- hdc = GetDC(NULL);
- hOldFont = (HFONT)SelectObject(hdc, hFont);
- i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+ HDC hdc = GetDC(NULL);
+ HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
+
+ RECT rc = {0};
+ int i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+
SelectObject(hdc, hOldFont);
ReleaseDC(NULL, hdc);
return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
@@ -2335,8 +2333,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else {
if (dis->CtlID == IDC_LIST) {
- HFONT hFont, hOldFont;
- HICON hIcon;
int offset, x_offset = 0;
int height;
int index = dis->itemID;
@@ -2352,38 +2348,39 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
offset = 0;
else
offset = height / 2;
- hIcon = SM_GetStatusIcon(si, ui, &szIndicator);
- hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
+ HICON hIcon = SM_GetStatusIcon(si, ui, &szIndicator);
+ HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx];
+ HFONT hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
SetBkMode(dis->hDC, TRANSPARENT);
if (dis->itemState & ODS_SELECTED) {
FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush);
SetTextColor(dis->hDC, g_Settings.nickColors[6]);
- } else {
+ }
+ else {
FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
if (g_Settings.ColorizeNicks && szIndicator != 0) {
COLORREF clr;
-
switch (szIndicator) {
- case '@':
- clr = g_Settings.nickColors[0];
- break;
- case '%':
- clr = g_Settings.nickColors[1];
- break;
- case '+':
- clr = g_Settings.nickColors[2];
- break;
- case '!':
- clr = g_Settings.nickColors[3];
- break;
- case '*':
- clr = g_Settings.nickColors[4];
- break;
+ case '@':
+ clr = g_Settings.nickColors[0];
+ break;
+ case '%':
+ clr = g_Settings.nickColors[1];
+ break;
+ case '+':
+ clr = g_Settings.nickColors[2];
+ break;
+ case '!':
+ clr = g_Settings.nickColors[3];
+ break;
+ case '*':
+ clr = g_Settings.nickColors[4];
+ break;
}
SetTextColor(dis->hDC, clr);
- } else SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
+ }
+ else SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]);
}
x_offset = 2;
@@ -2617,7 +2614,7 @@ LABEL_SHOWWINDOW:
case GC_SHOWCOLORCHOOSER: {
HWND ColorWindow;
RECT rc;
- BOOL bFG = lParam == IDC_COLOR ? TRUE : FALSE;
+ bool bFG = (lParam == IDC_COLOR);
COLORCHOOSER *pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_COLOR : IDC_BKGCOLOR), &rc);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 0c0fb7f70c..857ea34629 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -31,13 +31,6 @@
#ifndef _MSGS_H
#define _MSGS_H
-#ifdef _MSC_VER
-#if _MSC_VER < 1400
-#define uintptr_t UINT_PTR
-#define _localtime32 localtime
-#define __time32_t time_t
-#endif
-#endif
/*
* required for MingW32 compatibility
*/
@@ -239,13 +232,13 @@ struct TContainerData
CSideBar *SideBar;
};
-struct SESSIONINFO_TYPE;
+struct SESSION_INFO;
struct TWindowData
{
UINT cbSize;
BYTE bType;
- struct TContainerData *pContainer; // parent container description structure
+ TContainerData *pContainer; // parent container description structure
HWND hwnd;
DWORD dwFlags;
DWORD dwFlagsEx;
@@ -270,7 +263,7 @@ struct TWindowData
UINT bbRSideWidth; //MAD
BYTE kstate[256];
- SESSIONINFO_TYPE* si;
+ SESSION_INFO* si;
RECT rcNick, rcUIN, rcStatus, rcPic;
HANDLE hDbEventFirst, hDbEventLast;
@@ -353,17 +346,19 @@ struct TWindowData
#define MESSAGE_WINDOW_DATA_SIZE offsetof(_MessageWindowData, hdbEventFirst);
-typedef struct _recentinfo {
+struct RECENTINFO
+{
DWORD dwFirst, dwMostRecent; // timestamps
int iFirstIndex, iMostRecent; // tab indices
HWND hwndFirst, hwndMostRecent; // client window handles
-} RECENTINFO;
+};
/*
* configuration data for custom tab ctrl
*/
-struct myTabCtrl {
+struct myTabCtrl
+{
HPEN m_hPenShadow, m_hPenItemShadow, m_hPenLight;
HFONT m_hMenuFont;
COLORREF colors[10];
@@ -372,7 +367,8 @@ struct myTabCtrl {
int m_bottomAdjust;
};
-struct TIconDesc {
+struct TIconDesc
+{
char *szName;
char *szDesc;
HICON *phIcon; // where the handle is saved...
@@ -380,7 +376,8 @@ struct TIconDesc {
BOOL bForceSmall; // true: force 16x16
};
-struct TIconDescW {
+struct TIconDescW
+{
TCHAR *szName;
TCHAR *szDesc;
HICON *phIcon; // where the handle is saved...
@@ -417,7 +414,8 @@ struct TIconDescW {
#define MIN_PANELHEIGHT 20
-struct TNewWindowData {
+struct TNewWindowData
+{
HANDLE hContact;
int isWchar;
const char* szInitialText;
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp
index 17827c4454..e03e09a5df 100644
--- a/plugins/TabSRMM/src/themeio.cpp
+++ b/plugins/TabSRMM/src/themeio.cpp
@@ -345,7 +345,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
else if (i == 6)
defclr = GetSysColor(COLOR_HIGHLIGHTTEXT);
else
- defclr = g_Settings.crUserListColor;
+ defclr = g_Settings.UserListColors[CHAT_STATUS_NORMAL];
g_Settings.nickColors[i] = GetPrivateProfileIntA("Nick Colors", _itoa(i, szTemp, 10), defclr, szIniFilename);
sprintf(szTemp, "NickColor%d", i);
db_set_dw(0, "Chat", szTemp, g_Settings.nickColors[i]);