From 38ab4dde6b080defc5e7d7b286110d580cabdaa0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 16 Jan 2014 08:37:51 +0000 Subject: kernel chat engine, part 2 - scriver git-svn-id: http://svn.miranda-ng.org/main/trunk@7676 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/chat/chat_opts.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/modules/chat/chat_opts.cpp') diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 341d56db21..832ac721ed 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -291,6 +291,19 @@ static void FreeGlobalSettings(void) DeleteObject(ci.pSettings->UserListHeadingsFont); } +void SetIndentSize() +{ + if (ci.pSettings->ShowTime) { + LOGFONT lf; + LoadMsgDlgFont(0, &lf, NULL); + HFONT hFont = CreateFontIndirect(&lf); + int iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE); + DeleteObject(hFont); + ci.pSettings->LogTextIndent = iText * 12 / 10; + } + else ci.pSettings->LogTextIndent = 0; +} + int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth) { if (!pszText || !hFont) @@ -349,13 +362,7 @@ int OptionsInit(void) if (ci.pSettings->LoggingEnabled) CreateDirectoryTreeT(ci.pSettings->pszLogDir); - LOGFONT lf2; - LoadMsgDlgFont(0, &lf2, NULL); - HFONT hFont = CreateFontIndirect(&lf2); - int 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(); return 0; } -- cgit v1.2.3