summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatertoybox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatertoybox.cpp')
-rw-r--r--indra/newview/llfloatertoybox.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index c3fa322f85..7a6afb4e33 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,18 +48,30 @@ 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();
mBtnRestoreDefaults = getChild<LLButton>("btn_restore_defaults");
+ mBtnRestoreDefaults->setCommitCallback(boost::bind(&LLToolBarView::loadDefaultToolbars));
+
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 +79,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;
}