summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-21 03:33:54 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-21 03:33:54 +0300
commite4dabfe2b75a20378bdb1bf32b53249b5d55740b (patch)
tree8c14cc39a4f0a5b730d377a1d89b0304c9b8122d /src/gui
parent2eef004b8b70861fd377ad50393a9a0ccbbbc152 (diff)
downloadmanaplus-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.tar.gz
manaplus-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.tar.bz2
manaplus-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.tar.xz
manaplus-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.zip
Bit cleanup visual settings page.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_visual.cpp30
-rw-r--r--src/gui/setup_visual.h2
-rw-r--r--src/gui/widgets/setupitem.cpp30
-rw-r--r--src/gui/widgets/setupitem.h12
4 files changed, 35 insertions, 39 deletions
diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp
index 9c172da04..5e072b53b 100644
--- a/src/gui/setup_visual.cpp
+++ b/src/gui/setup_visual.cpp
@@ -62,7 +62,7 @@ Setup_Visual::Setup_Visual()
"", "grabinput", this, "grabinputEvent");
new SetupItemSlider(_("Gui opacity"), "", "guialpha",
- this, "guialphaEvent", 0.1, 1.0);
+ this, "guialphaEvent", 0.1, 1.0, 150, true);
mSpeachList = new SetupItemNames();
mSpeachList->push_back(_("No text"));
@@ -89,7 +89,10 @@ Setup_Visual::Setup_Visual()
mParticleList->push_back(_("max"));
(new SetupItemSlider2(_("Particle detail"), "", "particleEmitterSkip",
this, "particleEmitterSkipEvent", 0, 3,
- mParticleList))->setInvertValue(3);
+ mParticleList, true))->setInvertValue(3);
+
+ new SetupItemSlider(_("Gamma"), "", "gamma",
+ this, "gammeEvent", 1, 20, 350, true);
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
@@ -107,28 +110,5 @@ Setup_Visual::~Setup_Visual()
void Setup_Visual::apply()
{
SetupTabScroll::apply();
- Image::setEnableAlpha(config.getFloatValue("guialpha") != 1.0f);
Client::applyGrabMode();
}
-
-void Setup_Visual::action(const gcn::ActionEvent &event)
-{
- if (event.getId() == "guialphaEvent")
- {
- Slider *slider = static_cast<Slider*>(event.getSource());
- if (slider)
- {
- config.setValue("guialpha", slider->getValue());
- Image::setEnableAlpha(config.getFloatValue("guialpha") != 1.0f);
- }
- }
- else if (event.getId() == "particleEmitterSkipEvent")
- {
- Slider *slider = static_cast<Slider*>(event.getSource());
- if (slider)
- {
- int val = static_cast<int>(slider->getValue());
- Particle::emitterSkip = 4 - val;
- }
- }
-}
diff --git a/src/gui/setup_visual.h b/src/gui/setup_visual.h
index 60d8ac787..30ae18645 100644
--- a/src/gui/setup_visual.h
+++ b/src/gui/setup_visual.h
@@ -39,8 +39,6 @@ class Setup_Visual : public SetupTabScroll
void apply();
- void action(const gcn::ActionEvent &event A_UNUSED);
-
private:
SetupItemNames *mSpeachList;
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 581d9f239..490c046c3 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -597,13 +597,15 @@ void SetupItemDropDown::toWidget()
SetupItemSlider::SetupItemSlider(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, double min, double max,
- bool mainConfig) :
+ int width, bool onTheFly, bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
mSlider(nullptr),
mMin(min),
- mMax(max)
+ mMax(max),
+ mWidth(width),
+ mOnTheFly(onTheFly)
{
mValueType = VSTR;
createControls();
@@ -612,13 +614,16 @@ SetupItemSlider::SetupItemSlider(std::string text, std::string description,
SetupItemSlider::SetupItemSlider(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, double min, double max,
- std::string def, bool mainConfig) :
+ std::string def, int width, bool onTheFly,
+ bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
mSlider(nullptr),
mMin(min),
- mMax(max)
+ mMax(max),
+ mWidth(width),
+ mOnTheFly(onTheFly)
{
mValueType = VSTR;
createControls();
@@ -645,7 +650,7 @@ void SetupItemSlider::createControls()
mSlider->setHeight(30);
mWidget = mSlider;
- mSlider->setWidth(150);
+ mSlider->setWidth(mWidth);
mSlider->setHeight(40);
mHorizont->add(mLabel);
mHorizont->add(mSlider, -10);
@@ -675,6 +680,8 @@ void SetupItemSlider::toWidget()
void SetupItemSlider::action(const gcn::ActionEvent &event A_UNUSED)
{
fromWidget();
+ if (mOnTheFly)
+ save();
}
void SetupItemSlider::apply(std::string eventName)
@@ -689,7 +696,8 @@ void SetupItemSlider::apply(std::string eventName)
SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
- SetupItemNames *values, bool mainConfig) :
+ SetupItemNames *values, bool onTheFly,
+ bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
@@ -699,7 +707,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
mMin(min),
mMax(max),
mInvert(false),
- mInvertValue(0)
+ mInvertValue(0),
+ mOnTheFly(onTheFly)
{
mValueType = VSTR;
createControls();
@@ -709,7 +718,7 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
SetupItemNames *values, std::string def,
- bool mainConfig) :
+ bool onTheFly, bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
@@ -719,7 +728,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
mMin(min),
mMax(max),
mInvert(false),
- mInvertValue(0)
+ mInvertValue(0),
+ mOnTheFly(onTheFly)
{
mValueType = VSTR;
createControls();
@@ -811,6 +821,8 @@ void SetupItemSlider2::action(const gcn::ActionEvent &event A_UNUSED)
{
fromWidget();
updateLabel();
+ if (mOnTheFly)
+ save();
}
void SetupItemSlider2::updateLabel()
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index cf847f55d..b950d1488 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -270,12 +270,14 @@ class SetupItemSlider : public SetupItem
SetupItemSlider(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, double min, double max,
+ int width = 150, bool onTheFly = false,
bool mainConfig = true);
SetupItemSlider(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, double min, double max,
- std::string def, bool mainConfig = true);
+ std::string def, int width = 150,
+ bool onTheFly = false, bool mainConfig = true);
~SetupItemSlider();
@@ -297,6 +299,8 @@ class SetupItemSlider : public SetupItem
Slider *mSlider;
double mMin;
double mMax;
+ int mWidth;
+ bool mOnTheFly;
};
typedef std::vector<std::string> SetupItemNames;
@@ -309,13 +313,14 @@ class SetupItemSlider2 : public SetupItem
SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
- SetupItemNames *values, bool mainConfig = true);
+ SetupItemNames *values, bool onTheFly = false,
+ bool mainConfig = true);
SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
SetupItemNames *values, std::string def,
- bool mainConfig = true);
+ bool onTheFly = false, bool mainConfig = true);
~SetupItemSlider2();
@@ -345,6 +350,7 @@ class SetupItemSlider2 : public SetupItem
int mMax;
bool mInvert;
int mInvertValue;
+ bool mOnTheFly;
};
#endif