diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/gui/setup.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup.h | 1 | ||||
-rw-r--r-- | src/gui/setup_interface.cpp | 278 | ||||
-rw-r--r-- | src/gui/setup_interface.h | 81 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 226 | ||||
-rw-r--r-- | src/gui/setup_video.h | 31 |
7 files changed, 385 insertions, 236 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f8ae39fd..97f7bee4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -290,6 +290,8 @@ SET(SRCS gui/setup_keyboard.h gui/setup_players.cpp gui/setup_players.h + gui/setup_interface.cpp + gui/setup_interface.h gui/setup_video.cpp gui/setup_video.h gui/shortcutwindow.cpp diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 41d2b7fe..d5a8e577 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -29,6 +29,7 @@ #include "gui/setup_keyboard.h" #include "gui/setup_players.h" #include "gui/setup_video.h" +#include "gui/setup_interface.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" @@ -68,6 +69,7 @@ Setup::Setup(): mTabs.push_back(new Setup_Video); mTabs.push_back(new Setup_Audio); + mTabs.push_back(new Setup_Interface); mTabs.push_back(new Setup_Joystick); mTabs.push_back(new Setup_Keyboard); mTabs.push_back(new Setup_Colors); diff --git a/src/gui/setup.h b/src/gui/setup.h index 4be94bb8..0c4af1d2 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -40,6 +40,7 @@ class SetupTab; * @see Setup_Keyboard * @see Setup_Players * @see Setup_Video + * @see Setup_Interface * * \ingroup GUI */ diff --git a/src/gui/setup_interface.cpp b/src/gui/setup_interface.cpp new file mode 100644 index 00000000..8949950e --- /dev/null +++ b/src/gui/setup_interface.cpp @@ -0,0 +1,278 @@ +/* + * The Mana Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * + * This file is part of The Mana Client. + * + * 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 + * 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, see <http://www.gnu.org/licenses/>. + */ + +#include "gui/setup_interface.h" + +#include "configuration.h" +#include "game.h" +#include "graphics.h" +#include "localplayer.h" +#include "log.h" +#include "main.h" +//#include "particle.h" + +#include "gui/okdialog.h" + +#include "gui/widgets/checkbox.h" +#include "gui/widgets/label.h" +#include "gui/widgets/layouthelper.h" +#include "gui/widgets/listbox.h" +#include "gui/widgets/scrollarea.h" +#include "gui/widgets/slider.h" +#include "gui/widgets/textfield.h" +#include "gui/widgets/dropdown.h" + +#include "utils/gettext.h" +#include "utils/stringutils.h" + +#include <guichan/key.hpp> +#include <guichan/listmodel.hpp> + +#include <SDL.h> + +#include <string> +#include <vector> + +extern Graphics *graphics; + +const char *SIZE_NAME[4] = +{ + N_("Tiny"), + N_("Small"), + N_("Medium"), + N_("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]; + } +}; + +static const char *speechModeToString(Being::Speech mode) +{ + switch (mode) + { + case Being::NO_SPEECH: return _("No text"); + case Being::TEXT_OVERHEAD: return _("Text"); + case Being::NO_NAME_IN_BUBBLE: return _("Bubbles, no names"); + case Being::NAME_IN_BUBBLE: return _("Bubbles with names"); + } + return ""; +} + +Setup_Interface::Setup_Interface(): + mShowMonsterDamageEnabled(config.getBoolValue("showMonstersTakedDamage")), + mVisibleNamesEnabled(config.getBoolValue("visiblenames")), + mNameEnabled(config.getBoolValue("showownname")), + mNPCLogEnabled(config.getBoolValue("logNpcInGui")), + mPickupChatEnabled(config.getBoolValue("showpickupchat")), + mPickupParticleEnabled(config.getBoolValue("showpickupparticle")), + mOpacity(config.getFloatValue("guialpha")), + mSpeechMode(static_cast<Being::Speech>(config.getIntValue("speech"))), + mVisibleNamesCheckBox(new CheckBox(_("Visible names"), + mVisibleNamesEnabled)), + mNameCheckBox(new CheckBox(_("Show own name"), mNameEnabled)), + mNPCLogCheckBox(new CheckBox(_("Log NPC dialogue"), mNPCLogEnabled)), + mPickupNotifyLabel(new Label(_("Show pickup notification"))), + // TRANSLATORS: Refers to "Show pickup notification" + mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)), + // TRANSLATORS: Refers to "Show pickup notification" + mPickupParticleCheckBox(new CheckBox(_("as particle"), + mPickupParticleEnabled)), + mSpeechSlider(new Slider(0, 3)), + mSpeechLabel(new Label("")), + mAlphaSlider(new Slider(0.2, 1.0)), + mFontSize(config.getIntValue("fontSize")) +{ + setName(_("Interface")); + + // Create widgets + mShowMonsterDamageCheckBox = new CheckBox(_("Show damage"), + mShowMonsterDamageEnabled); + + speechLabel = new Label(_("Overhead text")); + alphaLabel = new Label(_("Gui opacity")); + fontSizeLabel = new Label(_("Font size")); + + mFontSizeListModel = new FontSizeChoiceListModel; + mFontSizeDropDown = new DropDown(mFontSizeListModel); + + mAlphaSlider->setValue(mOpacity); + mAlphaSlider->setWidth(90); + mAlphaSlider->setEnabled(!config.getBoolValue("disableTransparency")); + + + // Set actions + mShowMonsterDamageCheckBox->setActionEventId("monsterdamage"); + mVisibleNamesCheckBox->setActionEventId("visiblenames"); + mPickupChatCheckBox->setActionEventId("pickupchat"); + mPickupParticleCheckBox->setActionEventId("pickupparticle"); + mNameCheckBox->setActionEventId("showownname"); + mNPCLogCheckBox->setActionEventId("lognpc"); + mAlphaSlider->setActionEventId("guialpha"); + mSpeechSlider->setActionEventId("speech"); + + // Set Listeners + mShowMonsterDamageCheckBox->addActionListener(this); + mVisibleNamesCheckBox->addActionListener(this); + mPickupChatCheckBox->addActionListener(this); + mPickupParticleCheckBox->addActionListener(this); + mNameCheckBox->addActionListener(this); + mNPCLogCheckBox->addActionListener(this); + mAlphaSlider->addActionListener(this); + mSpeechSlider->addActionListener(this); + + mSpeechLabel->setCaption(speechModeToString(mSpeechMode)); + mSpeechSlider->setValue(mSpeechMode); + + mFontSizeDropDown->setSelected(mFontSize - 10); + mFontSizeDropDown->adjustHeight(); + + // Do the layout + LayoutHelper h(this); + ContainerPlacer place = h.getPlacer(0, 0); + + place(0, 0, mVisibleNamesCheckBox, 3); + place(3, 0, mNameCheckBox, 3); + + place(0, 1, mShowMonsterDamageCheckBox, 3); + place(3, 1, mNPCLogCheckBox, 3); + + place(0, 3, mPickupNotifyLabel, 6); + + place(0, 4, mPickupChatCheckBox, 3); + place(3, 4, mPickupParticleCheckBox, 3); + + place(0, 6, fontSizeLabel, 2); + place(2, 6, mFontSizeDropDown, 2); + + place(0, 8, mAlphaSlider, 2); + place(2, 8, alphaLabel, 2); + + place(0, 9, mSpeechSlider, 2); + place(2, 9, speechLabel, 2); + place(4, 9, mSpeechLabel, 2).setPadding(2); + + setDimension(gcn::Rectangle(0, 0, 365, 300)); +} + +Setup_Interface::~Setup_Interface() +{ + delete mFontSizeListModel; +} + +void Setup_Interface::apply() +{ + config.setValue("fontSize", mFontSizeDropDown->getSelected() + 10); + + mShowMonsterDamageEnabled = config.getBoolValue("showMonstersTakedDamage"); + mVisibleNamesEnabled = config.getBoolValue("visiblenames"); + mNameEnabled = config.getBoolValue("showownname"); + mNPCLogEnabled = config.getBoolValue("logNpcInGui"); + mSpeechMode = static_cast<Being::Speech>(config.getIntValue("speech")); + mOpacity = config.getFloatValue("guialpha"); + mPickupChatEnabled = config.getBoolValue("showpickupchat"); + mPickupParticleEnabled = config.getBoolValue("showpickupparticle"); +} + +void Setup_Interface::cancel() +{ + mShowMonsterDamageCheckBox->setSelected(mShowMonsterDamageEnabled); + mVisibleNamesCheckBox->setSelected(mVisibleNamesEnabled); + mSpeechSlider->setValue(mSpeechMode); + mNameCheckBox->setSelected(mNameEnabled); + mNPCLogCheckBox->setSelected(mNPCLogEnabled); + mAlphaSlider->setValue(mOpacity); + //mAlphaSlider->setEnabled(!mSDLTransparencyDisabled); + + config.setValue("showMonstersTakedDamage", mShowMonsterDamageEnabled); + config.setValue("visiblenames", mVisibleNamesEnabled); + config.setValue("speech", mSpeechMode); + config.setValue("showownname", mNameEnabled); + if (player_node) + player_node->setCheckNameSetting(true); + config.setValue("logNpcInGui", mNPCLogEnabled); + config.setValue("guialpha", mOpacity); + config.setValue("showpickupchat", mPickupChatEnabled); + config.setValue("showpickupparticle", mPickupParticleEnabled); +} + +void Setup_Interface::action(const gcn::ActionEvent &event) +{ + const std::string &id = event.getId(); + + if (id == "guialpha") + { + config.setValue("guialpha", mAlphaSlider->getValue()); + } + else if (id == "monsterdamage") + { + config.setValue("showMonstersTakedDamage", mShowMonsterDamageCheckBox->isSelected()); + } + else if (id == "visiblenames") + { + config.setValue("visiblenames", mVisibleNamesCheckBox->isSelected()); + } + else if (id == "pickupchat") + { + config.setValue("showpickupchat", mPickupChatCheckBox->isSelected()); + } + else if (id == "pickupparticle") + { + config.setValue("showpickupparticle", + mPickupParticleCheckBox->isSelected()); + } + else if (id == "speech") + { + Being::Speech val = (Being::Speech)mSpeechSlider->getValue(); + mSpeechLabel->setCaption(speechModeToString(val)); + mSpeechSlider->setValue(val); + config.setValue("speech", val); + } + else if (id == "showownname") + { + // Notify the local player that settings have changed for the name + // and requires an update + if (player_node) + player_node->setCheckNameSetting(true); + config.setValue("showownname", mNameCheckBox->isSelected()); + } + else if (id == "lognpc") + { + config.setValue("logNpcInGui", mNPCLogCheckBox->isSelected()); + } + +} + diff --git a/src/gui/setup_interface.h b/src/gui/setup_interface.h new file mode 100644 index 00000000..216b3b10 --- /dev/null +++ b/src/gui/setup_interface.h @@ -0,0 +1,81 @@ +/* + * The Mana Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * + * This file is part of The Mana Client. + * + * 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 + * 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GUI_SETUP_INTERFACE_H +#define GUI_SETUP_INTERFACE_H + +#include "being.h" +#include "guichanfwd.h" + +#include "gui/widgets/setuptab.h" + +#include <guichan/actionlistener.hpp> +#include <guichan/keylistener.hpp> + +class FontSizeChoiceListModel; + +class Setup_Interface : public SetupTab, public gcn::ActionListener, + public gcn::KeyListener +{ + public: + Setup_Interface(); + ~Setup_Interface(); + + void apply(); + void cancel(); + + void action(const gcn::ActionEvent &event); + + private: + bool mShowMonsterDamageEnabled; + bool mVisibleNamesEnabled; + bool mNameEnabled; + bool mNPCLogEnabled; + bool mPickupChatEnabled; + bool mPickupParticleEnabled; + double mOpacity; + Being::Speech mSpeechMode; + + FontSizeChoiceListModel *mFontSizeListModel; + + gcn::Label *speechLabel; + gcn::Label *alphaLabel; + gcn::Label *fontSizeLabel; + + gcn::CheckBox *mShowMonsterDamageCheckBox; + gcn::CheckBox *mVisibleNamesCheckBox; + gcn::CheckBox *mNameCheckBox; + gcn::CheckBox *mNPCLogCheckBox; + + gcn::Label *mPickupNotifyLabel; + gcn::CheckBox *mPickupChatCheckBox; + gcn::CheckBox *mPickupParticleCheckBox; + + gcn::Slider *mSpeechSlider; + gcn::Label *mSpeechLabel; + gcn::Slider *mAlphaSlider; + + int mFontSize; + gcn::DropDown *mFontSizeDropDown; + +}; + +#endif diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 7f6aecb3..fd6d5160 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -123,45 +123,6 @@ int ModeListModel::getIndexOf(const std::string &widthXHeightMode) return -1; } -const char *SIZE_NAME[4] = -{ - N_("Tiny"), - N_("Small"), - N_("Medium"), - N_("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]; - } -}; - -static const char *speechModeToString(Being::Speech mode) -{ - switch (mode) - { - case Being::NO_SPEECH: return _("No text"); - case Being::TEXT_OVERHEAD: return _("Text"); - case Being::NO_NAME_IN_BUBBLE: return _("Bubbles, no names"); - case Being::NAME_IN_BUBBLE: return _("Bubbles with names"); - } - return ""; -} - const char *Setup_Video::overlayDetailToString(int detail) { if (detail == -1) @@ -195,38 +156,17 @@ Setup_Video::Setup_Video(): mFullScreenEnabled(config.getBoolValue("screen")), mOpenGLEnabled(config.getBoolValue("opengl")), mCustomCursorEnabled(config.getBoolValue("customcursor")), - mShowMonsterDamageEnabled(config.getBoolValue("showMonstersTakedDamage")), - mVisibleNamesEnabled(config.getBoolValue("visiblenames")), mParticleEffectsEnabled(config.getBoolValue("particleeffects")), - mNameEnabled(config.getBoolValue("showownname")), - mNPCLogEnabled(config.getBoolValue("logNpcInGui")), - mPickupChatEnabled(config.getBoolValue("showpickupchat")), - mPickupParticleEnabled(config.getBoolValue("showpickupparticle")), - mOpacity(config.getFloatValue("guialpha")), mFps(config.getIntValue("fpslimit")), mSDLTransparencyDisabled(config.getBoolValue("disableTransparency")), - mSpeechMode(static_cast<Being::Speech>(config.getIntValue("speech"))), mModeListModel(new ModeListModel), mModeList(new ListBox(mModeListModel)), mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)), mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)), mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)), - mVisibleNamesCheckBox(new CheckBox(_("Visible names"), - mVisibleNamesEnabled)), mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)), - mNameCheckBox(new CheckBox(_("Show own name"), mNameEnabled)), - mNPCLogCheckBox(new CheckBox(_("Log NPC dialogue"), mNPCLogEnabled)), - mPickupNotifyLabel(new Label(_("Show pickup notification"))), - // TRANSLATORS: Refers to "Show pickup notification" - mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)), - // TRANSLATORS: Refers to "Show pickup notification" - mPickupParticleCheckBox(new CheckBox(_("as particle"), - mPickupParticleEnabled)), - mSpeechSlider(new Slider(0, 3)), - mSpeechLabel(new Label("")), - mAlphaSlider(new Slider(0.2, 1.0)), mFpsCheckBox(new CheckBox(_("FPS limit:"))), mFpsSlider(new Slider(10, 120)), mFpsLabel(new Label), @@ -236,27 +176,17 @@ Setup_Video::Setup_Video(): mParticleDetail(3 - config.getIntValue("particleEmitterSkip")), mParticleDetailSlider(new Slider(0, 3)), mParticleDetailField(new Label), - mFontSize(config.getIntValue("fontSize")), mDisableSDLTransparencyCheckBox( new CheckBox(_("Disable transparency (Low CPU mode)"), mSDLTransparencyDisabled)) { setName(_("Video")); - mShowMonsterDamageCheckBox = new CheckBox(_("Show damage"), - mShowMonsterDamageEnabled); - ScrollArea *scrollArea = new ScrollArea(mModeList); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - speechLabel = new Label(_("Overhead text")); - alphaLabel = new Label(_("Gui opacity")); overlayDetailLabel = new Label(_("Ambient FX")); particleDetailLabel = new Label(_("Particle detail")); - fontSizeLabel = new Label(_("Font size")); - - mFontSizeListModel = new FontSizeChoiceListModel; - mFontSizeDropDown = new DropDown(mFontSizeListModel); mModeList->setEnabled(true); @@ -264,10 +194,6 @@ Setup_Video::Setup_Video(): mOpenGLCheckBox->setEnabled(false); #endif - mAlphaSlider->setValue(mOpacity); - mAlphaSlider->setWidth(90); - mAlphaSlider->setEnabled(!mSDLTransparencyDisabled); - mFpsLabel->setCaption(mFps > 0 ? toString(mFps) : _("None")); mFpsLabel->setWidth(60); mFpsSlider->setValue(mFps); @@ -283,48 +209,31 @@ Setup_Video::Setup_Video(): + toString(graphics->getHeight()); mModeList->setSelected(mModeListModel->getIndexOf(videoMode)); + // Set actions mModeList->setActionEventId("videomode"); mCustomCursorCheckBox->setActionEventId("customcursor"); - mShowMonsterDamageCheckBox->setActionEventId("monsterdamage"); - mVisibleNamesCheckBox->setActionEventId("visiblenames"); mParticleEffectsCheckBox->setActionEventId("particleeffects"); - mPickupChatCheckBox->setActionEventId("pickupchat"); - mPickupParticleCheckBox->setActionEventId("pickupparticle"); - mNameCheckBox->setActionEventId("showownname"); - mNPCLogCheckBox->setActionEventId("lognpc"); - mAlphaSlider->setActionEventId("guialpha"); + mDisableSDLTransparencyCheckBox->setActionEventId("disableTransparency"); mFpsCheckBox->setActionEventId("fpslimitcheckbox"); - mSpeechSlider->setActionEventId("speech"); mFpsSlider->setActionEventId("fpslimitslider"); mOverlayDetailSlider->setActionEventId("overlaydetailslider"); mOverlayDetailField->setActionEventId("overlaydetailfield"); mOpenGLCheckBox->setActionEventId("opengl"); mParticleDetailSlider->setActionEventId("particledetailslider"); mParticleDetailField->setActionEventId("particledetailfield"); - mDisableSDLTransparencyCheckBox->setActionEventId("disableTransparency"); + // Set listeners mModeList->addActionListener(this); mCustomCursorCheckBox->addActionListener(this); - mShowMonsterDamageCheckBox->addActionListener(this); - mVisibleNamesCheckBox->addActionListener(this); mOpenGLCheckBox->addActionListener(this); mParticleEffectsCheckBox->addActionListener(this); - mPickupChatCheckBox->addActionListener(this); - mPickupParticleCheckBox->addActionListener(this); - mNameCheckBox->addActionListener(this); - mNPCLogCheckBox->addActionListener(this); - mAlphaSlider->addActionListener(this); + mDisableSDLTransparencyCheckBox->addActionListener(this); mFpsCheckBox->addActionListener(this); - mSpeechSlider->addActionListener(this); mFpsSlider->addActionListener(this); mOverlayDetailSlider->addActionListener(this); mOverlayDetailField->addKeyListener(this); mParticleDetailSlider->addActionListener(this); mParticleDetailField->addKeyListener(this); - mDisableSDLTransparencyCheckBox->addActionListener(this); - - mSpeechLabel->setCaption(speechModeToString(mSpeechMode)); - mSpeechSlider->setValue(mSpeechMode); mOverlayDetailField->setCaption(overlayDetailToString(mOverlayDetail)); mOverlayDetailSlider->setValue(mOverlayDetail); @@ -332,54 +241,31 @@ Setup_Video::Setup_Video(): mParticleDetailField->setCaption(particleDetailToString(mParticleDetail)); mParticleDetailSlider->setValue(mParticleDetail); - mFontSizeDropDown->setSelected(mFontSize - 10); - mFontSizeDropDown->adjustHeight(); - // Do the layout LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); - place(0, 0, scrollArea, 1, 5).setPadding(2); - place(1, 0, mFsCheckBox, 2); - place(3, 0, mOpenGLCheckBox, 1); - - place(1, 1, mCustomCursorCheckBox, 3); - place(3, 1, mShowMonsterDamageCheckBox, 3); - - place(1, 2, mVisibleNamesCheckBox, 3); - place(3, 2, mNameCheckBox, 1); - - place(1, 3, mParticleEffectsCheckBox, 3); - place(3, 3, mNPCLogCheckBox, 1); - - place(1, 4, mPickupNotifyLabel, 4); - - place(1, 5, mPickupChatCheckBox, 1); - place(2, 5, mPickupParticleCheckBox, 2); + place(0, 0, scrollArea, 2, 6).setPadding(2); - place(0, 6, fontSizeLabel, 3); - place(1, 6, mFontSizeDropDown, 2); + place(2, 0, mFsCheckBox, 2); + place(4, 0, mOpenGLCheckBox, 2); - place(0, 7, mAlphaSlider); - place(1, 7, alphaLabel, 3); + place(2, 2, mCustomCursorCheckBox, 2); + place(4, 2, mParticleEffectsCheckBox, 2); - place(0, 8, mFpsSlider); - place(1, 8, mFpsCheckBox).setPadding(3); - place(2, 8, mFpsLabel).setPadding(1); + place(2, 4, mDisableSDLTransparencyCheckBox, 4); - place(0, 9, mSpeechSlider); - place(1, 9, speechLabel); - place(2, 9, mSpeechLabel, 3).setPadding(2); + place(0, 6, mFpsSlider, 2); + place(2, 6, mFpsCheckBox).setPadding(3); + place(3, 6, mFpsLabel).setPadding(1); - place(0, 10, mOverlayDetailSlider); - place(1, 10, overlayDetailLabel); - place(2, 10, mOverlayDetailField, 3).setPadding(2); + place(0, 7, mOverlayDetailSlider, 2); + place(2, 7, overlayDetailLabel); + place(3, 7, mOverlayDetailField).setPadding(2); - place(0, 11, mParticleDetailSlider); - place(1, 11, particleDetailLabel); - place(2, 11, mParticleDetailField, 3).setPadding(2); - - place(0, 12, mDisableSDLTransparencyCheckBox, 4); + place(0, 8, mParticleDetailSlider, 2); + place(2, 8, particleDetailLabel); + place(3, 8, mParticleDetailField).setPadding(2); setDimension(gcn::Rectangle(0, 0, 365, 300)); } @@ -388,7 +274,6 @@ Setup_Video::~Setup_Video() { delete mModeListModel; delete mModeList; - delete mFontSizeListModel; } void Setup_Video::apply() @@ -486,22 +371,13 @@ void Setup_Video::apply() // FPS change config.setValue("fpslimit", mFps); - config.setValue("fontSize", mFontSizeDropDown->getSelected() + 10); // We sync old and new values at apply time mFullScreenEnabled = config.getBoolValue("screen"); mCustomCursorEnabled = config.getBoolValue("customcursor"); - mShowMonsterDamageEnabled = config.getBoolValue("showMonstersTakedDamage"); - mVisibleNamesEnabled = config.getBoolValue("visiblenames"); mParticleEffectsEnabled = config.getBoolValue("particleeffects"); - mNameEnabled = config.getBoolValue("showownname"); - mNPCLogEnabled = config.getBoolValue("logNpcInGui"); - mSpeechMode = static_cast<Being::Speech>(config.getIntValue("speech")); - mOpacity = config.getFloatValue("guialpha"); mOverlayDetail = config.getIntValue("OverlayDetail"); mOpenGLEnabled = config.getBoolValue("opengl"); - mPickupChatEnabled = config.getBoolValue("showpickupchat"); - mPickupParticleEnabled = config.getBoolValue("showpickupparticle"); mSDLTransparencyDisabled = config.getBoolValue("disableTransparency"); } @@ -511,16 +387,9 @@ void Setup_Video::cancel() mFsCheckBox->setSelected(mFullScreenEnabled); mOpenGLCheckBox->setSelected(mOpenGLEnabled); mCustomCursorCheckBox->setSelected(mCustomCursorEnabled); - mShowMonsterDamageCheckBox->setSelected(mShowMonsterDamageEnabled); - mVisibleNamesCheckBox->setSelected(mVisibleNamesEnabled); mParticleEffectsCheckBox->setSelected(mParticleEffectsEnabled); mFpsSlider->setValue(mFps); mFpsSlider->setEnabled(mFps > 0); - mSpeechSlider->setValue(mSpeechMode); - mNameCheckBox->setSelected(mNameEnabled); - mNPCLogCheckBox->setSelected(mNPCLogEnabled); - mAlphaSlider->setValue(mOpacity); - mAlphaSlider->setEnabled(!mSDLTransparencyDisabled); mOverlayDetailSlider->setValue(mOverlayDetail); mParticleDetailSlider->setValue(mParticleDetail); std::string text = mFpsCheckBox->isSelected() ? toString(mFps) : _("None"); @@ -538,18 +407,8 @@ void Setup_Video::cancel() config.setValue("screenheight", graphics->getHeight()); config.setValue("customcursor", mCustomCursorEnabled); - config.setValue("showMonstersTakedDamage", mShowMonsterDamageEnabled); - config.setValue("visiblenames", mVisibleNamesEnabled); config.setValue("particleeffects", mParticleEffectsEnabled); - config.setValue("speech", mSpeechMode); - config.setValue("showownname", mNameEnabled); - if (player_node) - player_node->setCheckNameSetting(true); - config.setValue("logNpcInGui", mNPCLogEnabled); - config.setValue("guialpha", mOpacity); config.setValue("opengl", mOpenGLEnabled); - config.setValue("showpickupchat", mPickupChatEnabled); - config.setValue("showpickupparticle", mPickupParticleEnabled); config.setValue("disableTransparency", mSDLTransparencyDisabled); } @@ -579,22 +438,10 @@ void Setup_Video::action(const gcn::ActionEvent &event) config.setValue("screenwidth", width); config.setValue("screenheight", height); } - else if (id == "guialpha") - { - config.setValue("guialpha", mAlphaSlider->getValue()); - } else if (id == "customcursor") { config.setValue("customcursor", mCustomCursorCheckBox->isSelected()); } - else if (id == "monsterdamage") - { - config.setValue("showMonstersTakedDamage", mShowMonsterDamageCheckBox->isSelected()); - } - else if (id == "visiblenames") - { - config.setValue("visiblenames", mVisibleNamesCheckBox->isSelected()); - } else if (id == "particleeffects") { config.setValue("particleeffects", @@ -607,34 +454,6 @@ void Setup_Video::action(const gcn::ActionEvent &event) _("Changes will take effect on map change.")); } } - else if (id == "pickupchat") - { - config.setValue("showpickupchat", mPickupChatCheckBox->isSelected()); - } - else if (id == "pickupparticle") - { - config.setValue("showpickupparticle", - mPickupParticleCheckBox->isSelected()); - } - else if (id == "speech") - { - Being::Speech val = (Being::Speech)mSpeechSlider->getValue(); - mSpeechLabel->setCaption(speechModeToString(val)); - mSpeechSlider->setValue(val); - config.setValue("speech", val); - } - else if (id == "showownname") - { - // Notify the local player that settings have changed for the name - // and requires an update - if (player_node) - player_node->setCheckNameSetting(true); - config.setValue("showownname", mNameCheckBox->isSelected()); - } - else if (id == "lognpc") - { - config.setValue("logNpcInGui", mNPCLogCheckBox->isSelected()); - } else if (id == "overlaydetailslider") { int val = (int) mOverlayDetailSlider->getValue(); @@ -671,12 +490,5 @@ void Setup_Video::action(const gcn::ActionEvent &event) { mDisableSDLTransparencyCheckBox->setEnabled(true); } - - // Disable gui opacity slider when disabling transparency. - if (mDisableSDLTransparencyCheckBox->isEnabled()) - mAlphaSlider->setEnabled( - !mDisableSDLTransparencyCheckBox->isSelected()); - else - mAlphaSlider->setEnabled(true); } } diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index d0e2c492..be8724da 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -31,7 +31,6 @@ #include <guichan/keylistener.hpp> class ModeListModel; -class FontSizeChoiceListModel; class Setup_Video : public SetupTab, public gcn::ActionListener, public gcn::KeyListener @@ -53,46 +52,23 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, bool mFullScreenEnabled; bool mOpenGLEnabled; bool mCustomCursorEnabled; - bool mShowMonsterDamageEnabled; - bool mVisibleNamesEnabled; bool mParticleEffectsEnabled; - bool mNameEnabled; - bool mNPCLogEnabled; - bool mPickupChatEnabled; - bool mPickupParticleEnabled; - double mOpacity; int mFps; bool mSDLTransparencyDisabled; - Being::Speech mSpeechMode; ModeListModel *mModeListModel; - FontSizeChoiceListModel *mFontSizeListModel; - gcn::Label *speechLabel; - gcn::Label *alphaLabel; - gcn::Label *scrollRadiusLabel; - gcn::Label *scrollLazinessLabel; + //gcn::Label *scrollRadiusLabel; + //gcn::Label *scrollLazinessLabel; gcn::Label *overlayDetailLabel; gcn::Label *particleDetailLabel; - gcn::Label *fontSizeLabel; gcn::ListBox *mModeList; gcn::CheckBox *mFsCheckBox; gcn::CheckBox *mOpenGLCheckBox; gcn::CheckBox *mCustomCursorCheckBox; - gcn::CheckBox *mShowMonsterDamageCheckBox; - gcn::CheckBox *mVisibleNamesCheckBox; gcn::CheckBox *mParticleEffectsCheckBox; - gcn::CheckBox *mNameCheckBox; - gcn::CheckBox *mNPCLogCheckBox; - gcn::Label *mPickupNotifyLabel; - gcn::CheckBox *mPickupChatCheckBox; - gcn::CheckBox *mPickupParticleCheckBox; - - gcn::Slider *mSpeechSlider; - gcn::Label *mSpeechLabel; - gcn::Slider *mAlphaSlider; gcn::CheckBox *mFpsCheckBox; gcn::Slider *mFpsSlider; gcn::Label *mFpsLabel; @@ -105,9 +81,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::Slider *mParticleDetailSlider; gcn::Label *mParticleDetailField; - int mFontSize; - gcn::DropDown *mFontSizeDropDown; - gcn::CheckBox *mDisableSDLTransparencyCheckBox; }; |