From b638838fd6ec1eb32d096e0244e8e0d2a8196c73 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 17 Jan 2014 14:41:49 +0000 Subject: - kernel chat module loads automatically, not on request; - the special structure, CHAT_MANAGER_INITDATA, is used to customize chats; - fix for fonts group for all plugins; - fix for options in tabSRMM git-svn-id: http://svn.miranda-ng.org/main/trunk@7688 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/main.cpp | 9 +- plugins/Scriver/src/chat/window.cpp | 6 +- plugins/Scriver/src/globals.cpp | 2 +- plugins/Scriver/src/infobar.cpp | 4 +- plugins/Scriver/src/msgdialog.cpp | 2 +- plugins/Scriver/src/msglog.cpp | 6 +- plugins/Scriver/src/msgoptions.cpp | 115 ++--------- plugins/Scriver/src/msgs.h | 2 +- plugins/TabSRMM/src/chat/chat.h | 4 +- plugins/TabSRMM/src/chat/log.cpp | 78 +------- plugins/TabSRMM/src/chat/main.cpp | 49 ++++- plugins/TabSRMM/src/chat/options.cpp | 360 +++++++++++++---------------------- plugins/TabSRMM/src/chat/window.cpp | 14 +- plugins/TabSRMM/src/commonheaders.h | 4 +- plugins/TabSRMM/src/msgs.h | 7 +- 15 files changed, 215 insertions(+), 447 deletions(-) (limited to 'plugins') diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index d37559ea20..6a54c7b865 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -21,9 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h" -void RegisterChatFonts( void ); - -//globals +// globals CHAT_MANAGER *pci; HMENU g_hMenu = NULL; @@ -144,9 +142,8 @@ void LoadChatIcons(void) int Chat_Load() { - mir_getCI(&g_Settings); - pci->cbModuleInfo = sizeof(MODULEINFO); - pci->cbSession = sizeof(SESSION_INFO); + CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats") }; + mir_getCI(&data); pci->OnCreateModule = OnCreateModule; pci->OnNewUser = OnNewUser; diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 091bab7cbd..40ae167644 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -470,7 +470,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, UINT u2 = 0; COLORREF cr; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr); CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); @@ -1142,7 +1142,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { // messagebox COLORREF crFore; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore); CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); @@ -1893,7 +1893,7 @@ LABEL_SHOWWINDOW: } else { COLORREF cr; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr); cf.dwMask = CFM_COLOR; cf.crTextColor = cr; if (pInfo->bSingleFormat) diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 943895004d..65a04c3f12 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -219,7 +219,7 @@ static BOOL CALLBACK LangAddCallback(CHAR * str) void LoadInfobarFonts() { LOGFONT lf; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL, FALSE); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL); g_dat.minInputAreaHeight = db_get_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat.logPixelSY / 72; if (g_dat.hInfobarBrush != NULL) DeleteObject(g_dat.hInfobarBrush); diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index a7ce5bfa30..d4c7caee6d 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -31,7 +31,7 @@ void SetupInfobar(InfobarWindowData* idat) { DWORD colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR); SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETBKGNDCOLOR, 0, colour); SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETBKGNDCOLOR, 0, colour); - LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour, FALSE); + LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour); cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.cbSize = sizeof(cf2); cf2.crTextColor = colour; @@ -43,7 +43,7 @@ void SetupInfobar(InfobarWindowData* idat) { cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY; SendDlgItemMessageA(hwnd, IDC_INFOBAR_NAME, EM_SETCHARFORMAT, 0, (LPARAM)&cf2); - LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour, FALSE); + LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour); cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.cbSize = sizeof(cf2); cf2.crTextColor = colour; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 8a43b212e7..51bf39deb2 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1154,7 +1154,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, colour); InvalidateRect(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, FALSE); - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour, FALSE); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour); cf2.cbSize = sizeof(cf2); cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.crTextColor = colour; diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index f1255c6456..a6c124cb08 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -363,13 +363,13 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat, struct GlobalMessageDat buffer[0] = '\0'; AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced,"{\\rtf1\\ansi\\deff0{\\fonttbl"); for (i = 0; i < fontOptionsListSize; i++) { - LoadMsgDlgFont(i, &lf, NULL, FALSE); + LoadMsgDlgFont(i, &lf, NULL); AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "{\\f%u\\fnil\\fcharset%u %S;}", i, (!forceCharset) ? lf.lfCharSet : charset, lf.lfFaceName); } AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}{\\colortbl "); for (i = 0; i < fontOptionsListSize; i++) { - LoadMsgDlgFont(i, NULL, &colour, FALSE); + LoadMsgDlgFont(i, NULL, &colour); AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour)); } if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) @@ -404,7 +404,7 @@ static char* SetToStyle(int style) { static char szStyle[128]; LOGFONT lf; - LoadMsgDlgFont(style, &lf, NULL, FALSE); + LoadMsgDlgFont(style, &lf, NULL); mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); return szStyle; } diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index e14213c100..21a5586116 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -78,30 +78,6 @@ static const FontOptionsList fontOptionsList[] = { int fontOptionsListSize = SIZEOF(fontOptionsList); -//remeber to put these in the Translate( ) template file too -static const FontOptionsList chatFontOptionsList[] = { - { LPGENT("Timestamp"), RGB(50, 50, 240), _T("Terminal"), 0, -8, LPGENT("Background")}, - { LPGENT("Others nicknames"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")}, - { LPGENT("Your nickname"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")}, - { LPGENT("User has joined"), RGB(90, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("User has left"), RGB(160, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("User has disconnected"), RGB(160, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("User kicked ..."), RGB(100, 100, 100), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("User is now known as ..."), RGB(90, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Notice from user"), RGB(160, 130, 60), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Incoming message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Outgoing message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("The topic is ..."), RGB(70, 70, 160), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Information messages"), RGB(130, 130, 195), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("User enables status for ..."), RGB(70, 150, 70), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("User disables status for ..."), RGB(150, 70, 70), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Action message"), RGB(160, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Highlighted message"), RGB(180, 150, 80), _T("Verdana"), 0, -13, LPGENT("Background")}, - { LPGENT("Message typing area"), RGB(0, 0, 40), _T("Verdana"), 0, -14, LPGENT("Message background")}, - { LPGENT("User list members (online)"), RGB(0,0, 0), _T("Verdana"), 0, -12, LPGENT("User list background")}, - { LPGENT("User list members (away)"), RGB(170, 170, 170), _T("Verdana"), 0, -12, LPGENT("User list background")}, -}; - struct ColourOptionsList { const TCHAR *szName; @@ -172,58 +148,6 @@ void RegisterFontServiceFonts() } } -void RegisterChatFonts(void) -{ - FontIDT fid = { 0 }; - ColourIDT colourid; - char idstr[10]; - int index = 0, i; - fid.cbSize = sizeof(FontIDT); - mir_sntprintf(fid.group, SIZEOF(fid.group), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats")); - mir_sntprintf(fid.backgroundGroup, SIZEOF(fid.backgroundGroup), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats")); - strncpy(fid.dbSettingsGroup, "ChatFonts", sizeof(fid.dbSettingsGroup)); - fid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART; - for (i = 0; i < SIZEOF(chatFontOptionsList); i++) { - if (i == 17) continue; - fid.order = index++; - mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); - strncpy(fid.prefix, idstr, sizeof(fid.prefix)); - _tcsncpy(fid.name, chatFontOptionsList[i].szDescr, SIZEOF(fid.name)); - fid.deffontsettings.colour = chatFontOptionsList[i].defColour; - fid.deffontsettings.size = chatFontOptionsList[i].defSize; - fid.deffontsettings.style = chatFontOptionsList[i].defStyle; - fid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); - _tcsncpy(fid.deffontsettings.szFace, chatFontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace)); - _tcsncpy(fid.backgroundName, chatFontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName)); - FontRegisterT(&fid); - } - - colourid.cbSize = sizeof(ColourIDT); - colourid.order = 0; - strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup)); - - strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); - mir_sntprintf(colourid.group, SIZEOF(colourid.group), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats")); - colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterT(&colourid); - - strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("User list background"), SIZEOF(colourid.name)); - colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterT(&colourid); - - strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("User list lines"), SIZEOF(colourid.name)); - colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); - ColourRegisterT(&colourid); - - strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("User list background (selected)"), SIZEOF(colourid.name)); - colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - ColourRegisterT(&colourid); -} - int IconsChanged(WPARAM wParam, LPARAM lParam) { ReleaseIcons(); @@ -242,27 +166,23 @@ int SmileySettingsChanged(WPARAM wParam, LPARAM lParam) return 0; } -void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) +void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) { char str[32]; - int style; - DBVARIANT dbv; - const char * module = chatMode ? "ChatFonts" : SRMMMOD; - const char * prefix = chatMode ? "Font" : "SRMFont"; - const FontOptionsList * fontList = chatMode ? chatFontOptionsList : fontOptionsList; if (colour) { - mir_snprintf(str, SIZEOF(str), "%s%dCol", prefix, i); - *colour = db_get_dw(NULL, module, str, fontList[i].defColour); + mir_snprintf(str, SIZEOF(str), "%s%dCol", "SRMFont", i); + *colour = db_get_dw(NULL, SRMMMOD, str, fontOptionsList[i].defColour); } + if (lf) { - mir_snprintf(str, SIZEOF(str), "%s%dSize", prefix, i); - lf->lfHeight = (char)db_get_b(NULL, module, str, fontList[i].defSize); + mir_snprintf(str, SIZEOF(str), "%s%dSize", "SRMFont", i); + lf->lfHeight = (char)db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; - mir_snprintf(str, SIZEOF(str), "%s%dSty", prefix, i); - style = db_get_b(NULL, module, str, fontList[i].defStyle); + mir_snprintf(str, SIZEOF(str), "%s%dSty", "SRMFont", i); + int style = db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defStyle); lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & FONTF_ITALIC ? 1 : 0; lf->lfUnderline = 0; @@ -271,15 +191,16 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - mir_snprintf(str, SIZEOF(str), "%s%d", prefix, i); - if (db_get_ts(NULL, module, str, &dbv)) - lstrcpy(lf->lfFaceName, fontList[i].szDefFace); - else { - _tcsncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); - db_free(&dbv); - } - mir_snprintf(str, SIZEOF(str), "%s%dSet", prefix, i); - lf->lfCharSet = db_get_b(NULL, module, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); + mir_snprintf(str, SIZEOF(str), "%s%d", "SRMFont", i); + + ptrT tszFace(db_get_tsa(NULL, SRMMMOD, str)); + if (tszFace == NULL) + lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); + else + _tcsncpy(lf->lfFaceName, tszFace, SIZEOF(lf->lfFaceName)); + + mir_snprintf(str, SIZEOF(str), "%s%dSet", "SRMFont", i); + lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); } } diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 39c8f53331..7e593ec9a4 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -250,7 +250,7 @@ int IsAutoPopup(HANDLE hContact); #define MSGFONTID_INFOBAR_NAME 12 #define MSGFONTID_INFOBAR_STATUS 13 -void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode); +void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour); extern int fontOptionsListSize; #define LOADHISTORY_UNREAD 0 diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index e2bc495ffa..60b1a4598b 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -140,7 +140,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); TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime); -char* Log_CreateRtfHeader(MODULEINFO * mi); void Log_SetStyles(); // window.c @@ -148,9 +147,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth); // options.c -enum { FONTSECTION_AUTO, FONTSECTION_CHAT, FONTSECTION_IM, FONTSECTION_IP }; +enum { FONTSECTION_AUTO, FONTSECTION_IM, FONTSECTION_IP }; int OptionsInit(void); -int OptionsUnInit(void); void LoadMsgDlgFont(int section, int i, LOGFONT * lf, COLORREF * colour, char* szMod); void AddIcons(void); HICON LoadIconEx(int iIndex, char * pszIcoLibName, int iX, int iY); diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 88d00c2fce..424c5526ff 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -755,7 +755,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) // ### RTF HEADER if (0 == mi->pszHeader) - mi->pszHeader = Log_CreateRtfHeader(mi); + mi->pszHeader = pci->Log_CreateRtfHeader(mi); header = mi->pszHeader; streamData->crCount = mi->nColorCount; @@ -1125,82 +1125,6 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr } } -char * Log_CreateRtfHeader(MODULEINFO * mi) -{ - char *buffer; - int bufferAlloced, bufferEnd, i = 0; - - // guesstimate amount of memory for the RTF header - bufferEnd = 0; - bufferAlloced = 4096; - buffer = (char *) mir_realloc(mi->pszHeader, bufferAlloced); - buffer[0] = '\0'; - - - //get the number of pixels per logical inch - if (logPixelSY == 0) { - HDC hdc; - hdc = GetDC(NULL); - logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); - ReleaseDC(NULL, hdc); - } - - // ### RTF HEADER - - // font table - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "{\\rtf1\\ansi\\deff0{\\fonttbl"); - for (i=0; i < OPTIONS_FONTCOUNT ; i++) - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "{\\f%u\\fnil\\fcharset%u%S;}", i, pci->aFonts[i].lf.lfCharSet, pci->aFonts[i].lf.lfFaceName); - - // colour table - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "}{\\colortbl ;"); - - for (i=0; i < OPTIONS_FONTCOUNT; i++) - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\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++) - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(mi->crColors[i]), GetGValue(mi->crColors[i]), GetBValue(mi->crColors[i])); - - for (i=0; i < 5; i++) - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(g_Settings.nickColors[i]), GetGValue(g_Settings.nickColors[i]), GetBValue(g_Settings.nickColors[i])); - - // new paragraph - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "}\\pard\\sl%d", 1000); - - // set tabs and indents - { - int iIndent = 0; - - if (g_Settings.bLogSymbols) { - TCHAR szString[2]; - LOGFONT lf; - HFONT hFont; - int iText; - - szString[1] = 0; - szString[0] = 0x28; - LoadMsgDlgFont(FONTSECTION_CHAT, 17, &lf, NULL, CHAT_FONTMODULE); - hFont = CreateFontIndirect(&lf); - iText = GetTextPixelSize(szString, hFont, true) + 3; - DeleteObject(hFont); - iIndent += (iText * 1440) / logPixelSX; - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent); - } else if (g_Settings.dwIconFlags) { - iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / logPixelSX; - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent); - } - if (g_Settings.ShowTime) { - int iSize = (g_Settings.LogTextIndent * 1440) / logPixelSX; - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize); - if (g_Settings.LogIndentEnabled) - iIndent += iSize; - } - Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\fi-%u\\li%u", iIndent, iIndent); - } - return buffer; -} - void Log_SetStyles() { if (logPixelSY == 0) { diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 5a8a10c014..690e5665e4 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -171,13 +171,13 @@ static void OnLoadSettings() DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_OFFLINE]); } - LoadMsgDlgFont(FONTSECTION_CHAT, 18, &lf, NULL, CHAT_FONTMODULE); + pci->LoadMsgDlgFont(18, &lf, NULL); g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf); - LoadMsgDlgFont(FONTSECTION_CHAT, 19, &lf, NULL, CHAT_FONTMODULE); + pci->LoadMsgDlgFont(19, &lf, NULL); g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf); - LoadMsgDlgFont(FONTSECTION_CHAT, 5, &lf, NULL, CHAT_FONTMODULE); + 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); @@ -232,12 +232,47 @@ void Chat_ModulesLoaded() static CHAT_MANAGER saveCI; +static int CopyChatSetting(const char *szSetting, LPARAM param) +{ + LIST *szSettings = (LIST*)param; + szSettings->insert(mir_strdup(szSetting)); + return 0; +} + +static void CheckUpdate() +{ + // already converted? + if (db_get_b(NULL, "Compatibility", "TabChatFonts", false)) + return; + + LIST szSettings(120); + + DBCONTACTENUMSETTINGS dbces = { 0 }; + dbces.szModule = CHAT_OLDFONTMODULE; + dbces.pfnEnumProc = CopyChatSetting; + dbces.lParam = (LPARAM)&szSettings; + CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces); + + DBVARIANT dbv; + for (int i = szSettings.getCount() - 1; i >= 0; i--) { + char *p = szSettings[i]; + db_get(NULL, CHAT_OLDFONTMODULE, p, &dbv); + db_set(NULL, CHAT_FONTMODULE, p, &dbv); + db_free(&dbv); + mir_free(p); + } + + CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)CHAT_OLDFONTMODULE); + db_set_b(NULL, "Compatibility", "TabChatFonts", true); +} + int Chat_Load() { - mir_getCI(&g_Settings); + CheckUpdate(); + + CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Message Sessions")_T("/")LPGENT("Group chats") }; + mir_getCI(&data); saveCI = *pci; - pci->cbModuleInfo = sizeof(MODULEINFO); - pci->cbSession = sizeof(SESSION_INFO); pci->OnCreateModule = OnCreateModule; pci->OnNewUser = OnNewUser; @@ -263,7 +298,6 @@ int Chat_Load() g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU)); - OnLoadSettings(); OptionsInit(); return 0; } @@ -276,6 +310,5 @@ int Chat_Unload(void) { *pci = saveCI; DestroyMenu(g_hMenu); - OptionsUnInit(); return 0; } diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 4ea5b77987..6b94c5d6e9 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -59,9 +59,9 @@ struct ColorOptionsList }; /* - * note: bits 24-31 in default color indicates that color is a system color index - * (GetSysColor(default_color & 0x00ffffff)), not a rgb value. - */ +* note: bits 24-31 in default color indicates that color is a system color index +* (GetSysColor(default_color & 0x00ffffff)), not a rgb value. +*/ static ColorOptionsList _clrs[] = { 0, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), LPGENT("Group chat log background"), SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR, 1, LPGENT("Message Sessions"), LPGENT("Input area background"), "inputbg", SRMSGDEFSET_BKGCOLOUR, @@ -96,64 +96,38 @@ static ColorOptionsList _tabclrs[] = { extern LOGFONT lfDefault; -//remember to put these in the Translate( ) template file too -static FontOptionsList CHAT_fontOptionsList[] = { - {LPGENT("Timestamp"), RGB(50, 50, 240), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Others nicknames"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("Your nickname"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("User has joined"), RGB(90, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User has left"), RGB(160, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User has disconnected"), RGB(160, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User kicked ..."), RGB(100, 100, 100), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User is now known as ..."), RGB(90, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Notice from user"), RGB(160, 130, 60), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Incoming message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Outgoing message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("The topic is ..."), RGB(70, 70, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Information messages"), RGB(130, 130, 195), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User enables status for ..."), RGB(70, 150, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User disables status for ..."), RGB(150, 70, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Action message"), RGB(160, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Highlighted message"), RGB(180, 150, 80), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Chat log symbols (Webdings)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User list members (Online)"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("User list members (away)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, -}; - -const int msgDlgFontCount = SIZEOF(CHAT_fontOptionsList); - static FontOptionsList IM_fontOptionsList[] = { - {LPGENT(">> Outgoing messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT(">> Outgoing misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("<< Incoming messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("<< Incoming misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT(">> Outgoing name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT(">> Outgoing timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("<< Incoming name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("<< Incoming timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT(">> Outgoing messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT(">> Outgoing misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("<< Incoming messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("<< Incoming misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT(">> Outgoing name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT(">> Outgoing timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("<< Incoming name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("<< Incoming timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12}, - {LPGENT("* Message Input Area"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("* Status changes"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("* Dividers"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("* Error and warning Messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("* Symbols (incoming)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12}, - {LPGENT("* Symbols (outgoing)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12}, + { LPGENT(">> Outgoing messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT(">> Outgoing misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("<< Incoming messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("<< Incoming misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT(">> Outgoing name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT(">> Outgoing timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT("<< Incoming name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT("<< Incoming timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT(">> Outgoing messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT(">> Outgoing misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("<< Incoming messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("<< Incoming misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT(">> Outgoing name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT(">> Outgoing timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT("<< Incoming name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT("<< Incoming timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 }, + { LPGENT("* Message Input Area"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("* Status changes"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("* Dividers"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("* Error and warning Messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("* Symbols (incoming)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12 }, + { LPGENT("* Symbols (outgoing)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12 }, }; static FontOptionsList IP_fontOptionsList[] = { - {LPGENT("Nickname"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("UIN"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Status"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Protocol"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Contacts local time"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, - {LPGENT("Window caption (skinned mode)"), RGB(255, 255, 255), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12}, + { LPGENT("Nickname"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("UIN"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("Status"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("Protocol"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("Contacts local time"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, + { LPGENT("Window caption (skinned mode)"), RGB(255, 255, 255), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }, }; static FontOptionsList *fontOptionsList = IM_fontOptionsList; @@ -167,48 +141,40 @@ struct branch_t { HTREEITEM hItem; }; static branch_t branch1[] = { - {LPGENT("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, NULL}, - {LPGENT("Flash window when someone speaks"), "FlashWindow", 0, 0, NULL}, - {LPGENT("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL}, -//TODO Fix for 3.0 !!! - -#if !defined(__DELAYED_FOR_3_1) - {LPGENT("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0,0, NULL}, - {LPGENT("Activate chat window on highlight"), "AnnoyingHighlight", 0,0, NULL}, -#endif - - {LPGENT("Show list of users in the chat room"), "ShowNicklist", 0, 1, NULL}, - {LPGENT("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, NULL}, - {LPGENT("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, NULL}, - {LPGENT("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, NULL}, - {LPGENT("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, NULL}, - {LPGENT("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, NULL}, - {LPGENT("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, NULL}, - {LPGENT("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, NULL}, - {LPGENT("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, NULL}, - //MAD: simple customization improvement - {LPGENT("Use IRC style status indicators in the user list"), "ClassicIndicators", 0, 0, NULL}, - {LPGENT("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, NULL}, + { LPGENT("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, NULL }, + { LPGENT("Flash window when someone speaks"), "FlashWindow", 0, 0, NULL }, + { LPGENT("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL }, + { LPGENT("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0, 0, NULL }, + { LPGENT("Activate chat window on highlight"), "AnnoyingHighlight", 0, 0, NULL }, + { LPGENT("Show list of users in the chat room"), "ShowNicklist", 0, 1, NULL }, + { LPGENT("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, NULL }, + { LPGENT("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, NULL }, + { LPGENT("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, NULL }, + { LPGENT("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, NULL }, + { LPGENT("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, NULL }, + { LPGENT("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, NULL }, + { LPGENT("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, NULL }, + { LPGENT("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, NULL }, + { LPGENT("Use IRC style status indicators in the user list"), "ClassicIndicators", 0, 0, NULL }, + { LPGENT("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, NULL }, }; static branch_t branch2[] = { - {LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL}, - {LPGENT("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, NULL}, - {LPGENT("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, NULL}, - {LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL}, - {LPGENT("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, NULL}, - {LPGENT("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, NULL}, - {LPGENT("Start private conversation on doubleclick in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, NULL}, - {LPGENT("Strip colors from messages in the log"), "StripFormatting", 0, 0, NULL}, - {LPGENT("Enable the \'event filter\' for new rooms"), "FilterEnabled", 0, 0, NULL}, -//MAD: simple customization improvement - {LPGENT("Use IRC style status indicators in the log"), "LogClassicIndicators", 0,0, NULL}, -// - {LPGENT("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL}, - {LPGENT("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL}, - {LPGENT("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL}, - {LPGENT("Place a separator in the log after a window lost its foreground status"), "UseDividers", 0, 1, NULL}, - {LPGENT("Only place a separator when an incoming event is announced with a popup"), "DividersUsePopupConfig", 0, 1, NULL} + { LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL }, + { LPGENT("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, NULL }, + { LPGENT("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, NULL }, + { LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL }, + { LPGENT("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, NULL }, + { LPGENT("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, NULL }, + { LPGENT("Start private conversation on doubleclick in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, NULL }, + { LPGENT("Strip colors from messages in the log"), "StripFormatting", 0, 0, NULL }, + { LPGENT("Enable the \'event filter\' for new rooms"), "FilterEnabled", 0, 0, NULL }, + { LPGENT("Use IRC style status indicators in the log"), "LogClassicIndicators", 0, 0, NULL }, + { LPGENT("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL }, + { LPGENT("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL }, + { LPGENT("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL }, + { LPGENT("Place a separator in the log after a window lost its foreground status"), "UseDividers", 0, 1, NULL }, + { LPGENT("Only place a separator when an incoming event is announced with a popup"), "DividersUsePopupConfig", 0, 1, NULL } }; static HWND hPathTip = 0; @@ -222,7 +188,6 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM FontOptionsList *fol = fontOptionsList; switch (section) { - case FONTSECTION_CHAT: fol = CHAT_fontOptionsList; break; case FONTSECTION_IM: fol = IM_fontOptionsList; break; case FONTSECTION_IP: fol = IP_fontOptionsList; break; } @@ -231,9 +196,10 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM mir_snprintf(str, SIZEOF(str), "Font%dCol", i); *colour = M.GetDword(szMod, str, fol[j].defColour); } + if (lf) { mir_snprintf(str, SIZEOF(str), "Font%dSize", i); - lf->lfHeight = (char) M.GetByte(szMod, str, fol[j].defSize); + lf->lfHeight = (char)M.GetByte(szMod, str, fol[j].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; @@ -249,7 +215,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & FONTF_ITALIC ? 1 : 0; lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0; - lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0; + lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0; } mir_snprintf(str, SIZEOF(str), "Font%dSet", i); lf->lfCharSet = M.GetByte(szMod, str, fol[j].defCharset); @@ -261,10 +227,11 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM if ((i == 17 && !strcmp(szMod, CHAT_FONTMODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) { lf->lfCharSet = SYMBOL_CHARSET; lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName)); - } else { - if (db_get_ts(NULL, szMod, str, &dbv)) { + } + else { + if (db_get_ts(NULL, szMod, str, &dbv)) lstrcpy(lf->lfFaceName, fol[j].szDefFace); - } else { + else { lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); db_free(&dbv); } @@ -296,7 +263,7 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, branch_t *branch, int n tvis.hParent = hParent; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_STATE; - for (int i=0;i < nValues;i++) { + for (int i = 0; i < nValues; i++) { tvis.item.pszText = TranslateTS(branch[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; if (branch[i].iMode) @@ -315,7 +282,7 @@ static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues) int iState = 0; tvi.mask = TVIF_HANDLE | TVIF_STATE; - for (int i=0;i < nValues;i++) { + for (int i = 0; i < nValues; i++) { tvi.hItem = branch[i].hItem; TreeView_GetItem(hwndTree, &tvi); bChecked = ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2) ? 0 : 1; @@ -325,7 +292,8 @@ static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues) if (iState & GC_EVENT_ADDSTATUS) iState |= GC_EVENT_REMOVESTATUS; db_set_dw(0, "Chat", branch[i].szDBName, (DWORD)iState); - } else db_set_b(0, "Chat", branch[i].szDBName, bChecked); + } + else db_set_b(0, "Chat", branch[i].szDBName, bChecked); } } @@ -364,7 +332,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) tvi.mask = TVIF_HANDLE | TVIF_STATE; tvi.hItem = hHeading; TreeView_GetItem(hwndTree, &tvi); - if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 3)||((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 1)) + if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 3) || ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 1)) bChecked = FALSE; tvi.stateMask = TVIS_STATEIMAGEMASK; @@ -372,7 +340,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) TreeView_SetItem(hwndTree, &tvi); tvi.hItem = TreeView_GetNextItem(hwndTree, hHeading, TVGN_CHILD); while (tvi.hItem) { - tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 3:2); + tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 3 : 2); if (tvi.hItem != branch1[0].hItem && tvi.hItem != branch1[1].hItem) TreeView_SetItem(hwndTree, &tvi); tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); @@ -388,19 +356,13 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p break; case BFFM_SELCHANGED: - if (SHGetPathFromIDListA((LPITEMIDLIST) lp , szDir)) + if (SHGetPathFromIDListA((LPITEMIDLIST)lp, szDir)) SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir); break; } return 0; } -static void LoadLogFonts(void) -{ - for (int i=0; i < OPTIONS_FONTCOUNT; i++) - LoadMsgDlgFont(FONTSECTION_CHAT, i, &pci->aFonts[i].lf, &pci->aFonts[i].color, CHAT_FONTMODULE); -} - static IconItem _icons[] = { { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR }, @@ -478,10 +440,10 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) ti.hwnd = hwndParent; ti.hinst = g_hInst; ti.lpszText = ptszText; - GetClientRect (hwndParent, &ti.rect); + GetClientRect(hwndParent, &ti.rect); ti.rect.left = -65; - SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO) &ti); + SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO)&ti); SendMessage(hwndTT, TTM_SETTITLE, 1, (LPARAM)ptszTitle); SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, (LPARAM)640); return hwndTT; @@ -494,8 +456,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM switch (uMsg) { case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { - TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); HIMAGELIST himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_CHECKBOXES, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList()); @@ -535,7 +497,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) hti.flags |= TVHT_ONITEMSTATEICON; if (hti.flags&TVHT_ONITEMSTATEICON) { - TVITEM tvi = {0}; + TVITEM tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_STATE; tvi.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD; @@ -550,7 +512,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (tvi.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) { tvi.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD; SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi); - } else if (hti.flags&TVHT_ONITEMSTATEICON) { + } + else if (hti.flags&TVHT_ONITEMSTATEICON) { if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 3) { tvi.state = INDEXTOSTATEIMAGEMASK(1); SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi); @@ -565,31 +528,27 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - { - int iLen; - TCHAR *pszText = NULL; - BYTE b; - - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); - if (iLen > 0) { - pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR)); - GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "AddToGroup", pszText); - } else - db_set_ts(NULL, "Chat", "AddToGroup", _T("")); - - g_Settings.hGroup = 0; - - mir_free(pszText); - - b = M.GetByte("Chat", "Tabs", 1); - SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1)); - SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2)); - - pci->MM_FontsChanged(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); - SM_ReconfigureFilters(); + int iLen; + TCHAR *pszText = NULL; + BYTE b; + + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); + if (iLen > 0) { + pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR)); + GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); + db_set_ts(NULL, "Chat", "AddToGroup", pszText); } + else db_set_ts(NULL, "Chat", "AddToGroup", _T("")); + + mir_free(pszText); + + b = M.GetByte("Chat", "Tabs", 1); + SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1)); + SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2)); + + pci->MM_FontsChanged(); + pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + SM_ReconfigureFilters(); return TRUE; } } @@ -604,12 +563,11 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM return FALSE; } -static TCHAR* chatcolorsnames[] ={ -// LPGENT("Your nickname"), +static TCHAR* chatcolorsnames[] = +{ LPGENT("Channel operators"), LPGENT("Half operators"), LPGENT("Voiced"), -// LPGENT("Others nicknames"), LPGENT("Extended mode 1"), LPGENT("Extended mode 2"), LPGENT("Selection background"), @@ -628,15 +586,15 @@ void RegisterFontServiceFonts() { strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); - for (int i=0; i < SIZEOF(IM_fontOptionsList); i++) { - fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS; - LoadMsgDlgFont(FONTSECTION_IM, i , &lf, &fontOptionsList[i].colour, FONTMODULE); + for (int i = 0; i < SIZEOF(IM_fontOptionsList); i++) { + fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; + LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE); mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i); strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); fid.order = i; _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; - fid.deffontsettings.size = (char) lf.lfHeight; + fid.deffontsettings.size = (char)lf.lfHeight; fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fid.deffontsettings.charset = lf.lfCharSet; fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); @@ -688,25 +646,25 @@ void RegisterFontServiceFonts() { } fontOptionsList = IP_fontOptionsList; - fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS; + fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; //fid.flags|=FIDF_SAVEPOINTSIZE; _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group)); _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup)); _tcsncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName)); - for (int i=0; i < IPFONTCOUNT; i++) { - LoadMsgDlgFont(FONTSECTION_IP, i + 100 , &lf, &fontOptionsList[i].colour, FONTMODULE); + for (int i = 0; i < IPFONTCOUNT; i++) { + LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE); mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i + 100); strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); - fid.order = i + 100 ; + fid.order = i + 100; _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; - fid.deffontsettings.size = (char) lf.lfHeight; + fid.deffontsettings.size = (char)lf.lfHeight; fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fid.deffontsettings.charset = lf.lfCharSet; fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); fid.deffontsettings.charset = lf.lfCharSet; _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE); - if (i==IPFONTCOUNT-1){ + if (i == IPFONTCOUNT - 1) { _tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup)); _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName)); _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group)); @@ -714,36 +672,12 @@ void RegisterFontServiceFonts() { FontRegisterT(&fid); } - fontOptionsList = CHAT_fontOptionsList; - fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS; - fid.flags&=~FIDF_SAVEPOINTSIZE; - _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(fid.group)); - strncpy(fid.dbSettingsGroup, CHAT_FONTMODULE, SIZEOF(fid.dbSettingsGroup)); - for (int i=0; i < msgDlgFontCount; i++) { - LoadMsgDlgFont(FONTSECTION_CHAT, i , &lf, &fontOptionsList[i].colour, CHAT_FONTMODULE); - mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i); - strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); - fid.order = i; - _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); - fid.deffontsettings.colour = fontOptionsList[i].colour; - fid.deffontsettings.size = (char) lf.lfHeight; - fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); - fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); - fid.deffontsettings.charset = lf.lfCharSet; - _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE); - _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(fid.backgroundGroup)); - _tcsncpy(fid.backgroundName, LPGENT("Group chat log background"), SIZEOF(fid.backgroundName)); - if (i == 18 || i == 19) - _tcsncpy(fid.backgroundName, LPGENT("Userlist background"), SIZEOF(fid.backgroundName)); - FontRegisterT(&fid); - } - _tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group)); strncpy(cid.dbSettingsGroup, "Chat", SIZEOF(cid.dbSettingsGroup)); - for (int i=0; i <= 7; i++) { + for (int i = 0; i <= 7; i++) { mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i); _tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name)); - cid.order=i+1; + cid.order = i + 1; strncpy(cid.setting, szTemp, SIZEOF(cid.setting)); switch (i) { case 5: @@ -753,24 +687,22 @@ void RegisterFontServiceFonts() { cid.defcolour = GetSysColor(COLOR_HIGHLIGHTTEXT); break; default: - cid.defcolour =RGB(0, 0, 0); + cid.defcolour = RGB(0, 0, 0); break; } ColourRegisterT(&cid); } - cid.order=8; + cid.order = 8; _tcsncpy(cid.name, LPGENT("Userlist background"), SIZEOF(cid.name)); strncpy(cid.setting, "ColorNicklistBG", SIZEOF(cid.setting)); cid.defcolour = SRMSGDEFSET_BKGCOLOUR; ColourRegisterT(&cid); - /* - * static colors (info panel, tool bar background etc...) - */ + // static colors (info panel, tool bar background etc...) strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); - for (int i=0; i < SIZEOF(_clrs); i++) { + for (int i = 0; i < SIZEOF(_clrs); i++) { cid.order = _clrs[i].order; _tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group)); _tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name)); @@ -784,10 +716,8 @@ void RegisterFontServiceFonts() { strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup)); - /* - * text and background colors for tabs - */ - for (int i=0; i < SIZEOF(_tabclrs); i++) { + // text and background colors for tabs + for (int i = 0; i < SIZEOF(_tabclrs); i++) { cid.order = _tabclrs[i].order; _tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group)); _tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name)); @@ -803,21 +733,6 @@ void RegisterFontServiceFonts() { int FontServiceFontsChanged(WPARAM,LPARAM) { - LoadLogFonts(); - - LOGFONT lf; - LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE); - HFONT hFont = CreateFontIndirect(&lf); - int iText = GetTextPixelSize(pci->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 = M.GetBool("Chat", "LogIndentEnabled", true); - - pci->MM_FontsChanged(); - pci->MM_FixColors(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); - PluginConfig.reloadSettings(); CSkin::initAeroEffect(); CacheMsgLogIcons(); @@ -829,10 +744,12 @@ int FontServiceFontsChanged(WPARAM,LPARAM) return 0; } - -static UINT _o2chatcontrols[] = { IDC_CHAT_SPIN2, IDC_LIMIT, IDC_CHAT_SPIN4, IDC_LOGTIMESTAMP, IDC_TIMESTAMP, - IDC_OUTSTAMP, IDC_FONTCHOOSE, IDC_LOGGING, IDC_LOGDIRECTORY, IDC_INSTAMP, IDC_CHAT_SPIN2, IDC_CHAT_SPIN3, IDC_NICKROW2, IDC_LOGLIMIT, - IDC_STATIC110, IDC_STATIC112, 0}; +static UINT _o2chatcontrols[] = +{ + IDC_CHAT_SPIN2, IDC_LIMIT, IDC_CHAT_SPIN4, IDC_LOGTIMESTAMP, IDC_TIMESTAMP, + IDC_OUTSTAMP, IDC_FONTCHOOSE, IDC_LOGGING, IDC_LOGDIRECTORY, IDC_INSTAMP, IDC_CHAT_SPIN2, IDC_CHAT_SPIN3, IDC_NICKROW2, IDC_LOGLIMIT, + IDC_STATIC110, IDC_STATIC112, 0 +}; static UINT _o3chatcontrols[] = {0}; @@ -841,7 +758,6 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - { SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0)); SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LogLimit", 100), 0)); @@ -1062,17 +978,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM DeleteObject(pci->hListBkgBrush); pci->hListBkgBrush = CreateSolidBrush(M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR)); - LoadLogFonts(); - - LOGFONT lf; - LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE); - HFONT hFont = CreateFontIndirect(&lf); - int iText = GetTextPixelSize(pci->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 = M.GetBool("Chat", "LogIndentEnabled", true); - + pci->ReloadSettings(); pci->MM_FontsChanged(); pci->MM_FixColors(); pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); @@ -1205,14 +1111,6 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM int OptionsInit(void) { - LoadLogFonts(); - g_Settings.Highlight = new CMUCHighlight(); - - return 0; -} - -int OptionsUnInit(void) -{ return 0; } diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 59c6f052a9..0f36e33eed 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2443,7 +2443,7 @@ LABEL_SHOWWINDOW: CSkin::UpdateToolbarBG(dat, RDW_ALLCHILDREN); SendMessage(dat->hwnd, WM_SIZE, 0, 0); } - else if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) { + else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) { POINT pt = { 0, wParam }; ScreenToClient(hwndDlg, &pt); GetClientRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rc); @@ -2456,12 +2456,12 @@ LABEL_SHOWWINDOW: SendMessage(hwndDlg, WM_SIZE, DM_SPLITTERMOVED, 0); break; } - } + } break; case GC_FIREHOOK: if (lParam) { - GCHOOK* gch = (GCHOOK*) lParam; + GCHOOK *gch = (GCHOOK*)lParam; NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)gch); if (gch->pDest) { mir_free((void*)gch->pDest->ptszID); @@ -2483,7 +2483,7 @@ LABEL_SHOWWINDOW: si->hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), dat->pContainer->hwnd, FilterWndProc, (LPARAM)si); TranslateDialogDefault(si->hwndStatus); { - RECT rcFilter, rcLog; + RECT rcFilter, rcLog; GetClientRect(si->hwndStatus, &rcFilter); GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog); POINT pt = { rcLog.right, rcLog.bottom }; @@ -2570,9 +2570,9 @@ LABEL_SHOWWINDOW: if (msg == WM_KEYDOWN) { if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) { SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_PASTESPECIAL, CF_UNICODETEXT, 0); - ((MSGFILTER *) lParam)->msg = WM_NULL; - ((MSGFILTER *) lParam)->wParam = 0; - ((MSGFILTER *) lParam)->lParam = 0; + ((MSGFILTER*)lParam)->msg = WM_NULL; + ((MSGFILTER*)lParam)->wParam = 0; + ((MSGFILTER*)lParam)->lParam = 0; return(_dlgReturn(hwndDlg, 1)); } } diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index b05930662e..60470d7e59 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -33,9 +33,7 @@ #ifndef __COMMONHEADERS_H #define __COMMONHEADERS_H -#if !defined __DELAYED_FOR_3_1 - #define __FEAT_EXP_AUTOSPLITTER 1 -#endif +#define __FEAT_EXP_AUTOSPLITTER 1 #define WINVER 0x0600 #define _WIN32_WINNT 0x0600 diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 12943f05fd..7baa7be4ce 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -692,8 +692,6 @@ private: #define IPFONTID_PROTO 3 #define IPFONTID_TIME 4 -extern const int msgDlgFontCount; - #define LOADHISTORY_UNREAD 0 #define LOADHISTORY_COUNT 1 #define LOADHISTORY_TIME 2 @@ -744,7 +742,7 @@ extern const int msgDlgFontCount; #define SRMSGDEFSET_SHOWTYPINGCLIST 1 // rtl support -#define SRMSGDEFSET_MOD_RTL 0 +#define SRMSGDEFSET_MOD_RTL 0 #define TIMEOUT_FLASHWND 900 #define TIMERID_HEARTBEAT 2 @@ -755,7 +753,8 @@ extern const int msgDlgFontCount; #define SRMSGMOD "SRMsg" #define SRMSGMOD_T "Tab_SRMsg" #define FONTMODULE "TabSRMM_Fonts" -#define CHAT_FONTMODULE "TabSRMM_chat_Fonts" +#define CHAT_OLDFONTMODULE "TabSRMM_chat_Fonts" +#define CHAT_FONTMODULE "ChatFonts" #define IDM_STAYONTOP (WM_USER + 1) #define IDM_NOTITLE (WM_USER + 2) -- cgit v1.2.3