EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars

EXP-1233 FIX -- Populate the toybox floater window with all FUI toolbar buttons indicated as such in the "commands.xml" definition.
EXP-1267 FIX -- Enable/disable buttons in the toybox

* Hooked up button callbacks to the toolbar buttons
* Fixed toybox button enable/disable to function properly and live update as
  buttons change states.
* Removed the toybox toolbar background image

Reviewed by Leyla
master
Leslie Linden 2011-09-28 16:54:34 -07:00
parent fc0f5173eb
commit fdf042bdb9
8 changed files with 65 additions and 33 deletions

View File

@ -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)
{
}

View File

@ -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;
};

View File

@ -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);

View File

@ -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();

View File

@ -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 );

View File

@ -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>

View File

@ -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()
{
}

View File

@ -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"