summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/font.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-05-15 10:38:20 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-05-15 10:38:20 +0000
commit48540940b6c28bb4378abfeb500ec45a625b37b6 (patch)
tree2ef294c0763e802f91d868bdef4229b6868527de /plugins/Popup/src/font.cpp
parent5c350913f011e119127baeb32a6aedeb4f0d33bc (diff)
initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/font.cpp')
-rw-r--r--plugins/Popup/src/font.cpp154
1 files changed, 154 insertions, 0 deletions
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp
new file mode 100644
index 0000000000..d9502eadac
--- /dev/null
+++ b/plugins/Popup/src/font.cpp
@@ -0,0 +1,154 @@
+/*
+Popup Plus plugin for Miranda IM
+
+Copyright © 2002 Luca Santarelli,
+ © 2004-2007 Victor Pavlychko
+ © 2010 MPK
+ © 2010 Merlin_de
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+===============================================================================
+
+File name : $HeadURL: http://svn.miranda.im/mainrepo/popup/trunk/src/font.cpp $
+Revision : $Revision: 1651 $
+Last change on : $Date: 2010-07-15 20:31:06 +0300 (Чт, 15 июл 2010) $
+Last change by : $Author: Merlin_de $
+
+===============================================================================
+*/
+
+#include "headers.h"
+
+PopupFonts fonts = {0};
+
+void InitFonts() {
+ // Fonts
+ FontIDT fid = {0};
+ fid.cbSize = sizeof(FontIDT);
+ lstrcpy(fid.group, _T(PU_FNT_AND_COLOR));
+ strcpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB);
+ fid.flags = FIDF_DEFAULTVALID;
+ fid.deffontsettings.charset = DEFAULT_CHARSET;
+ fid.deffontsettings.size = -11;
+ lstrcpy(fid.backgroundGroup,_T(PU_FNT_AND_COLOR));
+ lstrcpy(fid.backgroundName,_T(PU_COL_BACK_NAME));
+ lstrcpy(fid.deffontsettings.szFace, _T("Tahoma"));
+
+ lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE));
+ mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
+ fid.deffontsettings.style = DBFONTF_BOLD;
+ fid.deffontsettings.colour = RGB(0,0,0);
+ FontRegisterT(&fid);
+
+ lstrcpy(fid.name, _T(PU_FNT_NAME_CLOCK));
+ mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
+ //fid.deffontsettings.style = DBFONTF_BOLD;
+ //fid.deffontsettings.colour = RGB(0,0,0);
+ FontRegisterT(&fid);
+
+ lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT));
+ mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
+ fid.deffontsettings.style = 0;
+ //fid.deffontsettings.colour = RGB(0,0,0);
+ FontRegisterT(&fid);
+
+ lstrcpy(fid.name, _T("Action"));
+ mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Action");
+ //fid.deffontsettings.style = 0;
+ fid.deffontsettings.colour = RGB(0,0,255);
+ FontRegisterT(&fid);
+
+ lstrcpy(fid.name, _T("Hovered Action"));
+ mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Hovered Action");
+ fid.deffontsettings.style = DBFONTF_UNDERLINE;
+ //fid.deffontsettings.colour = RGB(0,0,255);
+ FontRegisterT(&fid);
+
+ ColourIDT cid = {0};
+ cid.cbSize = sizeof(ColourIDT);
+ lstrcpy(cid.group, _T(PU_FNT_AND_COLOR));
+ strcpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB);
+
+ lstrcpy(cid.name, _T(PU_COL_BACK_NAME));
+ strcpy(cid.setting, PU_COL_BACK_SETTING);
+ cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0);
+
+ lstrcpy(cid.name, _T(PU_COL_AVAT_NAME));
+ strcpy(cid.setting, PU_COL_AVAT_SETTING);
+ cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0);
+
+ ReloadFonts();
+}
+
+
+void ReloadFonts()
+{
+ if (fonts.title) DeleteObject(fonts.title);
+ if (fonts.clock) DeleteObject(fonts.clock);
+ if (fonts.text) DeleteObject(fonts.text);
+ if (fonts.action) DeleteObject(fonts.action);
+ if (fonts.actionHover) DeleteObject(fonts.actionHover);
+
+ LOGFONT lf = {0};
+ FontIDT fid = {0};
+ fid.cbSize = sizeof(FontIDT);
+ lstrcpy(fid.group, _T(PU_FNT_AND_COLOR));
+
+ lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE));
+ fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.title = CreateFontIndirect(&lf);
+
+ lstrcpy(fid.name, _T(PU_FNT_NAME_CLOCK));
+ fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.clock = CreateFontIndirect(&lf);
+
+ lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT));
+ fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.text = CreateFontIndirect(&lf);
+
+ lstrcpy(fid.name, _T("Action"));
+ fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.action = CreateFontIndirect(&lf);
+
+ lstrcpy(fid.name, _T("Hovered Action"));
+ fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.actionHover = CreateFontIndirect(&lf);
+
+ ColourIDT cid = {0};
+ cid.cbSize = sizeof(ColourIDT);
+ lstrcpy(cid.group, _T(PU_FNT_AND_COLOR));
+ lstrcpy(cid.name, _T(PU_COL_BACK_NAME));
+ fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
+
+ lstrcpy(cid.group, _T(PU_FNT_AND_COLOR));
+ lstrcpy(cid.name, _T(PU_COL_AVAT_NAME));
+ fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
+
+ //update class popupps(only temp at this point, must rework)
+ char setting[256];
+ for(int i = 0; i < gTreeData.getCount(); i++) {
+ if(gTreeData[i]->typ == 2) {
+ mir_snprintf(setting, 256, "%s/TextCol", gTreeData[i]->pupClass.pszName);
+ gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText =
+ (COLORREF)DBGetContactSettingDword(0, PU_MODULCLASS, setting, (DWORD)fonts.clText);
+ mir_snprintf(setting, 256, "%s/BgCol", gTreeData[i]->pupClass.pszName);
+ gTreeData[i]->colorBack = gTreeData[i]->pupClass.colorBack =
+ (COLORREF)DBGetContactSettingDword(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
+ }
+ }
+}