diff options
author | Leslie Linden <leslie@lindenlab.com> | 2011-09-29 15:25:24 -0700 |
---|---|---|
committer | Leslie Linden <leslie@lindenlab.com> | 2011-09-29 15:25:24 -0700 |
commit | cf4f436e5bda78096c945b1de0e0f6c923a9152d (patch) | |
tree | afafc412b52350e54c9ad9fc35ce865f025f6388 /indra/newview | |
parent | 896ea6f81eaf409aae22158816226f09a459ca34 (diff) |
* Updated toybox so it will always display buttons in alphabetical order based
on the localized button labels.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatertoybox.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index c3fa322f85..d7f114043d 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -33,6 +33,7 @@ #include "llpanel.h" #include "lltoolbar.h" #include "lltoolbarview.h" +#include "lltrans.h" LLFloaterToybox::LLFloaterToybox(const LLSD& key) @@ -47,6 +48,14 @@ LLFloaterToybox::~LLFloaterToybox() { } +bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2) +{ + std::string lab1 = LLTrans::getString(cmd1->labelRef()); + std::string lab2 = LLTrans::getString(cmd2->labelRef()); + + return (lab1 < lab2); +} + BOOL LLFloaterToybox::postBuild() { center(); @@ -54,11 +63,13 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild<LLButton>("btn_restore_defaults"); mToolBar = getChild<LLToolBar>("toybox_toolbar"); + LLCommandManager& cmdMgr = LLCommandManager::instance(); + // - // Create Buttons + // Sort commands by localized labels so they will appear alphabetized in all languages // - LLCommandManager& cmdMgr = LLCommandManager::instance(); + std::list<LLCommand *> alphabetized_commands; for (U32 i = 0; i < cmdMgr.commandCount(); i++) { @@ -66,10 +77,21 @@ BOOL LLFloaterToybox::postBuild() if (command->availableInToybox()) { - mToolBar->addCommand(command->id()); + alphabetized_commands.push_back(command); } } + alphabetized_commands.sort(compare_localized_command_labels); + + // + // Create Buttons + // + + for (std::list<LLCommand *>::iterator it = alphabetized_commands.begin(); it != alphabetized_commands.end(); ++it) + { + mToolBar->addCommand((*it)->id()); + } + return TRUE; } |