diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-07 10:17:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-07 10:17:28 +0000 |
commit | cdce2ce7164855eb03909b088273b36a877edf69 (patch) | |
tree | b2e933d52953b743c45caf9b6d35713075a5ad70 /plugins/TabSRMM/src/chat | |
parent | c64f6aa70ba10a73b57d1cc149aa27119a681a81 (diff) |
- special method for reading booleans
- fixed misprint that led to wrong chat event count
git-svn-id: http://svn.miranda-ng.org/main/trunk@5251 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat')
-rw-r--r-- | plugins/TabSRMM/src/chat/chat.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/log.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/options.cpp | 83 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 46 |
4 files changed, 70 insertions, 69 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index 90d9e6446f..316ca997e6 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -244,7 +244,7 @@ struct TMUCSettings bool bShowTime, bShowTimeIfChanged, bLoggingEnabled;
bool bFlashWindow, bFlashWindowHightlight;
bool bOpenInDefault;
- bool bHighlightEnabled, LogIndentEnabled;
+ bool bHighlightEnabled, bLogIndentEnabled;
bool bStripFormat;
bool bBBCodeInPopups;
bool bTrayIconInactiveOnly;
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 5674f68623..d5d6e8e8f5 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -846,7 +846,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) char pszIndicator[3] = "\0\0";
int crNickIndex = 0;
//mad
- if (g_Settings.bLogClassicIndicators/*g_Settings.bClassicIndicators */||g_Settings.bColorizeNicksInLog) {
+ if (g_Settings.bLogClassicIndicators || g_Settings.bColorizeNicksInLog) {
USERINFO *ui = streamData->si->pUsers;
while (ui) {
if (!lstrcmp(ui->pszNick, lin->ptszNick)) {
@@ -885,8 +885,8 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) }
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1, lin->bIsMe ? 2 : 1));
- //MAD
- if (g_Settings.bLogClassicIndicators /*g_Settings.bClassicIndicators*/)
+
+ if (g_Settings.bLogClassicIndicators)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s", pszIndicator);
lstrcpyn(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, 299);
@@ -1233,7 +1233,7 @@ char * Log_CreateRtfHeader(MODULEINFO * mi) if (g_Settings.bShowTime) {
int iSize = (g_Settings.LogTextIndent * 1440) / logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize);
- if (g_Settings.LogIndentEnabled)
+ if (g_Settings.bLogIndentEnabled)
iIndent += iSize;
}
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\fi-%u\\li%u", iIndent, iIndent);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 506388355e..b1e88ead66 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -833,7 +833,7 @@ int FontServiceFontsChanged(WPARAM,LPARAM) DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0);
+ g_Settings.bLogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
LoadGlobalSettings();
MM_FontsChanged();
@@ -876,11 +876,11 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.bLoggingEnabled);
SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
- Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled);
+ Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled);
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LoggingLimit", 100), 0));
- Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled);
if (ServiceExists(MS_UTILS_REPLACEVARS)) {
TCHAR tszTooltipText[2048];
@@ -1028,22 +1028,21 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
- int iLen;
TCHAR *p2 = NULL;
char *pszText = NULL;
TCHAR *ptszPath = NULL;
if (PluginConfig.m_chat_enabled) {
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
+ int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
if (iLen > 0) {
TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2);
GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
db_set_ts(NULL, "Chat", "LogDirectory", pszText1);
free(pszText1);
- g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE;
- db_set_b(0, "Chat", "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled);
- } else {
+ g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED;
+ db_set_b(0, "Chat", "LoggingEnabled", g_Settings.bLoggingEnabled);
+ }
+ else {
db_unset(NULL, "Chat", "LogDirectory");
db_set_b(0, "Chat", "LoggingEnabled", 0);
}
@@ -1108,7 +1107,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0);
+ g_Settings.bLogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
LoadGlobalSettings();
MM_FontsChanged();
@@ -1246,50 +1245,50 @@ void LoadGlobalSettings(void) LOGFONT lf;
char szBuf[40];
- g_Settings.bLogLimitNames = M.GetByte("Chat", "LogLimitNames", 1) != 0;
- g_Settings.bShowTime = M.GetByte("Chat", "ShowTimeStamp", 1) != 0;
- g_Settings.bShowTimeIfChanged = M.GetByte("Chat", "ShowTimeStampIfChanged", 0) != 0;
- g_Settings.bTimeStampEventColour = M.GetByte("Chat", "TimeStampEventColour", 0) != 0;
- g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100) != 0;
+ g_Settings.bLogLimitNames = M.GetBool("Chat", "LogLimitNames", true);
+ g_Settings.bShowTime = M.GetBool("Chat", "ShowTimeStamp", true);
+ g_Settings.bShowTimeIfChanged = M.GetBool("Chat", "ShowTimeStampIfChanged", false);
+ g_Settings.bTimeStampEventColour = M.GetBool("Chat", "TimeStampEventColour", false);
+ g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
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.bLoggingEnabled = M.GetByte("Chat", "LoggingEnabled", 0) != 0;
- g_Settings.bOpenInDefault = M.GetByte("Chat", "DefaultContainer", 1) != 0;
- g_Settings.bFlashWindow = M.GetByte("Chat", "FlashWindow", 0) != 0;
- g_Settings.bFlashWindowHightlight = M.GetByte("Chat", "FlashWindowHighlight", 0) != 0;
- g_Settings.bHighlightEnabled = M.GetByte("Chat", "HighlightEnabled", 1) != 0;
+ g_Settings.bLoggingEnabled = M.GetBool("Chat", "LoggingEnabled", false);
+ g_Settings.bOpenInDefault = M.GetBool("Chat", "DefaultContainer", true);
+ g_Settings.bFlashWindow = M.GetBool("Chat", "FlashWindow", false);
+ g_Settings.bFlashWindowHightlight = M.GetBool("Chat", "FlashWindowHighlight", false);
+ g_Settings.bHighlightEnabled = M.GetBool("Chat", "HighlightEnabled", true);
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.bStripFormat = M.GetByte("Chat", "StripFormatting", 0) != 0;
- g_Settings.bTrayIconInactiveOnly = M.GetByte("Chat", "TrayIconInactiveOnly", 1) != 0;
+ g_Settings.bStripFormat = M.GetBool("Chat", "StripFormatting", false);
+ g_Settings.bTrayIconInactiveOnly = M.GetBool("Chat", "TrayIconInactiveOnly", true);
g_Settings.bBBCodeInPopups = M.GetByte("Chat", "BBCodeInPopups", 0) != 0;
- g_Settings.bAddColonToAutoComplete = M.GetByte("Chat", "AddColonToAutoComplete", 1) != 0;
+ g_Settings.bAddColonToAutoComplete = M.GetBool("Chat", "AddColonToAutoComplete", true);
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));
g_Settings.crPUTextColour = M.GetDword("Chat", "PopupColorText", 0);
- g_Settings.bClassicIndicators = M.GetByte("Chat", "ClassicIndicators", 0) != 0;
+ g_Settings.bClassicIndicators = M.GetBool("Chat", "ClassicIndicators", false);
//MAD
- g_Settings.bLogClassicIndicators = M.GetByte("Chat", "LogClassicIndicators", 0) != 0;
- g_Settings.bAlternativeSorting = M.GetByte("Chat", "AlternativeSorting", 1) != 0;
- g_Settings.bAnnoyingHighlight = M.GetByte("Chat", "AnnoyingHighlight", 0) != 0;
- g_Settings.bCreateWindowOnHighlight = M.GetByte("Chat", "CreateWindowOnHighlight", 1) != 0;
+ g_Settings.bLogClassicIndicators = M.GetBool("Chat", "LogClassicIndicators", false);
+ g_Settings.bAlternativeSorting = M.GetBool("Chat", "AlternativeSorting", true);
+ g_Settings.bAnnoyingHighlight = M.GetBool("Chat", "AnnoyingHighlight", false);
+ g_Settings.bCreateWindowOnHighlight = M.GetBool("Chat", "CreateWindowOnHighlight", true);
//MAD_
- g_Settings.bLogSymbols = M.GetByte("Chat", "LogSymbols", 1) != 0;
- g_Settings.bClickableNicks = M.GetByte("Chat", "ClickableNicks", 1) != 0;
- g_Settings.bColorizeNicks = M.GetByte("Chat", "ColorizeNicks", 1) != 0;
- g_Settings.bColorizeNicksInLog = M.GetByte("Chat", "ColorizeNicksInLog", 1) != 0;
- g_Settings.bScaleIcons = M.GetByte("Chat", "ScaleIcons", 1) != 0;
- g_Settings.bUseDividers = M.GetByte("Chat", "UseDividers", 1) != 0;
- g_Settings.bDividersUsePopupConfig = M.GetByte("Chat", "DividersUsePopupConfig", 1) != 0;
- g_Settings.bMathMod = ServiceExists(MATH_RTF_REPLACE_FORMULAE) && M.GetByte("Chat", "MathModSupport", 0);
-
- g_Settings.bDoubleClick4Privat = M.GetByte("Chat", "DoubleClick4Privat", 0) != 0;
- g_Settings.bShowContactStatus = M.GetByte("Chat", "ShowContactStatus", 1) != 0;
- g_Settings.bContactStatusFirst = M.GetByte("Chat", "ContactStatusFirst", 0) != 0;
+ g_Settings.bLogSymbols = M.GetBool("Chat", "LogSymbols", true);
+ g_Settings.bClickableNicks = M.GetBool("Chat", "ClickableNicks", true);
+ g_Settings.bColorizeNicks = M.GetBool("Chat", "ColorizeNicks", true);
+ g_Settings.bColorizeNicksInLog = M.GetBool("Chat", "ColorizeNicksInLog", true);
+ g_Settings.bScaleIcons = M.GetBool("Chat", "ScaleIcons", true);
+ g_Settings.bUseDividers = M.GetBool("Chat", "UseDividers", true);
+ g_Settings.bDividersUsePopupConfig = M.GetBool("Chat", "DividersUsePopupConfig", true);
+ g_Settings.bMathMod = ServiceExists(MATH_RTF_REPLACE_FORMULAE) && M.GetBool("Chat", "MathModSupport", false);
+
+ g_Settings.bDoubleClick4Privat = M.GetBool("Chat", "DoubleClick4Privat", false);
+ g_Settings.bShowContactStatus = M.GetBool("Chat", "ShowContactStatus", true);
+ g_Settings.bContactStatusFirst = M.GetBool("Chat", "ContactStatusFirst", false);
if (hListBkgBrush)
DeleteObject(hListBkgBrush);
@@ -1310,7 +1309,7 @@ void LoadGlobalSettings(void) g_Settings.pszLogDir[MAX_PATH - 1] = 0;
- g_Settings.LogIndentEnabled = (M.GetByte("Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings.bLogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
// nicklist
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 4d49121ce9..9da631a99f 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2258,8 +2258,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
Log_StreamInEvent(hwndDlg, pLog, si, TRUE, FALSE);
mir_forkthread(phase2, si);
- } else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
- } else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ }
+ else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
+ }
+ else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
break;
case GC_REDRAWLOG2:
@@ -2274,27 +2276,27 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, TRUE);
break;
- case GC_ADDLOG: {
- BOOL fInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd);
+ case GC_ADDLOG:
+ {
+ bool fInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd);
- if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) {
- if (!MessageWindowOpened(0, (LPARAM)hwndDlg))
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- } else if (g_Settings.bUseDividers) {
- if (fInactive)
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- else {
- if (dat->pContainer->hwndActive != hwndDlg)
+ if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) {
+ if (!MessageWindowOpened(0, (LPARAM)hwndDlg))
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
+ }
+ else if (g_Settings.bUseDividers) {
+ if (fInactive)
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
+ else if (dat->pContainer->hwndActive != hwndDlg)
SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
}
- }
- if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
- else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ if (si->pLogEnd)
+ Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
+ else
+ SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ }
break;
- }
case GC_ACKMESSAGE:
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
@@ -2312,7 +2314,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (dat->Panel->isHovered()) {
mis->itemHeight = 0;
mis->itemWidth = 6;
- return(TRUE);
+ return TRUE;
}
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
@@ -2327,7 +2329,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (dis->CtlType == ODT_MENU) {
if (dat->Panel->isHovered()) {
DrawMenuItem(dis, (HICON)dis->itemData, 0);
- return(TRUE);
+ return TRUE;
}
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
@@ -3466,10 +3468,10 @@ LABEL_SHOWWINDOW: if (wParam == 0 && lParam == 0) {
if (PluginConfig.m_EscapeCloses == 1) {
SendMessage(dat->pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- return(TRUE);
+ return TRUE;
} else if (PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
ShowWindow(dat->pContainer->hwnd, SW_HIDE);
- return(TRUE);
+ return TRUE;
}
_dlgReturn(hwndDlg, TRUE);
}
|