Made command list able to use control_name buttons.

ziree 2012-02-20 15:10:45 +01:00
parent 7488446f12
commit bdecd7aa44
5 changed files with 36 additions and 1 deletions

View File

@ -63,6 +63,7 @@ LLCommand::Params::Params()
, is_running_parameters("is_running_parameters")
, is_starting_function("is_starting_function")
, is_starting_parameters("is_starting_parameters")
, control_name("control_name") // <FS:Zi> Add control_name to toolbar buttons
{
}
@ -83,6 +84,7 @@ LLCommand::LLCommand(const LLCommand::Params& p)
, mIsRunningParameters(p.is_running_parameters)
, mIsStartingFunction(p.is_starting_function)
, mIsStartingParameters(p.is_starting_parameters)
, mControlVariable(p.control_name) // <FS:Zi> Add control_name to toolbar buttons
{
}

View File

@ -96,7 +96,11 @@ public:
Mandatory<std::string> name;
Mandatory<std::string> tooltip_ref;
Mandatory<std::string> execute_function;
// <FS:Zi> Add control_name to toolbar buttons
// so we can have control_name instead of aall these functions.
// Mandatory<std::string> execute_function;
Optional<std::string> execute_function;
// </FS:Zi>
Optional<LLSD> execute_parameters;
Optional<std::string> execute_stop_function;
@ -111,6 +115,8 @@ public:
Optional<std::string> is_starting_function;
Optional<LLSD> is_starting_parameters;
Optional<std::string> control_name; // <FS:Zi> Add control_name to toolbar buttons
Params();
};
@ -161,6 +167,13 @@ private:
std::string mIsStartingFunction;
LLSD mIsStartingParameters;
// <FS;Zi> Add control_variable to commands in toolbar
std::string mControlVariable;
public:
const std::string& controlVariableName() const { return mControlVariable; }
// </FS:Zi>
};

View File

@ -1017,6 +1017,16 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
button_p.name = commandp->name();
button_p.label = LLTrans::getString(commandp->labelRef());
button_p.tool_tip = LLTrans::getString(commandp->tooltipRef());
// <FS;Zi> Add control_variable to commands in toolbar if it's not read-only
if(!mReadOnly && !commandp->controlVariableName().empty())
{
// set up button's control name and make it a toggle, so it works properly
button_p.control_name = commandp->controlVariableName();
button_p.is_toggle = TRUE;
}
// </FS:Zi>
// <FS:Zi> Do not add an icon if we are using text only buttons
// button_p.image_overlay = LLUI::getUIImage(commandp->icon());
if(mButtonType!=BTNTYPE_TEXT_ONLY)

View File

@ -292,4 +292,12 @@
is_running_parameters="web_content"
/>
<!-- this uses control_name instead of the execute/is_running functions -Zi -->
<command name="defaultchatbar"
available_in_toybox="true"
icon="nearbychat_18"
label_ref="Default_Chat_Bar_Label"
tooltip_ref="Default_Chat_Bar_Tooltip"
control_name="MainChatbarVisible"
/>
</commands>

View File

@ -3894,6 +3894,7 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Quickprefs_Label">Quick prefs</string>
<string name="Command_AO_Label">Animation Overrider</string>
<string name="Command_Webbrowser_Label">Web Browser</string>
<string name="Default_Chat_Bar_Label">Chat</string>
<string name="Command_AboutLand_Tooltip">Information about the land you're visiting</string>
<string name="Command_Appearance_Tooltip">Change your avatar</string>
@ -3924,6 +3925,7 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Quickprefs_Tooltip">Quick preferences for changing often used settings</string>
<string name="Command_AO_Tooltip">Animation Overrider</string>
<string name="Command_Webbrowser_Tooltip">Opens the internal web browser</string>
<string name="Default_Chat_Bar_Tooltip">Shows or hides the default chat bar</string>
<string name="Toolbar_Bottom_Tooltip">currently in your bottom toolbar</string>
<string name="Toolbar_Left_Tooltip" >currently in your left toolbar</string>