From 1e72d64e724333dc98a4f0b4aefe1881dc7477da Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 14 Jan 2014 20:31:16 +0000 Subject: StdChat merged with core git-svn-id: http://svn.miranda-ng.org/main/trunk@7655 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/chat/log.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/modules/chat/log.cpp') diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index ea05294de5..f791809f54 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -28,9 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static PBYTE pLogIconBmpBits[14]; static int logIconBmpSize[ SIZEOF(pLogIconBmpBits) ]; -static int logPixelSY = 0; -static int logPixelSX = 0; - static int EventToIndex(LOGINFO * lin) { switch (lin->iType) { @@ -85,7 +82,7 @@ static char *Log_SetStyle(int style, int fontindex) static char szStyle[128]; mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", - style, style + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); + style, style + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY); return szStyle; } @@ -323,7 +320,7 @@ TCHAR* MakeTimeStamp( TCHAR* pszStamp, time_t time) return szTime; } -static char* Log_CreateRTF(LOGSTREAMDATA *streamData) +char* Log_CreateRTF(LOGSTREAMDATA *streamData) { char *buffer, *header; int bufferAlloced, bufferEnd, i, me = 0; @@ -374,13 +371,13 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) { iii = lin->bIsHighlighted?16:(lin->bIsMe ? 2 : 1); - mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); + mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY); Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle); } else { iii = lin->bIsHighlighted?16:EventToIndex(lin); - mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); + mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY); Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle); } } @@ -479,13 +476,10 @@ char* Log_CreateRtfHeader(MODULEINFO * mi) //get the number of pixels per logical inch - { - HDC hdc; - hdc = GetDC(NULL); - logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); - ReleaseDC(NULL, hdc); - } + HDC hdc = GetDC(NULL); + ci.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); + ci.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); + ReleaseDC(NULL, hdc); // ### RTF HEADER @@ -512,12 +506,12 @@ char* Log_CreateRtfHeader(MODULEINFO * mi) if (ci.pSettings->dwIconFlags) { - iIndent += (14*1440)/logPixelSX; + iIndent += (14 * 1440) / ci.logPixelSX; Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent); } if (ci.pSettings->ShowTime) { - int iSize = (ci.pSettings->LogTextIndent*1440)/logPixelSX; + int iSize = (ci.pSettings->LogTextIndent * 1440) / ci.logPixelSX; Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize ); if (ci.pSettings->LogIndentEnabled) iIndent += iSize; -- cgit v1.2.3