From 095608f5e98292aa7fe82a075e7e867fc4dcd467 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Jan 2014 18:08:17 +0000 Subject: initial settings for clist_mw & clist_nicer git-svn-id: http://svn.miranda-ng.org/main/trunk@7935 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_mw/src/clcfonts.cpp | 110 +++++++++++++++---------------------- plugins/Clist_mw/src/clistopts.cpp | 2 +- plugins/Clist_mw/src/clui.cpp | 4 +- plugins/Clist_mw/src/cluiopts.cpp | 2 +- plugins/Clist_mw/src/groupmenu.cpp | 4 +- 5 files changed, 51 insertions(+), 71 deletions(-) (limited to 'plugins/Clist_mw/src') diff --git a/plugins/Clist_mw/src/clcfonts.cpp b/plugins/Clist_mw/src/clcfonts.cpp index 90b7afb9f8..d3f09a2f2e 100644 --- a/plugins/Clist_mw/src/clcfonts.cpp +++ b/plugins/Clist_mw/src/clcfonts.cpp @@ -24,35 +24,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" - -static const TCHAR *szClistFontIdDescr[FONTID_MAX+1] = +struct { - LPGENT( "Standard contacts"), - LPGENT( "Online contacts to whom you have a different visibility"), - LPGENT( "Offline contacts"), - LPGENT( "Contacts which are 'not on list'"), - LPGENT( "Groups"), - LPGENT( "Group member counts"), - LPGENT( "Dividers"), - LPGENT( "Offline contacts to whom you have a different visibility"), - LPGENT( "Status messages"), - LPGENT( "Group Closed"), - LPGENT( "Hover Contacts") -}; - -static int fontListOrder[FONTID_MAX + 1] = + const TCHAR *tszName; + int iMask; +} +static clistFontDescr[] = { - FONTID_CONTACTS, - FONTID_INVIS, - FONTID_OFFLINE, - FONTID_NOTONLIST, - FONTID_GROUPS, - FONTID_GROUPCOUNTS, - FONTID_DIVIDERS, - FONTID_OFFINVIS, - FONTID_STATUSMSG, - FONTID_GROUPSCLOSED, - FONTID_CONTACTSHOVER + { LPGENT("Standard contacts"), FIDF_CLASSGENERAL }, + { LPGENT("Online contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, + { LPGENT("Offline contacts"), FIDF_CLASSGENERAL }, + { LPGENT("Contacts which are 'not on list'"), FIDF_CLASSGENERAL }, + { LPGENT("Groups"), FIDF_CLASSHEADER }, + { LPGENT("Group member counts"), FIDF_CLASSHEADER }, + { LPGENT("Dividers"), FIDF_CLASSSMALL }, + { LPGENT("Offline contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, + { LPGENT("Status messages"), FIDF_CLASSGENERAL }, + { LPGENT("Group Closed"), FIDF_CLASSGENERAL }, + { LPGENT("Hover Contacts"), FIDF_CLASSGENERAL } }; #define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) @@ -66,52 +55,43 @@ static int FS_FontsChanged(WPARAM wParam, LPARAM lParam) void RegisterCListFonts() { - FontIDT fontid = {0}; - ColourIDT colourid = {0}; - char idstr[10]; - int i; - - fontid.cbSize = sizeof(FontIDT); - fontid.flags = FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS; - - for (i = 0; i <= FONTID_MAX; i++) { - switch (fontListOrder[i]) { - case FONTID_GROUPS: - case FONTID_GROUPCOUNTS: - fontid.flags &= ~FIDF_CLASSMASK; - fontid.flags |= FIDF_CLASSHEADER; - break; - - case FONTID_DIVIDERS: - fontid.flags &= ~FIDF_CLASSMASK; - fontid.flags |= FIDF_CLASSSMALL; - break; - - default: - fontid.flags &= ~FIDF_CLASSMASK; - fontid.flags |= FIDF_CLASSGENERAL; - break; - } - - if (fontListOrder[i] != 0 || i == 0) { - strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); - _tcsncpy(fontid.group, _T("Contact List"), SIZEOF(fontid.group)); - _tcsncpy(fontid.name, szClistFontIdDescr[fontListOrder[i]], SIZEOF(fontid.name)); - mir_snprintf(idstr, SIZEOF(idstr), "Font%d", fontListOrder[i]); - strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); - fontid.order = fontListOrder[i]; - FontRegisterT(&fontid); - } + FontIDT fontid = { sizeof(fontid) }; + fontid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS; + strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); + _tcsncpy(fontid.group, _T("Contact list"), SIZEOF(fontid.group)); + + HDC hdc = GetDC(NULL); + for (int i = 0; i < SIZEOF(clistFontDescr); i++) { + LOGFONT lf; + pcli->pfnGetFontSetting(i, &lf, &fontid.deffontsettings.colour); + lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); + + _tcsncpy_s(fontid.deffontsettings.szFace, SIZEOF(fontid.deffontsettings.szFace), lf.lfFaceName, _TRUNCATE); + fontid.deffontsettings.charset = lf.lfCharSet; + fontid.deffontsettings.size = (char)lf.lfHeight; + fontid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0); + + fontid.flags &= ~FIDF_CLASSMASK; + fontid.flags |= clistFontDescr[i].iMask; + + _tcsncpy(fontid.name, clistFontDescr[i].tszName, SIZEOF(fontid.name)); + + char idstr[10]; + mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); + strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); + fontid.order = i; + FontRegisterT(&fontid); } + ReleaseDC(NULL, hdc); // and colours - colourid.cbSize = sizeof(ColourIDT); + ColourIDT colourid = { sizeof(colourid) }; colourid.order = 0; strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); - _tcsncpy(colourid.group, LPGENT("Contact List"), SIZEOF(colourid.group)); + _tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index 42c146af88..bccc015bc2 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -38,7 +38,7 @@ int CListOptInit(WPARAM wParam,LPARAM lParam) odp.position = -1000000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); - odp.pszTitle = LPGEN("Contact List"); + odp.pszTitle = LPGEN("Contact list"); odp.pfnDlgProc = DlgProcGenOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index 9e8882ec55..c87b62c6ae 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -209,7 +209,7 @@ void RegisterProtoIcons (char *protoname) for (i = 0;i<8;i++) { mir_snprintf(buf, SIZEOF(buf), "%s #%d", protoname, i); - mir_snprintf(buf2, SIZEOF(buf2), "Contact List/Connection Icons %s", protoname); + mir_snprintf(buf2, SIZEOF(buf2), "Contact list/Connection Icons %s", protoname); LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i)); } @@ -269,7 +269,7 @@ HICON GetConnectingIconForProto(char *szProto,int b) char buf[256]; mir_snprintf(buf, SIZEOF(buf), "%s #%d", szProto, b); - hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact List/Connection Icons",buf,0,NULL); + hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact list/Connection icons",buf,0,NULL); if (hIcon == NULL) return (GetConnectingIconForProto_DLL(szProto,b)); return (CopyIcon(hIcon)); } diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index be38c3ef31..1e8aab4792 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -39,7 +39,7 @@ int CluiOptInit(WPARAM wParam,LPARAM lParam) odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); odp.pszTitle = LPGEN("Window"); - odp.pszGroup = LPGEN("Contact List"); + odp.pszGroup = LPGEN("Contact list"); odp.pfnDlgProc = DlgProcCluiOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index fdd3af5b08..cd64420626 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -222,7 +222,7 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) { - HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0); + HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact list","New Group",-IDI_NEWGROUP,0); NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); CLISTMENUITEM mi = { sizeof(mi) }; @@ -235,7 +235,7 @@ int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) void InitGroupMenus(void) { - HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0); + HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact list","New Group",-IDI_NEWGROUP2,0); NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon ); CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService); -- cgit v1.2.3