diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-16 11:33:08 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-16 11:33:08 +0000 |
commit | da2edf0603f1552ef53325fa558c28a3c6fdec94 (patch) | |
tree | d8e7844e7ae6c42cb53559ab1e5fcd5aa4bfa6bf /src/modules | |
parent | 38ab4dde6b080defc5e7d7b286110d580cabdaa0 (diff) |
- two chat HBRUSHes moved into CHAT_MANAGER;
- fix for changing fonts;
- crash fix for StdChat unloading;
git-svn-id: http://svn.miranda-ng.org/main/trunk@7677 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/chat/chat.h | 1 | ||||
-rw-r--r-- | src/modules/chat/chat_opts.cpp | 8 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 16 | ||||
-rw-r--r-- | src/modules/chat/log.cpp | 4 | ||||
-rw-r--r-- | src/modules/chat/manager.cpp | 6 |
5 files changed, 20 insertions, 15 deletions
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 8392f7b8f8..c916ca565a 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -66,6 +66,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour); void LoadGlobalSettings(void);
HICON LoadIconEx(char* pszIcoLibName, BOOL big);
void LoadLogFonts(void);
+void SetIndentSize();
// services.c
void InitChatModule(void);
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 832ac721ed..131ba59dcf 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -73,6 +73,14 @@ void LoadLogFonts(void) {
for (int i=0; i < OPTIONS_FONTCOUNT; i++)
LoadMsgDlgFont(i, &ci.aFonts[i].lf, &ci.aFonts[i].color);
+
+ if (ci.hListBkgBrush != NULL)
+ DeleteObject(ci.hListBkgBrush);
+ ci.hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
+
+ if (ci.hListSelectedBkgBrush != NULL)
+ DeleteObject(ci.hListSelectedBkgBrush);
+ ci.hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
}
void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour)
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 46586ea2c3..4e8f9b114f 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -50,16 +50,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) {
LoadLogFonts();
- LOGFONT lf;
- HFONT hFont;
- int iText;
-
- LoadMsgDlgFont(0, &lf, NULL);
- hFont = CreateFontIndirect(&lf);
- iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE);
- DeleteObject(hFont);
- ci.pSettings->LogTextIndent = iText;
- ci.pSettings->LogTextIndent = ci.pSettings->LogTextIndent * 12 / 10;
+ SetIndentSize();
ci.pSettings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
ci.MM_FontsChanged();
@@ -71,8 +62,8 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) static int IconsChanged(WPARAM wParam, LPARAM lParam)
{
FreeMsgLogBitmaps();
-
LoadMsgLogBitmaps();
+
ci.MM_IconsChanged();
ci.SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, FALSE);
return 0;
@@ -84,6 +75,9 @@ static int PreShutdown(WPARAM wParam, LPARAM lParam) ci.SM_RemoveAll();
ci.MM_RemoveAll();
+
+ DeleteObject(ci.hListBkgBrush);
+ DeleteObject(ci.hListSelectedBkgBrush);
return 0;
}
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index fc8788561e..c8fd06a5a9 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -312,10 +312,10 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, break;
} } }
-TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time)
+TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time)
{
static TCHAR szTime[30];
- if (!_tcsftime(szTime, SIZEOF(szTime) - 1, pszStamp, localtime(&time)))
+ if (!_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
_tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
return szTime;
}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index b59420f8dd..d2f50ba864 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -1473,14 +1473,16 @@ CHAT_MANAGER ci = SetAllOffline,
AddEvent,
FindRoom,
- NULL, // must be implemented in a plugin
Log_CreateRTF,
- LoadMsgDlgFont
+ LoadMsgDlgFont,
+ MakeTimeStamp
};
INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam)
{
LoadChatModule();
+
+ memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnSessionDblClick), 0, sizeof(CHAT_MANAGER) - offsetof(CHAT_MANAGER, OnSessionDblClick));
ci.pSettings = (GlobalLogSettingsBase*)lParam;
OptionsInit();
return (INT_PTR)&ci;
|