summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src
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/Clist_nicer/src
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/Clist_nicer/src')
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp4
-rw-r--r--plugins/Clist_nicer/src/clui.cpp95
2 files changed, 47 insertions, 52 deletions
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);