summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 12:24:11 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 12:24:11 +0300
commit408da061e6098c6562f69b50d16353c7efc5cdf2 (patch)
tree06b8a255fb5ed38e9dbaed7f5ff0257b68453f83
parent98f057d55df649353cc6500328a45b0dfe6f833e (diff)
downloadmanaplus-408da061e6098c6562f69b50d16353c7efc5cdf2.tar.gz
manaplus-408da061e6098c6562f69b50d16353c7efc5cdf2.tar.bz2
manaplus-408da061e6098c6562f69b50d16353c7efc5cdf2.tar.xz
manaplus-408da061e6098c6562f69b50d16353c7efc5cdf2.zip
Add missing npc font settings.
-rw-r--r--src/client.cpp4
-rw-r--r--src/gui/theme.cpp2
-rw-r--r--src/gui/theme.h2
-rw-r--r--src/gui/widgets/tabs/setup_theme.cpp27
-rw-r--r--src/gui/widgets/tabs/setup_theme.h4
5 files changed, 35 insertions, 4 deletions
diff --git a/src/client.cpp b/src/client.cpp
index e5f06016e..2eae9565f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2353,6 +2353,7 @@ void Client::storeSafeParameters() const
std::string particleFont;
std::string helpFont;
std::string secureFont;
+ std::string npcFont;
std::string japanFont;
std::string chinaFont;
bool showBackground;
@@ -2378,6 +2379,7 @@ void Client::storeSafeParameters() const
particleFont = config.getStringValue("particleFont");
helpFont = config.getStringValue("helpFont");
secureFont = config.getStringValue("secureFont");
+ npcFont = config.getStringValue("npcFont");
japanFont = config.getStringValue("japanFont");
chinaFont = config.getStringValue("chinaFont");
@@ -2399,6 +2401,7 @@ void Client::storeSafeParameters() const
config.setValue("particleFont", "fonts/dejavusans.ttf");
config.setValue("helpFont", "fonts/dejavusansmono.ttf");
config.setValue("secureFont", "fonts/dejavusansmono.ttf");
+ config.setValue("npcFont", "fonts/dejavusans.ttf");
config.setValue("japanFont", "fonts/mplus-1p-regular.ttf");
config.setValue("chinaFont", "fonts/wqy-microhei.ttf");
config.setValue("showBackground", false);
@@ -2440,6 +2443,7 @@ void Client::storeSafeParameters() const
config.setValue("particleFont", particleFont);
config.setValue("helpFont", helpFont);
config.setValue("secureFont", secureFont);
+ config.setValue("npcFont", npcFont);
config.setValue("japanFont", japanFont);
config.setValue("chinaFont", chinaFont);
config.setValue("showBackground", showBackground);
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 6fdae088c..760169d07 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -1308,6 +1308,8 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName)
readValue(helpFont);
else if (xmlNameEqual(infoNode, "secureFont"))
readValue(secureFont);
+ else if (xmlNameEqual(infoNode, "npcFont"))
+ readValue(npcFont);
else if (xmlNameEqual(infoNode, "japanFont"))
readValue(japanFont);
else if (xmlNameEqual(infoNode, "chinaFont"))
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 2e4b70e13..910964bdf 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -53,6 +53,7 @@ struct ThemeInfo final
particleFont(),
helpFont(),
secureFont(),
+ npcFont(),
japanFont(),
chinaFont(),
fontSize(0),
@@ -67,6 +68,7 @@ struct ThemeInfo final
std::string particleFont;
std::string helpFont;
std::string secureFont;
+ std::string npcFont;
std::string japanFont;
std::string chinaFont;
int fontSize;
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp
index b4f6c35ac..d7cc4b4df 100644
--- a/src/gui/widgets/tabs/setup_theme.cpp
+++ b/src/gui/widgets/tabs/setup_theme.cpp
@@ -46,6 +46,7 @@ const char* ACTION_BOLD_FONT = "bold font";
const char* ACTION_PARTICLE_FONT = "particle font";
const char* ACTION_HELP_FONT = "help font";
const char* ACTION_SECURE_FONT = "secure font";
+const char* ACTION_NPC_FONT = "npc font";
const char* ACTION_JAPAN_FONT = "japanese font";
const char* ACTION_CHINA_FONT = "chinese font";
const char* ACTION_INFO = "info";
@@ -259,6 +260,10 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) :
mSecureFontDropDown(new DropDown(this, mFontsModel)),
mSecureFont(config.getStringValue("secureFont")),
// TRANSLATORS: theme settings label
+ mNpcFontLabel(new Label(this, _("Npc font"))),
+ mNpcFontDropDown(new DropDown(this, mFontsModel)),
+ mNpcFont(config.getStringValue("npcFont")),
+ // TRANSLATORS: theme settings label
mJapanFontLabel(new Label(this, _("Japanese font"))),
mJapanFontDropDown(new DropDown(this, mFontsModel)),
mJapanFont(config.getStringValue("japanFont")),
@@ -297,6 +302,8 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) :
mHelpFontDropDown->addActionListener(this);
mSecureFontDropDown->setActionEventId(ACTION_SECURE_FONT);
mSecureFontDropDown->addActionListener(this);
+ mNpcFontDropDown->setActionEventId(ACTION_NPC_FONT);
+ mNpcFontDropDown->addActionListener(this);
mJapanFontDropDown->setActionEventId(ACTION_JAPAN_FONT);
mJapanFontDropDown->addActionListener(this);
mChinaFontDropDown->setActionEventId(ACTION_CHINA_FONT);
@@ -332,6 +339,8 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) :
config.getStringValue("helpFont")));
mSecureFontDropDown->setSelectedString(getFileName(
config.getStringValue("secureFont")));
+ mNpcFontDropDown->setSelectedString(getFileName(
+ config.getStringValue("npcFont")));
mJapanFontDropDown->setSelectedString(getFileName(
config.getStringValue("japanFont")));
mChinaFontDropDown->setSelectedString(getFileName(
@@ -352,8 +361,9 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) :
place(0, 6, mParticleFontLabel, 5);
place(0, 7, mHelpFontLabel, 5);
place(0, 8, mSecureFontLabel, 5);
- place(0, 9, mJapanFontLabel, 5);
- place(0, 10, mChinaFontLabel, 5);
+ place(0, 9, mNpcFontLabel, 5);
+ place(0, 10, mJapanFontLabel, 5);
+ place(0, 11, mChinaFontLabel, 5);
place(6, 0, mThemeDropDown, 10);
place(6, 1, mLangDropDown, 10);
@@ -364,8 +374,9 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) :
place(6, 6, mParticleFontDropDown, 10);
place(6, 7, mHelpFontDropDown, 10);
place(6, 8, mSecureFontDropDown, 10);
- place(6, 9, mJapanFontDropDown, 10);
- place(6, 10, mChinaFontDropDown, 10);
+ place(6, 9, mNpcFontDropDown, 10);
+ place(6, 10, mJapanFontDropDown, 10);
+ place(6, 11, mChinaFontDropDown, 10);
place(17, 0, mInfoButton, 1);
@@ -461,6 +472,10 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
{
mSecureFont = mSecureFontDropDown->getSelectedString();
}
+ else if (eventId == ACTION_NPC_FONT)
+ {
+ mNpcFont = mNpcFontDropDown->getSelectedString();
+ }
else if (eventId == ACTION_JAPAN_FONT)
{
mJapanFont = mJapanFontDropDown->getSelectedString();
@@ -486,6 +501,7 @@ void Setup_Theme::cancel()
mParticleFont = getFileName(config.getStringValue("particleFont"));
mHelpFont = getFileName(config.getStringValue("helpFont"));
mSecureFont = getFileName(config.getStringValue("secureFont"));
+ mNpcFont = getFileName(config.getStringValue("npcFont"));
mJapanFont = getFileName(config.getStringValue("japanFont"));
mChinaFont = getFileName(config.getStringValue("chinaFont"));
}
@@ -510,6 +526,7 @@ void Setup_Theme::apply()
updateField(particleFont, mParticleFont);
updateField(helpFont, mHelpFont);
updateField(secureFont, mSecureFont);
+ updateField(npcFont, mNpcFont);
updateField(japanFont, mJapanFont);
updateField(chinaFont, mChinaFont);
if (mInfo->fontSize)
@@ -534,6 +551,7 @@ void Setup_Theme::apply()
|| config.getValue("particleFont", "dejavusans.ttf") != mParticleFont
|| config.getValue("helpFont", "dejavusansmono.ttf") != mHelpFont
|| config.getValue("secureFont", "dejavusansmono.ttf") != mSecureFont
+ || config.getValue("npcFont", "dejavusans.ttf") != mNpcFont
|| config.getValue("japanFont", "mplus-1p-regular.ttf") != mJapanFont
|| config.getValue("chinaFont", "fonts/wqy-microhei.ttf")
!= mChinaFont
@@ -547,6 +565,7 @@ void Setup_Theme::apply()
config.setValue("particleFont", "fonts/" + getFileName(mParticleFont));
config.setValue("helpFont", "fonts/" + getFileName(mHelpFont));
config.setValue("secureFont", "fonts/" + getFileName(mSecureFont));
+ config.setValue("npcFont", "fonts/" + getFileName(mNpcFont));
config.setValue("japanFont", "fonts/" + getFileName(mJapanFont));
config.setValue("chinaFont", "fonts/" + getFileName(mChinaFont));
config.setValue("fontSize", mFontSizeDropDown->getSelected() + 9);
diff --git a/src/gui/widgets/tabs/setup_theme.h b/src/gui/widgets/tabs/setup_theme.h
index 920ef62af..a7f3ad101 100644
--- a/src/gui/widgets/tabs/setup_theme.h
+++ b/src/gui/widgets/tabs/setup_theme.h
@@ -84,6 +84,10 @@ class Setup_Theme final : public SetupTab
DropDown *mSecureFontDropDown;
std::string mSecureFont;
+ Label *mNpcFontLabel;
+ DropDown *mNpcFontDropDown;
+ std::string mNpcFont;
+
Label *mJapanFontLabel;
DropDown *mJapanFontDropDown;
std::string mJapanFont;