summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-15 19:00:38 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-15 19:34:01 +0300
commit29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7 (patch)
tree8623a9f6274a4548262566e20c75f30806e08b25 /src/gui
parent4193299e2e05d40477a50e5cb0fcc906227f53a2 (diff)
downloadplus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.tar.gz
plus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.tar.bz2
plus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.tar.xz
plus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.zip
In input settings tab add default button for reset selected action to default value.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_input.cpp34
-rw-r--r--src/gui/setup_input.h3
2 files changed, 27 insertions, 10 deletions
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp
index a85a35975..e88098ff3 100644
--- a/src/gui/setup_input.cpp
+++ b/src/gui/setup_input.cpp
@@ -127,8 +127,11 @@ Setup_Input::Setup_Input():
mUnassignKeyButton->addActionListener(this);
mUnassignKeyButton->setEnabled(false);
- mMakeDefaultButton = new Button(_("Default"), "makeDefault", this);
- mMakeDefaultButton->addActionListener(this);
+ mResetKeysButton = new Button(_("Reset all keys"), "resetkeys", this);
+ mResetKeysButton->addActionListener(this);
+
+ mDefaultButton = new Button(_("Default"), "default", this);
+ mDefaultButton->addActionListener(this);
mTabs = new TabStrip(config.getIntValue("fontSize") + 10);
mTabs->addActionListener(this);
@@ -144,11 +147,12 @@ Setup_Input::Setup_Input():
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
- place(0, 0, mTabs, 4);
- place(0, 1, scrollArea, 4, 5).setPadding(2);
- place(0, 6, mMakeDefaultButton);
+ place(0, 0, mTabs, 5);
+ place(0, 1, scrollArea, 5, 5).setPadding(2);
+ place(0, 6, mResetKeysButton);
place(2, 6, mAssignKeyButton);
place(3, 6, mUnassignKeyButton);
+ place(4, 6, mDefaultButton);
setDimension(gcn::Rectangle(0, 0, 500, 350));
}
@@ -164,8 +168,8 @@ Setup_Input::~Setup_Input()
mAssignKeyButton = nullptr;
delete mUnassignKeyButton;
mUnassignKeyButton = nullptr;
- delete mMakeDefaultButton;
- mMakeDefaultButton = nullptr;
+ delete mResetKeysButton;
+ mResetKeysButton = nullptr;
}
void Setup_Input::apply()
@@ -252,11 +256,23 @@ void Setup_Input::action(const gcn::ActionEvent &event)
}
mAssignKeyButton->setEnabled(true);
}
- else if (id == "makeDefault")
+ else if (id == "resetKeys")
{
- inputManager.makeDefault();
+ inputManager.resetKeys();
+ inputManager.update();
refreshKeys();
}
+ else if (id == "default")
+ {
+ int i(mKeyList->getSelected());
+ if (i >= 0 && i < mActionDataSize[selectedData])
+ {
+ const SetupActionData &key = setupActionData[selectedData][i];
+ int ik = key.actionId;
+ inputManager.makeDefault(ik);
+ refreshKeys();
+ }
+ }
else if (!id.find("tabs_"))
{
int k = 0;
diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h
index b2e2d64c0..aacdba366 100644
--- a/src/gui/setup_input.h
+++ b/src/gui/setup_input.h
@@ -83,7 +83,8 @@ class Setup_Input : public SetupTab
gcn::Button *mAssignKeyButton;
gcn::Button *mUnassignKeyButton;
- gcn::Button *mMakeDefaultButton;
+ gcn::Button *mDefaultButton;
+ gcn::Button *mResetKeysButton;
TabStrip *mTabs;
bool mKeySetting; /**< flag to check if key being set. */