diff options
-rw-r--r-- | indra/llui/llcommandmanager.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.h | 6 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 10 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 10 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 3 | ||||
-rw-r--r-- | indra/newview/app_settings/commands.xml | 42 | ||||
-rw-r--r-- | indra/newview/llfloatertoybox.cpp | 19 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_toybox.xml | 4 |
8 files changed, 65 insertions, 33 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 783990780b..b1147134c2 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -53,7 +53,7 @@ LLCommand::Params::Params() , icon("icon") , label_ref("label_ref") , name("name") - , param("param") + , parameter("parameter") , tooltip_ref("tooltip_ref") { } @@ -64,7 +64,7 @@ LLCommand::LLCommand(const LLCommand::Params& p) , mIcon(p.icon) , mIdentifier(p.name) , mLabelRef(p.label_ref) - , mParam(p.param) + , mParameter(p.parameter) , mTooltipRef(p.tooltip_ref) { } diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 4781f77177..6481a05689 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -93,7 +93,7 @@ public: Mandatory<std::string> icon; Mandatory<std::string> label_ref; Mandatory<std::string> name; - Optional<std::string> param; + Optional<LLSD> parameter; Mandatory<std::string> tooltip_ref; Params(); @@ -106,7 +106,7 @@ public: const std::string& icon() const { return mIcon; } const LLCommandId& id() const { return mIdentifier; } const std::string& labelRef() const { return mLabelRef; } - const std::string& param() const { return mParam; } + const LLSD& parameter() const { return mParameter; } const std::string& tooltipRef() const { return mTooltipRef; } private: @@ -116,7 +116,7 @@ private: std::string mFunction; std::string mIcon; std::string mLabelRef; - std::string mParam; + LLSD mParameter; std::string mTooltipRef; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index c5219b11e8..45567d5859 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -500,7 +500,6 @@ void LLToolBar::createButtons() { createButton(command_id); } - } void LLToolBar::createButton(const LLCommandId& id) @@ -509,12 +508,21 @@ void LLToolBar::createButton(const LLCommandId& id) if (!commandp) return; LLToolBarButton::Params button_p; + button_p.name = id.name(); button_p.label = LLTrans::getString(commandp->labelRef()); button_p.tool_tip = button_p.label(); button_p.image_overlay = LLUI::getUIImage(commandp->icon()); button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); + if (!mReadOnly) + { + LLUICtrl::CommitCallbackParam cbParam; + cbParam.function_name = commandp->functionName(); + cbParam.parameter = commandp->parameter(); + button->setCommitCallback(cbParam); + } + mButtons.push_back(button); mButtonPanel->addChild(button); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index d58df5801b..5e8bf498c0 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -992,6 +992,16 @@ void LLUICtrl::setTransparencyType(ETypeTransparency type) mTransparencyType = type; } +boost::signals2::connection LLUICtrl::setCommitCallback(const CommitCallbackParam& cb) +{ + return setCommitCallback(initCommitCallback(cb)); +} + +boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackParam& cb) +{ + return setValidateCallback(initEnableCallback(cb)); +} + boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb ) { if (!mCommitSignal) mCommitSignal = new commit_signal_t(); diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 09bed9b958..fc56e5fc35 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -235,6 +235,9 @@ public: // topic then put in help_topic_out bool findHelpTopic(std::string& help_topic_out); + boost::signals2::connection setCommitCallback(const CommitCallbackParam& cb); + boost::signals2::connection setValidateCallback(const EnableCallbackParam& cb); + boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ); diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 4a33b24075..5fbd9248c1 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -6,7 +6,7 @@ label_ref="Command_Avatar_Label" tooltip_ref="Command_Avatar_Tooltip" function="Floater.ToolbarToggle" - param="avatar" + parameter="avatar" /> <command name="build" available_in_toybox="true" @@ -14,7 +14,7 @@ label_ref="Command_Build_Label" tooltip_ref="Command_Build_Tooltip" function="Floater.ToolbarToggle" - param="build" + parameter="build" /> <command name="chat" available_in_toybox="true" @@ -22,7 +22,7 @@ label_ref="Command_Chat_Label" tooltip_ref="Command_Chat_Tooltip" function="Floater.ToolbarToggle" - param="chat" + parameter="chat" /> <command name="compass" available_in_toybox="false" @@ -30,7 +30,7 @@ label_ref="Command_Compass_Label" tooltip_ref="Command_Compass_Tooltip" function="Floater.ToolbarToggle" - param="compass" + parameter="compass" /> <command name="gestures" available_in_toybox="true" @@ -38,7 +38,7 @@ label_ref="Command_Gestures_Label" tooltip_ref="Command_Gestures_Tooltip" function="Floater.ToolbarToggle" - param="gestures" + parameter="gestures" /> <command name="howto" available_in_toybox="true" @@ -46,7 +46,7 @@ label_ref="Command_HowTo_Label" tooltip_ref="Command_HowTo_Tooltip" function="Floater.ToolbarToggle" - param="howto" + parameter="howto" /> <command name="landmarks" available_in_toybox="true" @@ -54,7 +54,7 @@ label_ref="Command_Landmarks_Label" tooltip_ref="Command_Landmarks_Tooltip" function="Floater.ToolbarToggle" - param="landmarks" + parameter="landmarks" /> <command name="map" available_in_toybox="true" @@ -62,7 +62,7 @@ label_ref="Command_Map_Label" tooltip_ref="Command_Map_Tooltip" function="Floater.ToolbarToggle" - param="map" + parameter="map" /> <command name="minimap" available_in_toybox="true" @@ -70,7 +70,7 @@ label_ref="Command_MiniMap_Label" tooltip_ref="Command_MiniMap_Tooltip" function="Floater.ToolbarToggle" - param="minimap" + parameter="minimap" /> <command name="move" available_in_toybox="true" @@ -78,7 +78,7 @@ label_ref="Command_Move_Label" tooltip_ref="Command_Move_Tooltip" function="Floater.ToolbarToggle" - param="move" + parameter="move" /> <command name="myland" available_in_toybox="true" @@ -86,7 +86,7 @@ label_ref="Command_MyLand_Label" tooltip_ref="Command_MyLand_Tooltip" function="Floater.ToolbarToggle" - param="myland" + parameter="myland" /> <command name="mystuff" available_in_toybox="true" @@ -94,7 +94,7 @@ label_ref="Command_MyStuff_Label" tooltip_ref="Command_MyStuff_Tooltip" function="Floater.ToolbarToggle" - param="mystuff" + parameter="mystuff" /> <command name="people" available_in_toybox="true" @@ -102,7 +102,7 @@ label_ref="Command_People_Label" tooltip_ref="Command_People_Tooltip" function="Floater.ToolbarToggle" - param="people" + parameter="people" /> <command name="places" available_in_toybox="true" @@ -110,7 +110,7 @@ label_ref="Command_Places_Label" tooltip_ref="Command_Places_Tooltip" function="Floater.ToolbarToggle" - param="places" + parameter="places" /> <command name="search" available_in_toybox="true" @@ -118,7 +118,7 @@ label_ref="Command_Search_Label" tooltip_ref="Command_Search_Tooltip" function="Floater.ToolbarToggle" - param="search" + parameter="search" /> <command name="settings" available_in_toybox="true" @@ -126,7 +126,7 @@ label_ref="Command_Settings_Label" tooltip_ref="Command_Settings_Tooltip" function="Floater.ToolbarToggle" - param="settings" + parameter="settings" /> <command name="shop" available_in_toybox="true" @@ -134,7 +134,7 @@ label_ref="Command_Shop_Label" tooltip_ref="Command_Shop_Tooltip" function="Floater.ToolbarToggle" - param="shop" + parameter="shop" /> <command name="snapshot" available_in_toybox="true" @@ -142,7 +142,7 @@ label_ref="Command_Snapshot_Label" tooltip_ref="Command_Snapshot_Tooltip" function="Floater.ToolbarToggle" - param="snapshot" + parameter="snapshot" /> <command name="speak" available_in_toybox="true" @@ -150,7 +150,7 @@ label_ref="Command_Speak_Label" tooltip_ref="Command_Speak_Tooltip" function="Floater.ToolbarToggle" - param="speak" + parameter="speak" /> <command name="upload" available_in_toybox="true" @@ -158,7 +158,7 @@ label_ref="Command_Upload_Label" tooltip_ref="Command_Upload_Tooltip" function="Floater.ToolbarToggle" - param="upload" + parameter="upload" /> <command name="view" available_in_toybox="true" @@ -166,6 +166,6 @@ label_ref="Command_View_Label" tooltip_ref="Command_View_Tooltip" function="Floater.ToolbarToggle" - param="view" + parameter="view" /> </commands> diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index beb928ea36..c3fa322f85 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -67,9 +67,6 @@ BOOL LLFloaterToybox::postBuild() if (command->availableInToybox()) { mToolBar->addCommand(command->id()); - - llassert(gToolBarView != NULL); - mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); } } @@ -93,17 +90,29 @@ void LLFloaterToybox::onClose(bool app_quitting) void LLFloaterToybox::draw() { + llassert(gToolBarView != NULL); + + LLCommandManager& cmdMgr = LLCommandManager::instance(); + + for (U32 i = 0; i < cmdMgr.commandCount(); i++) + { + LLCommand * command = cmdMgr.getCommand(i); + + if (command->availableInToybox()) + { + mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); + } + } + LLFloater::draw(); } void LLFloaterToybox::onFocusReceived() { - } void LLFloaterToybox::onBtnRestoreDefaults() { - } diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 092eddaa53..feb19571b2 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -59,7 +59,9 @@ read_only="true" right="-20" side="top" - top="85" /> + top="85"> + <button_panel background_visible="false" /> + </toolbar> <panel bevel_style="none" border="true" |