summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-21 18:22:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-21 18:22:58 +0000
commitbe50a70bfd8b3f3daf0c3351fdce6e2fea515bd7 (patch)
tree26b5bcad0c257cc752f6a5214f4bd1850df96fce /plugins/TabSRMM
parent64516fd98ad1dae35864617563ee9963c0f31917 (diff)
a copy of log style manager removed from tabSRMM
git-svn-id: http://svn.miranda-ng.org/main/trunk@7819 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/chat/chat.h1
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp74
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp4
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp1
-rw-r--r--plugins/TabSRMM/src/msglog.cpp5
6 files changed, 23 insertions, 64 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index 0d572fb76c..f8a4769b54 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -133,7 +133,6 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
// log.c
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw, bool bPhaseTwo);
char* Log_CreateRtfHeader(MODULEINFO *mi);
-void Log_SetStyles();
// window.c
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index dc86a1208a..d869165204 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -42,11 +42,7 @@
* the srmm module and then modified to fit the chat module.
*/
-static int logPixelSY = 0;
-static int logPixelSX = 0;
static char *szDivider = "\\strike----------------------------------------------------------------------------\\strike0";
-static char CHAT_rtfFontsGlobal[OPTIONS_FONTCOUNT + 2][RTFCACHELINESIZE];
-static char *CHAT_rtffonts = 0;
/*
* ieview MUC support - mostly from scriver
@@ -486,14 +482,6 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r
return src;
}
-static char *Log_SetStyle(int style, int fontindex)
-{
- if (style < OPTIONS_FONTCOUNT)
- return CHAT_rtffonts + (style * RTFCACHELINESIZE);
-
- return "";
-}
-
static void Log_Append(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const char *fmt, ...)
{
va_list va;
@@ -597,7 +585,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff
case 'r':
if (!streamData->bStripFormat) {
int index = EventToIndex(streamData->lin);
- mir_snprintf(szTemp, SIZEOF(szTemp), "%s ", Log_SetStyle(index, index));
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%s ", pci->Log_SetStyle(index));
}
break;
}
@@ -748,11 +736,10 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
//get the number of pixels per logical inch
- if (logPixelSY == 0) {
- HDC hdc;
- hdc = GetDC(NULL);
- logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
+ if (pci->logPixelSY == 0) {
+ HDC hdc = GetDC(NULL);
+ pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
+ pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(NULL, hdc);
}
@@ -791,15 +778,15 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
HFONT hFont = CreateFontIndirect(&lf);
int iText = GetTextPixelSize(szString, hFont, true) + 3;
DeleteObject(hFont);
- iIndent += (iText * 1440) / logPixelSX;
+ iIndent += (iText * 1440) / pci->logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
}
else if (g_Settings.dwIconFlags) {
- iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / logPixelSX;
+ iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / pci->logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
}
if (g_Settings.bShowTime) {
- int iSize = (g_Settings.LogTextIndent * 1440) / logPixelSX;
+ int iSize = (g_Settings.LogTextIndent * 1440) / pci->logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize);
if (g_Settings.bLogIndentEnabled)
iIndent += iSize;
@@ -812,7 +799,7 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
{
char *buffer, *header;
- int bufferAlloced, bufferEnd, i, me = 0;
+ int bufferAlloced, bufferEnd, me = 0;
LOGINFO * lin = streamData->lin;
MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
@@ -852,12 +839,12 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
streamData->dat->dwFlags &= ~MWF_DIVIDERWANTED;
}
// create new line, and set font and color
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\ql\\sl0%s ", Log_SetStyle(0, 0));
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\ql\\sl0%s ", pci->Log_SetStyle(0));
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\v~-+%d+-~\\v0 ", lin);
// Insert icon
if (g_Settings.bLogSymbols) // use symbols
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s %c", Log_SetStyle(17, 17), EventToSymbol(lin));
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s %c", pci->Log_SetStyle(17), EventToSymbol(lin));
else if (g_Settings.dwIconFlags) {
int iIndex = lin->bIsHighlighted ? ICON_HIGHLIGHT : EventToIcon(lin);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\f0\\fs14");
@@ -875,16 +862,18 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
int iii;
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\\ul%d\\fs%u", iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0,F.lfItalic,F.lfUnderline, 2 * abs(F.lfHeight) * 74 / logPixelSY);
+ mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
+ iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0,F.lfItalic,F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->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\\ul%d\\fs%u", iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic,F.lfUnderline ,2 * abs(F.lfHeight) * 74 / logPixelSY);
+ mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
+ iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic,F.lfUnderline ,2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
}
- else Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(0, 0));
+ else Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", pci->Log_SetStyle(0));
// insert a TAB if necessary to put the timestamp in the right position
if (g_Settings.dwIconFlags)
@@ -912,7 +901,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (g_Settings.bLogClassicIndicators || g_Settings.bColorizeNicksInLog)
pszIndicator[0] = GetIndicator(streamData->si, lin->ptszNick, &crNickIndex);
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1, lin->bIsMe ? 2 : 1));
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", pci->Log_SetStyle(lin->bIsMe ? 2 : 1));
if (g_Settings.bLogClassicIndicators)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s", pszIndicator);
@@ -937,8 +926,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
}
// Insert the message
- i = lin->bIsHighlighted ? 16 : EventToIndex(lin);
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(i, i));
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", pci->Log_SetStyle(lin->bIsHighlighted ? 16 : EventToIndex(lin)));
streamData->lin = lin;
AddEventToBuffer(&buffer, &bufferEnd, &bufferAlloced, streamData);
}
@@ -1032,10 +1020,9 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr
//get the number of pixels per logical inch
if (bRedraw) {
- HDC hdc;
- hdc = GetDC(NULL);
- logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
+ HDC hdc = GetDC(NULL);
+ pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
+ pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(NULL, hdc);
SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
bFlag = true;
@@ -1146,22 +1133,3 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr
InvalidateRect(hwndRich, NULL, TRUE);
}
}
-
-void Log_SetStyles()
-{
- if (logPixelSY == 0) {
- HDC hdc;
- hdc = GetDC(NULL);
- logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
- ReleaseDC(NULL, hdc);
- }
-
- for (int i = 0; i < OPTIONS_FONTCOUNT; i++) {
- LOGFONT &F = pci->aFonts[i].lf;
- mir_snprintf(CHAT_rtfFontsGlobal[i], RTFCACHELINESIZE,
- "\\f%u\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u", i, i + 1,
- F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / logPixelSY);
- }
- CHAT_rtffonts = &(CHAT_rtfFontsGlobal[0][0]);
-}
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index 6eb0c2295f..914084cf02 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -196,8 +196,6 @@ static void OnLoadSettings()
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
g_Settings.SelectionBGBrush = CreateSolidBrush(g_Settings.nickColors[5]);
-
- Log_SetStyles();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index ba995964ef..42b2baf55c 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -545,7 +545,6 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
pci->ReloadSettings();
pci->MM_IconsChanged();
pci->MM_FontsChanged();
- Log_SetStyles();
pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
SM_ReconfigureFilters();
return TRUE;
@@ -736,7 +735,6 @@ void RegisterFontServiceFonts() {
int FontServiceFontsChanged(WPARAM,LPARAM)
{
- Log_SetStyles();
PluginConfig.reloadSettings();
CSkin::initAeroEffect();
CacheMsgLogIcons();
@@ -984,7 +982,6 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
pci->ReloadSettings();
pci->MM_FontsChanged();
- Log_SetStyles();
pci->MM_FixColors();
pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
@@ -1105,7 +1102,6 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
pci->ReloadSettings();
pci->MM_FontsChanged();
- Log_SetStyles();
pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
SM_ReconfigureFilters();
return TRUE;
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index c0b769a216..61beccc984 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -166,7 +166,6 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
if (si == NULL)
return;
- Chat_SetFilters(si);
if (si->hWnd != NULL) {
ActivateExistingTab(si->pContainer, si->hWnd);
return;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 68b58bf296..eb1afae46e 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -156,7 +156,6 @@ void TSAPI CacheLogFonts()
if (CInfoPanel::m_ipConfig.hFonts[i])
DeleteObject(CInfoPanel::m_ipConfig.hFonts[i]);
LoadLogfont(i + 100, &lf, &clr, FONTMODULE);
- //lf.lfHeight =-MulDiv(lf.lfHeight, logPixelSY, 72);
lf.lfUnderline = 0;
CInfoPanel::m_ipConfig.hFonts[i] = CreateFontIndirectA(&lf);
CInfoPanel::m_ipConfig.clrs[i] = clr;
@@ -164,9 +163,9 @@ void TSAPI CacheLogFonts()
hdc = GetDC(PluginConfig.g_hwndHotkeyHandler);
- HFONT hOldFont = (HFONT)SelectObject(hdc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]);
- SIZE sz;
+ HFONT hOldFont = (HFONT)SelectObject(hdc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]);
+ SIZE sz;
GetTextExtentPoint32(hdc, _T("WMA"), 3, &sz);
CInfoPanel::m_ipConfig.height1 = sz.cy;
SelectObject(hdc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_UIN]);