summaryrefslogtreecommitdiff
path: root/protocols/Tlen/tlen_czaty/src/FontList.cpp
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2012-10-17 21:05:02 +0000
committerSzymon Tokarz <wsx22@o2.pl>2012-10-17 21:05:02 +0000
commitfd67a89688262e4e58337c33728488f5f29196a8 (patch)
treeb6f8d04257ce002aaf251d586d27253db3755c42 /protocols/Tlen/tlen_czaty/src/FontList.cpp
parent1099f914b0eb16acdcbf594ac4105224a6dfb2fd (diff)
Tlen protocol adopted
- code moved to trunk\protocols folder - update project files (based on rev: 27, 228, 204, 350, 279, 280, 1374, 278) - changed code organisation to c++ convention (based on rev: 1092, 503, 504) - changed code to Miranda NG convention (based on rev: 49, 54, 312, 401, 321, 358, 410, 441, 477, 483, 496, 507, 515, 644, 652, 743, 956, 1206, 667, 1040, 1590, 1857) - folders restructurization (based on rev: 1890) - code cleaning (based on rev: 270, 398, 409) - this commit includes adopted sources of tlen_czaty.dll (former mucc.dll) plugin witch is now deprecated and will be removed -- wsx22{at}o2.pl git-svn-id: http://svn.miranda-ng.org/main/trunk@1972 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tlen/tlen_czaty/src/FontList.cpp')
-rw-r--r--protocols/Tlen/tlen_czaty/src/FontList.cpp206
1 files changed, 206 insertions, 0 deletions
diff --git a/protocols/Tlen/tlen_czaty/src/FontList.cpp b/protocols/Tlen/tlen_czaty/src/FontList.cpp
new file mode 100644
index 0000000000..3bcf7554c5
--- /dev/null
+++ b/protocols/Tlen/tlen_czaty/src/FontList.cpp
@@ -0,0 +1,206 @@
+/*
+
+MUCC Group Chat GUI Plugin for Miranda NG
+Copyright (C) 2004 Piotr Piastucki
+
+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.
+
+*/
+#include "FontList.h"
+#include "Utils.h"
+
+#define FONTCOUNT 12
+static Font defFonts[] = {
+ Font("Timestamp","Verdana", DEFAULT_CHARSET, -9, Font::BOLD, 0x000000),
+// Font("Colon","Verdana", DEFAULT_CHARSET, -13, 0, 0x808080),
+ Font("Others names","Verdana", DEFAULT_CHARSET, -13, 0, 0x723732),
+ Font("Your name","Verdana", DEFAULT_CHARSET, -13, 0, 0x4453A4),
+ Font("Incoming message","Verdana", DEFAULT_CHARSET, -13, 0, 0x000000),
+ Font("Outgoing message","Verdana", DEFAULT_CHARSET, -13, 0, 0x505080),
+ Font("User has joined","Verdana", DEFAULT_CHARSET, -11, Font::ITALIC, 0x0F880F),
+ Font("User has left","Verdana", DEFAULT_CHARSET, -11, Font::ITALIC, 0x1313B9),
+ Font("The topic is ...","Verdana", DEFAULT_CHARSET, -13, Font::ITALIC, 0x991A53),
+ Font("Error","Verdana", DEFAULT_CHARSET, -13, Font::BOLD, 0x1010D0),
+ Font("Message typing area","Verdana", DEFAULT_CHARSET, -13, 0, 0x000000),
+ Font("User list","Tahoma", DEFAULT_CHARSET, -11, 0, 0x000000),
+ Font("User list group","Tahoma", DEFAULT_CHARSET, -11, Font::BOLD, 0x000000)
+
+};
+
+Font::Font() {
+ name = NULL;
+ face = NULL;
+ size = 0;
+ style = 0;
+ color = 0;
+ charSet = DEFAULT_CHARSET;
+}
+
+Font::Font(const char *n, const char *f, int cs, int s, int st, COLORREF c) {
+ name = NULL;
+ face = NULL;
+ size = 0;
+ style = 0;
+ color = 0;
+ setName(n);
+ setFace(f);
+ setCharSet(cs);
+ setSize(s);
+ setStyle(st);
+ setColor(c);
+}
+
+
+COLORREF Font::getColor() {
+ return color;
+}
+
+void Font::setColor(COLORREF c) {
+ color = c;
+}
+
+int Font::getSize() {
+ return size;
+}
+
+void Font::setSize(int s) {
+ size = s;
+}
+
+int Font::getStyle() {
+ return style;
+}
+
+void Font::setStyle(int s) {
+ style = s;
+}
+
+int Font::getCharSet() {
+ return charSet;
+}
+
+void Font::setCharSet(int s) {
+ charSet = s;
+}
+
+void Font::setName(const char *s) {
+ Utils::copyString(&name, s);
+}
+
+const char *Font::getName() {
+ return name;
+}
+
+void Font::setFace(const char *s) {
+ Utils::copyString(&face, s);
+}
+
+const char *Font::getFace() {
+ return face;
+}
+
+Font *FontList::fonts = NULL;
+Font *FontList::fontsSettings = NULL;
+
+Font *FontList::getFont(int index) {
+ if (index < FONTCOUNT) return &fonts[index];
+ else return NULL;
+}
+
+Font *FontList::getFontSettings(int index) {
+ if (index < FONTCOUNT) return &fontsSettings[index];
+ else return NULL;
+}
+
+void FontList::loadSettings() {
+ char fontParam[512];
+ for (int i=0;i<FONTCOUNT;i++) {
+ DBVARIANT dbv;
+ fontsSettings[i].setName(defFonts[i].getName());
+ fontsSettings[i].setFace(defFonts[i].getFace());
+ fontsSettings[i].setCharSet(defFonts[i].getCharSet());
+ fontsSettings[i].setSize(defFonts[i].getSize());
+ fontsSettings[i].setStyle(defFonts[i].getStyle());
+ fontsSettings[i].setColor(defFonts[i].getColor());
+ sprintf(fontParam, "Font%dFace", i);
+ if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
+ fontsSettings[i].setFace(dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }
+ sprintf(fontParam, "Font%dSet", i);
+ if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
+ fontsSettings[i].setCharSet(dbv.bVal);
+ DBFreeVariant(&dbv);
+ }
+ sprintf(fontParam, "Font%dSize", i);
+ if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
+ fontsSettings[i].setSize(dbv.lVal);
+ DBFreeVariant(&dbv);
+ }
+ sprintf(fontParam, "Font%dCol", i);
+ if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
+ fontsSettings[i].setColor(dbv.lVal);
+ DBFreeVariant(&dbv);
+ }
+ sprintf(fontParam, "Font%dStyle", i);
+ if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
+ fontsSettings[i].setStyle(dbv.bVal);
+ DBFreeVariant(&dbv);
+ }
+ fonts[i].setName(fontsSettings[i].getName());
+ fonts[i].setFace(fontsSettings[i].getFace());
+ fonts[i].setCharSet(fontsSettings[i].getCharSet());
+ fonts[i].setSize(fontsSettings[i].getSize());
+ fonts[i].setStyle(fontsSettings[i].getStyle());
+ fonts[i].setColor(fontsSettings[i].getColor());
+ }
+}
+
+void FontList::saveSettings() {
+ char fontParam[512];
+ for (int i=0;i<FONTCOUNT;i++) {
+ sprintf(fontParam, "Font%dFace", i);
+ DBWriteContactSettingString(NULL, muccModuleName, fontParam, fontsSettings[i].getFace());
+ sprintf(fontParam, "Font%dSet", i);
+ DBWriteContactSettingByte(NULL, muccModuleName, fontParam, fontsSettings[i].getCharSet());
+ sprintf(fontParam, "Font%dSize", i);
+ DBWriteContactSettingDword(NULL, muccModuleName, fontParam, fontsSettings[i].getSize());
+ sprintf(fontParam, "Font%dCol", i);
+ DBWriteContactSettingDword(NULL, muccModuleName, fontParam, fontsSettings[i].getColor());
+ sprintf(fontParam, "Font%dStyle", i);
+ DBWriteContactSettingByte(NULL, muccModuleName, fontParam, fontsSettings[i].getStyle());
+ fonts[i].setName(fontsSettings[i].getName());
+ fonts[i].setFace(fontsSettings[i].getFace());
+ fonts[i].setCharSet(fontsSettings[i].getCharSet());
+ fonts[i].setStyle(fontsSettings[i].getStyle());
+ fonts[i].setSize(fontsSettings[i].getSize());
+ fonts[i].setColor(fontsSettings[i].getColor());
+ }
+}
+
+void FontList::init() {
+ fonts = new Font[FONTCOUNT];
+ fontsSettings = new Font[FONTCOUNT];
+ loadSettings();
+}
+
+void FontList::release() {
+ delete[] fonts;
+ delete[] fontsSettings;
+}
+
+int FontList::getFontNum() {
+ return FONTCOUNT;
+}