diff options
author | Blue <bluesansdouze@gmail.com> | 2009-04-26 03:10:02 +0200 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-25 19:13:35 -0600 |
commit | 1b114e761b528fdcf132db294dbe83d8aafe3621 (patch) | |
tree | f556251d13f690aa32c0e09b2bed6f96fc9a04c8 /src/gui | |
parent | c694500e3ad9b958910ce6b230378caecfa83257 (diff) | |
download | mana-1b114e761b528fdcf132db294dbe83d8aafe3621.tar.gz mana-1b114e761b528fdcf132db294dbe83d8aafe3621.tar.bz2 mana-1b114e761b528fdcf132db294dbe83d8aafe3621.tar.xz mana-1b114e761b528fdcf132db294dbe83d8aafe3621.zip |
Font size change in the gui
Added support for change font size in the setup menu (video tab).
You can select small (11), normal (12), large (13), very large (14).
You need to restart the client for it takes effect.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/setup_video.cpp | 69 | ||||
-rw-r--r-- | src/gui/setup_video.h | 4 |
2 files changed, 68 insertions, 5 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 41c4da76..4cae18ba 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -30,6 +30,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/slider.h" #include "gui/widgets/textfield.h" +#include "gui/widgets/dropdown.h" #include "configuration.h" #include "engine.h" @@ -93,7 +94,7 @@ ModeListModel::ModeListModel() logger->log("No modes available"); else if (modes == (SDL_Rect **)-1) logger->log("All resolutions available"); - else + else { //logger->log("Available Modes"); for (int i = 0; modes[i]; ++i) @@ -106,6 +107,33 @@ ModeListModel::ModeListModel() } } +const char *SIZE_NAME[4] = +{ + N_("Small"), + N_("Medium"), + N_("Large"), + N_("Very Large") +}; + +class FontSizeChoiceListModel : public gcn::ListModel +{ +public: + virtual ~FontSizeChoiceListModel() { } + + virtual int getNumberOfElements() + { + return 4; + } + + virtual std::string getElementAt(int i) + { + if (i >= getNumberOfElements()) + return _("???"); + + return SIZE_NAME[i]; + } +}; + Setup_Video::Setup_Video(): mFullScreenEnabled(config.getValue("screen", false)), mOpenGLEnabled(config.getValue("opengl", false)), @@ -147,7 +175,8 @@ Setup_Video::Setup_Video(): mOverlayDetailField(new Label("")), mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 1)), mParticleDetailSlider(new Slider(0, 3)), - mParticleDetailField(new Label("")) + mParticleDetailField(new Label("")), + mFontSize((int) config.getValue("fontSize", 11)) { setName(_("Video")); @@ -160,6 +189,9 @@ Setup_Video::Setup_Video(): scrollLazinessLabel = new Label(_("Scroll laziness")); overlayDetailLabel = new Label(_("Ambient FX")); particleDetailLabel = new Label(_("Particle Detail")); + fontSizeLabel = new Label(_("Font size")); + + mFontSizeDropDown = new DropDown(new FontSizeChoiceListModel); mModeList->setEnabled(true); @@ -272,6 +304,29 @@ Setup_Video::Setup_Video(): } mParticleDetailSlider->setValue(mParticleDetail); + int fontSizeSelected; + switch (mFontSize) + { + case 11: + fontSizeSelected = 0; + break; + case 12: + fontSizeSelected = 1; + break; + case 13: + fontSizeSelected = 2; + break; + case 14: + fontSizeSelected = 3; + break; + default: + fontSizeSelected = 0; + break; + } + + mFontSizeDropDown->setSelected(fontSizeSelected); + mFontSizeDropDown->adjustHeight(); + // Do the layout LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); @@ -284,8 +339,7 @@ Setup_Video::Setup_Video(): place(3, 2, mNameCheckBox, 1); place(1, 3, mParticleEffectsCheckBox, 3); place(1, 4, mPickupNotifyLabel, 3); - place(1, 5, mPickupChatCheckBox, 1); - place(2, 5, mPickupParticleCheckBox, 2); + place(1, 13, mPickupChatCheckBox, 1); place(0, 6, mAlphaSlider); place(0, 7, mFpsSlider); @@ -302,15 +356,18 @@ Setup_Video::Setup_Video(): place(1, 10, speechLabel); place(1, 11, overlayDetailLabel); place(1, 12, particleDetailLabel); + place(1, 5, fontSizeLabel, 3); + place(2, 5, mFontSizeDropDown, 3); place(2, 7, mFpsField).setPadding(1); place(2, 8, mScrollRadiusField).setPadding(1); place(2, 9, mScrollLazinessField).setPadding(1); place(2, 10, mSpeechLabel, 3).setPadding(2); place(2, 11, mOverlayDetailField, 3).setPadding(2); place(2, 12, mParticleDetailField, 3).setPadding(2); + place(2, 13, mPickupParticleCheckBox, 2); - setDimension(gcn::Rectangle(0, 0, 325, 280)); + setDimension(gcn::Rectangle(0, 0, 325, 300)); } void Setup_Video::apply() @@ -368,6 +425,8 @@ void Setup_Video::apply() // FPS change config.setValue("fpslimit", mFps); + config.setValue("fontSize", mFontSizeDropDown->getSelected() + 11); + // We sync old and new values at apply time mFullScreenEnabled = config.getValue("screen", false); mCustomCursorEnabled = config.getValue("customcursor", true); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 20944924..9b9cbfde 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -67,6 +67,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::Label *scrollLazinessLabel; gcn::Label *overlayDetailLabel; gcn::Label *particleDetailLabel; + gcn::Label *fontSizeLabel; gcn::ListBox *mModeList; gcn::CheckBox *mFsCheckBox; @@ -102,6 +103,9 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, int mParticleDetail; gcn::Slider *mParticleDetailSlider; gcn::Label *mParticleDetailField; + + int mFontSize; + gcn::DropDown *mFontSizeDropDown; }; #endif |