diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-15 19:00:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-15 19:34:01 +0300 |
commit | 29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7 (patch) | |
tree | 8623a9f6274a4548262566e20c75f30806e08b25 /src/gui | |
parent | 4193299e2e05d40477a50e5cb0fcc906227f53a2 (diff) | |
download | manaplus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.tar.gz manaplus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.tar.bz2 manaplus-29ef15b2fd5d3b3af1adaa8a4e168f9b791a9ed7.tar.xz manaplus-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.cpp | 34 | ||||
-rw-r--r-- | src/gui/setup_input.h | 3 |
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. */ |