summaryrefslogtreecommitdiff
path: root/src/modules/chat/chat_opts.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-16 08:37:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-16 08:37:51 +0000
commit38ab4dde6b080defc5e7d7b286110d580cabdaa0 (patch)
tree4890eaba00645f597e91a888277d461ba3d923c0 /src/modules/chat/chat_opts.cpp
parent2f30799b091475f1086b756bba4b43ebacd3aefc (diff)
kernel chat engine, part 2 - scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@7676 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/chat/chat_opts.cpp')
-rw-r--r--src/modules/chat/chat_opts.cpp21
1 files changed, 14 insertions, 7 deletions
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;
}