void SetIndentSize() { if (g_Settings->bShowTime) { LOGFONT lf; LoadMsgDlgFont(0, &lf, NULL); HFONT hFont = CreateFontIndirect(&lf); int iText = GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(NULL)), hFont, TRUE); DeleteObject(hFont); g_Settings->LogTextIndent = iText * 12 / 10; } else g_Settings->LogTextIndent = 0; }
int Chat_FontsChanged(WPARAM wParam,LPARAM lParam) { LoadLogFonts(); { LOGFONT lf; HFONT hFont; int iText; LoadMsgDlgFont(0, &lf, NULL); hFont = CreateFontIndirect(&lf); 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 = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; } MM_FontsChanged(); MM_FixColors(); SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); return 0; }
char* Log_CreateRtfHeader(MODULEINFO *mi) { int i = 0; // get the number of pixels per logical inch if (pci->logPixelSY == 0) { HDC hdc = GetDC(NULL); pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(NULL, hdc); } // ### RTF HEADER // font table CMStringA str("{\\rtf1\\ansi\\deff0{\\fonttbl"); for (i = 0; i < OPTIONS_FONTCOUNT; i++) str.AppendFormat("{\\f%u\\fnil\\fcharset%u%S;}", i, pci->aFonts[i].lf.lfCharSet, pci->aFonts[i].lf.lfFaceName); // colour table str.Append("}{\\colortbl ;"); for (i = 0; i < OPTIONS_FONTCOUNT; i++) str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(pci->aFonts[i].color), GetGValue(pci->aFonts[i].color), GetBValue(pci->aFonts[i].color)); for (i = 0; i < mi->nColorCount; i++) str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(mi->crColors[i]), GetGValue(mi->crColors[i]), GetBValue(mi->crColors[i])); for (i = 0; i < STATUSICONCOUNT; i++) str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(g_Settings.nickColors[i]), GetGValue(g_Settings.nickColors[i]), GetBValue(g_Settings.nickColors[i])); // new paragraph str.AppendFormat("}\\pard\\sl%d", 1000); // set tabs and indents int iIndent = 0; if (g_Settings.bLogSymbols) { TCHAR szString[2]; LOGFONT lf; szString[1] = 0; szString[0] = 0x28; pci->LoadMsgDlgFont(17, &lf, NULL); HFONT hFont = CreateFontIndirect(&lf); int iText = GetTextPixelSize(szString, hFont, true) + 3; DeleteObject(hFont); iIndent += (iText * 1440) / pci->logPixelSX; str.AppendFormat("\\tx%u", iIndent); } else if (g_Settings.dwIconFlags) { iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / pci->logPixelSX; str.AppendFormat("\\tx%u", iIndent); } if (g_Settings.bShowTime) { int iSize = (g_Settings.LogTextIndent * 1440) / pci->logPixelSX; str.AppendFormat("\\tx%u", iIndent + iSize); if (g_Settings.bLogIndentEnabled) iIndent += iSize; } str.AppendFormat("\\fi-%u\\li%u", iIndent, iIndent); return str.Detach(); }
static void OnLoadSettings() { g_Settings.iEventLimitThreshold = db_get_w(NULL, CHAT_MODULE, "LogLimitThreshold", 20); g_Settings.dwIconFlags = M.GetDword(CHAT_MODULE, "IconFlags", 0x0000); g_Settings.bOpenInDefault = M.GetBool(CHAT_MODULE, "DefaultContainer", true); g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0)); g_Settings.UserListColors[CHAT_STATUS_AWAY] = M.GetDword(CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170)); g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = M.GetDword(CHATFONT_MODULE, "Font5Col", RGB(160, 90, 90)); g_Settings.bBBCodeInPopups = M.GetByte(CHAT_MODULE, "BBCodeInPopups", 0) != 0; g_Settings.bClassicIndicators = M.GetBool(CHAT_MODULE, "ClassicIndicators", false); g_Settings.bLogClassicIndicators = M.GetBool(CHAT_MODULE, "LogClassicIndicators", false); g_Settings.bAlternativeSorting = M.GetBool(CHAT_MODULE, "AlternativeSorting", true); g_Settings.bAnnoyingHighlight = M.GetBool(CHAT_MODULE, "AnnoyingHighlight", false); g_Settings.bCreateWindowOnHighlight = M.GetBool(CHAT_MODULE, "CreateWindowOnHighlight", true); g_Settings.bLogSymbols = M.GetBool(CHAT_MODULE, "LogSymbols", true); g_Settings.bClickableNicks = M.GetBool(CHAT_MODULE, "ClickableNicks", true); g_Settings.bColorizeNicks = M.GetBool(CHAT_MODULE, "ColorizeNicks", true); g_Settings.bColorizeNicksInLog = M.GetBool(CHAT_MODULE, "ColorizeNicksInLog", true); g_Settings.bScaleIcons = M.GetBool(CHAT_MODULE, "ScaleIcons", true); g_Settings.bUseDividers = M.GetBool(CHAT_MODULE, "UseDividers", true); g_Settings.bDividersUsePopupConfig = M.GetBool(CHAT_MODULE, "DividersUsePopupConfig", true); g_Settings.bDoubleClick4Privat = M.GetBool(CHAT_MODULE, "DoubleClick4Privat", false); g_Settings.bShowContactStatus = M.GetBool(CHAT_MODULE, "ShowContactStatus", true); g_Settings.bContactStatusFirst = M.GetBool(CHAT_MODULE, "ContactStatusFirst", false); replaceStrT(g_Settings.pszLogDir, M.getChatLogPath()); g_Settings.LogIconSize = (g_Settings.bScaleIcons) ? 12 : 16; g_Settings.iSplitterY = db_get_w(NULL, CHAT_MODULE, "splitY", 50); if (g_Settings.iSplitterY <= 20) g_Settings.iSplitterY = 50; // nicklist 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]); } LOGFONT lf; pci->LoadMsgDlgFont(18, &lf, NULL); g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf); pci->LoadMsgDlgFont(19, &lf, NULL); g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf); pci->LoadMsgDlgFont(5, &lf, NULL); g_Settings.UserListFonts[CHAT_STATUS_OFFLINE] = CreateFontIndirect(&lf); 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_MODULE, "NicklistRowDist", 12), (ih > ih2 ? ih : ih2)); for (int i = 0; i < 5; i++) { char szBuf[40]; mir_snprintf(szBuf, 20, "NickColor%d", i); g_Settings.nickColors[i] = M.GetDword(CHAT_MODULE, szBuf, g_Settings.UserListColors[0]); } g_Settings.nickColors[5] = M.GetDword(CHAT_MODULE, "NickColor5", GetSysColor(COLOR_HIGHLIGHT)); g_Settings.nickColors[6] = M.GetDword(CHAT_MODULE, "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT)); if (g_Settings.SelectionBGBrush) DeleteObject(g_Settings.SelectionBGBrush); g_Settings.SelectionBGBrush = CreateSolidBrush(g_Settings.nickColors[5]); }