summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-28 18:08:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-28 18:08:17 +0000
commit095608f5e98292aa7fe82a075e7e867fc4dcd467 (patch)
tree33fe413cce0afe3a1512a326a3ebd50ca95374db /plugins
parentf5939506ebe963f4041506d9e8af021cb52161a1 (diff)
initial settings for clist_mw & clist_nicer
git-svn-id: http://svn.miranda-ng.org/main/trunk@7935 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_mw/src/clcfonts.cpp110
-rw-r--r--plugins/Clist_mw/src/clistopts.cpp2
-rw-r--r--plugins/Clist_mw/src/clui.cpp4
-rw-r--r--plugins/Clist_mw/src/cluiopts.cpp2
-rw-r--r--plugins/Clist_mw/src/groupmenu.cpp4
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp4
-rw-r--r--plugins/Clist_nicer/src/clui.cpp95
7 files changed, 98 insertions, 123 deletions
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);
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp
index cc9fc0dc3b..f9b9cec494 100644
--- a/plugins/Clist_nicer/src/clcopts.cpp
+++ b/plugins/Clist_nicer/src/clcopts.cpp
@@ -531,7 +531,7 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam)
odp.position = -1000000000;
odp.flags = ODPF_BOLDGROUPS;
- odp.pszTitle = LPGEN("Contact List");
+ odp.pszTitle = LPGEN("Contact list");
odp.pszTab = LPGEN("General");
odp.pfnDlgProc = DlgProcGenOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST);
@@ -561,7 +561,7 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam)
// Contact rows tabs
odp.position = 0;
- odp.pszGroup = LPGEN("Contact List");
+ odp.pszGroup = LPGEN("Contact list");
odp.pszTitle = LPGEN("Contact rows");
odp.pszTab = LPGEN("Contacts");
odp.pfnDlgProc = DlgProcDspItems;
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index afe7abbc24..9a3f756193 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -1987,63 +1987,58 @@ void OnCreateClc()
PreCreateCLC(pcli->hwndContactList);
}
-static struct {
- UINT id;
- TCHAR *name;
-} _tagFSINFO[] = {
- FONTID_CONTACTS, LPGENT( "Standard contacts"),
- FONTID_INVIS, LPGENT( "Online contacts to whom you have a different visibility"),
- FONTID_OFFLINE, LPGENT( "Offline contacts"),
- FONTID_OFFINVIS, LPGENT( "Offline contacts to whom you have a different visibility" ),
- FONTID_NOTONLIST, LPGENT( "Contacts which are 'not on list'"),
- FONTID_GROUPS, LPGENT( "Groups"),
- FONTID_GROUPCOUNTS, LPGENT( "Group member counts"),
- FONTID_DIVIDERS, LPGENT( "Dividers"),
- FONTID_STATUS, LPGENT("Status mode"),
- FONTID_FRAMETITLE, LPGENT("Frame titles"),
- FONTID_EVENTAREA, LPGENT("Event area"),
- FONTID_TIMESTAMP, LPGENT("Contact list local time"),
- 0, NULL
+struct
+{
+ const TCHAR *tszName;
+ int iMask;
+}
+static clistFontDescr[] =
+{
+ { 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 mode"), FIDF_CLASSGENERAL },
+ { LPGENT("Frame titles"), FIDF_CLASSGENERAL },
+ { LPGENT("Event area"), FIDF_CLASSGENERAL },
+ { LPGENT("Contact list local time"), FIDF_CLASSGENERAL }
};
void FS_RegisterFonts()
{
- FontIDT fid = {0};
- char szTemp[50];
- DBVARIANT dbv;
- int j = 0;
-
- fid.cbSize = sizeof(fid);
- _tcsncpy(fid.group, LPGENT("Contact List"), SIZEOF(fid.group));
+ FontIDT fid = { sizeof(fid) };
+ _tcsncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group));
strncpy(fid.dbSettingsGroup, "CLC", 5);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE;
- while (_tagFSINFO[j].name != 0) {
- mir_snprintf(szTemp, sizeof(szTemp), "Font%d", _tagFSINFO[j].id);
- strncpy(fid.prefix, szTemp, sizeof(fid.prefix));
- fid.order = _tagFSINFO[j].id;
- _tcsncpy(fid.backgroundGroup, LPGENT("Contact List"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Background"), SIZEOF(fid.backgroundName));
- _tcsncpy(fid.name, _tagFSINFO[j].name, SIZEOF(fid.name));
- mir_snprintf(szTemp, sizeof(szTemp), "Font%dCol", _tagFSINFO[j].id);
- fid.deffontsettings.colour = (COLORREF)cfg::getDword("CLC", szTemp, GetSysColor(COLOR_WINDOWTEXT));
-
- mir_snprintf(szTemp, sizeof(szTemp), "Font%dSize", _tagFSINFO[j].id);
- fid.deffontsettings.size = (BYTE)cfg::getByte("CLC", szTemp, 8);
-
- mir_snprintf(szTemp, sizeof(szTemp), "Font%dSty", _tagFSINFO[j].id);
- fid.deffontsettings.style = cfg::getByte("CLC", szTemp, 0);
- mir_snprintf(szTemp, sizeof(szTemp), "Font%dSet", _tagFSINFO[j].id);
- fid.deffontsettings.charset = cfg::getByte("CLC", szTemp, DEFAULT_CHARSET);
- mir_snprintf(szTemp, sizeof(szTemp), "Font%dName", _tagFSINFO[j].id);
- if (cfg::getTString(NULL, "CLC", szTemp, &dbv))
- lstrcpyn(fid.deffontsettings.szFace, _T("Arial"), LF_FACESIZE);
- else {
- lstrcpyn(fid.deffontsettings.szFace, dbv.ptszVal, LF_FACESIZE);
- db_free(&dbv);
- }
+
+ HDC hdc = GetDC(NULL);
+ for (int i = 0; i < SIZEOF(clistFontDescr); i++) {
+ LOGFONT lf;
+ pcli->pfnGetFontSetting(i, &lf, &fid.deffontsettings.colour);
+ lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+
+ _tcsncpy_s(fid.deffontsettings.szFace, SIZEOF(fid.deffontsettings.szFace), lf.lfFaceName, _TRUNCATE);
+ fid.deffontsettings.charset = lf.lfCharSet;
+ fid.deffontsettings.size = (char)lf.lfHeight;
+ fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0);
+
+ fid.flags &= ~FIDF_CLASSMASK;
+ fid.flags |= clistFontDescr[i].iMask;
+
+ _tcsncpy(fid.name, clistFontDescr[i].tszName, SIZEOF(fid.name));
+
+ char idstr[10];
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i);
+ strncpy(fid.prefix, idstr, SIZEOF(fid.prefix));
+ fid.order = i;
FontRegisterT(&fid);
- j++;
}
+ ReleaseDC(NULL, hdc);
+
// and colours
ColourIDT colourid = {0};
colourid.cbSize = sizeof(colourid);
@@ -2052,7 +2047,7 @@ void FS_RegisterFonts()
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);