diff options
author | Leslie Linden <leslie@lindenlab.com> | 2011-10-04 14:09:03 -0700 |
---|---|---|
committer | Leslie Linden <leslie@lindenlab.com> | 2011-10-04 14:09:03 -0700 |
commit | db2e763ff0537785336a330d03bb9307478cb79a (patch) | |
tree | 20ab0fa0068580291f5dfae03911ca2462f13ea6 | |
parent | fc6c3fbe4271dcd9b64bdfd417514dc97ad7dd75 (diff) |
* Modified commands to add functions for is_enabled, is_running and is_starting,
currently not hooked to any functionality.
-rw-r--r-- | indra/llui/llcommandmanager.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.h | 43 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/commands.xml | 92 | ||||
-rw-r--r-- | indra/newview/llfloatertoybox.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llfloatertoybox.h | 4 |
6 files changed, 109 insertions, 92 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index b1147134c2..922f243806 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -48,24 +48,36 @@ const LLCommandId LLCommandId::null("null command"); // LLCommand::Params::Params() - : function("function") - , available_in_toybox("available_in_toybox", false) + : available_in_toybox("available_in_toybox", false) , icon("icon") , label_ref("label_ref") , name("name") - , parameter("parameter") , tooltip_ref("tooltip_ref") + , execute_function("execute_function") + , execute_parameters("execute_parameters") + , is_enabled_function("is_enabled_function") + , is_enabled_parameters("is_enabled_parameters") + , is_running_function("is_running_function") + , is_running_parameters("is_running_parameters") + , is_starting_function("is_starting_function") + , is_starting_parameters("is_starting_parameters") { } LLCommand::LLCommand(const LLCommand::Params& p) - : mFunction(p.function) - , mAvailableInToybox(p.available_in_toybox) + : mAvailableInToybox(p.available_in_toybox) , mIcon(p.icon) , mIdentifier(p.name) , mLabelRef(p.label_ref) - , mParameter(p.parameter) , mTooltipRef(p.tooltip_ref) + , mExecuteFunction(p.execute_function) + , mExecuteParameters(p.execute_parameters) + , mIsEnabledFunction(p.is_enabled_function) + , mIsEnabledParameters(p.is_enabled_parameters) + , mIsRunningFunction(p.is_running_function) + , mIsRunningParameters(p.is_running_parameters) + , mIsStartingFunction(p.is_starting_function) + , mIsStartingParameters(p.is_starting_parameters) { } diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 6481a05689..3ac5548a0d 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -83,41 +83,72 @@ private: typedef std::list<LLCommandId> command_id_list_t; + class LLCommand { public: struct Params : public LLInitParam::Block<Params> { Mandatory<bool> available_in_toybox; - Mandatory<std::string> function; Mandatory<std::string> icon; Mandatory<std::string> label_ref; Mandatory<std::string> name; - Optional<LLSD> parameter; Mandatory<std::string> tooltip_ref; + Mandatory<std::string> execute_function; + Optional<LLSD> execute_parameters; + + Optional<std::string> is_enabled_function; + Optional<LLSD> is_enabled_parameters; + + Optional<std::string> is_running_function; + Optional<LLSD> is_running_parameters; + + Optional<std::string> is_starting_function; + Optional<LLSD> is_starting_parameters; + Params(); }; LLCommand(const LLCommand::Params& p); const bool availableInToybox() const { return mAvailableInToybox; } - const std::string& functionName() const { return mFunction; } const std::string& icon() const { return mIcon; } const LLCommandId& id() const { return mIdentifier; } const std::string& labelRef() const { return mLabelRef; } - const LLSD& parameter() const { return mParameter; } const std::string& tooltipRef() const { return mTooltipRef; } + const std::string& executeFunctionName() const { return mExecuteFunction; } + const LLSD& executeParameters() const { return mExecuteParameters; } + + const std::string& isEnabledFunctionName() const { return mIsEnabledFunction; } + const LLSD& isEnabledParameters() const { return mIsEnabledParameters; } + + const std::string& isRunningFunctionName() const { return mIsRunningFunction; } + const LLSD& isRunningParameters() const { return mIsRunningParameters; } + + const std::string& isStartingFunctionName() const { return mIsStartingFunction; } + const LLSD& isStartingParameters() const { return mIsStartingParameters; } + private: LLCommandId mIdentifier; bool mAvailableInToybox; - std::string mFunction; std::string mIcon; std::string mLabelRef; - LLSD mParameter; std::string mTooltipRef; + + std::string mExecuteFunction; + LLSD mExecuteParameters; + + std::string mIsEnabledFunction; + LLSD mIsEnabledParameters; + + std::string mIsRunningFunction; + LLSD mIsRunningParameters; + + std::string mIsStartingFunction; + LLSD mIsStartingParameters; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index efa077ffa1..a544aa9ec7 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -525,8 +525,8 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) if (!mReadOnly) { LLUICtrl::CommitCallbackParam cbParam; - cbParam.function_name = commandp->functionName(); - cbParam.parameter = commandp->parameter(); + cbParam.function_name = commandp->executeFunctionName(); + cbParam.parameter = commandp->executeParameters(); button->setCommitCallback(cbParam); button->setStartDragCallback(mStartDragItemCallback); button->setHandleDragCallback(mHandleDragItemCallback); diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 77bf7cace3..3a91ef490d 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -5,183 +5,183 @@ icon="Command_AboutLand_Icon" label_ref="Command_AboutLand_Label" tooltip_ref="Command_AboutLand_Tooltip" - function="Floater.ToolbarToggle" - parameter="about_land" + execute_function="Floater.ToolbarToggle" + execute_parameters="about_land" /> <command name="appearance" available_in_toybox="true" icon="Command_Appearance_Icon" label_ref="Command_Appearance_Label" tooltip_ref="Command_Appearance_Tooltip" - function="Floater.ToolbarToggle" - parameter="appearance" + execute_function="Floater.ToolbarToggle" + execute_parameters="appearance" /> <command name="avatar" available_in_toybox="true" icon="Command_Avatar_Icon" label_ref="Command_Avatar_Label" tooltip_ref="Command_Avatar_Tooltip" - function="Floater.ToolbarToggle" - parameter="avatar_picker" + execute_function="Floater.ToolbarToggle" + execute_parameters="avatar_picker" /> <command name="build" available_in_toybox="true" icon="Command_Build_Icon" label_ref="Command_Build_Label" tooltip_ref="Command_Build_Tooltip" - function="Floater.ToolbarToggle" - parameter="build" + execute_function="Floater.ToolbarToggle" + execute_parameters="build" /> <command name="chat" available_in_toybox="true" icon="Command_Chat_Icon" label_ref="Command_Chat_Label" tooltip_ref="Command_Chat_Tooltip" - function="Floater.ToolbarToggle" - parameter="chat_bar" + execute_function="Floater.ToolbarToggle" + execute_parameters="chat_bar" /> <command name="compass" available_in_toybox="false" icon="Command_Compass_Icon" label_ref="Command_Compass_Label" tooltip_ref="Command_Compass_Tooltip" - function="Floater.ToolbarToggle" - parameter="compass" + execute_function="Floater.ToolbarToggle" + execute_parameters="compass" /> <command name="destinations" available_in_toybox="true" icon="Command_Destinations_Icon" label_ref="Command_Destinations_Label" tooltip_ref="Command_Destinations_Tooltip" - function="Floater.ToolbarToggle" - parameter="destinations" + execute_function="Floater.ToolbarToggle" + execute_parameters="destinations" /> <command name="gestures" available_in_toybox="true" icon="Command_Gestures_Icon" label_ref="Command_Gestures_Label" tooltip_ref="Command_Gestures_Tooltip" - function="Floater.ToolbarToggle" - parameter="gestures" + execute_function="Floater.ToolbarToggle" + execute_parameters="gestures" /> <command name="howto" available_in_toybox="true" icon="Command_HowTo_Icon" label_ref="Command_HowTo_Label" tooltip_ref="Command_HowTo_Tooltip" - function="Floater.ToolbarToggle" - parameter="help_browser" + execute_function="Floater.ToolbarToggle" + execute_parameters="help_browser" /> <command name="inventory" available_in_toybox="true" icon="Command_Inventory_Icon" label_ref="Command_Inventory_Label" tooltip_ref="Command_Inventory_Tooltip" - function="Floater.ToolbarToggle" - parameter="inventory" + execute_function="Floater.ToolbarToggle" + execute_parameters="inventory" /> <command name="map" available_in_toybox="true" icon="Command_Map_Icon" label_ref="Command_Map_Label" tooltip_ref="Command_Map_Tooltip" - function="Floater.ToolbarToggle" - parameter="world_map" + execute_function="Floater.ToolbarToggle" + execute_parameters="world_map" /> <command name="marketplace" available_in_toybox="true" icon="Command_Marketplace_Icon" label_ref="Command_Marketplace_Label" tooltip_ref="Command_Marketplace_Tooltip" - function="Floater.ToolbarToggle" - parameter="marketplace" + execute_function="Floater.ToolbarToggle" + execute_parameters="marketplace" /> <command name="minimap" available_in_toybox="true" icon="Command_MiniMap_Icon" label_ref="Command_MiniMap_Label" tooltip_ref="Command_MiniMap_Tooltip" - function="Floater.ToolbarToggle" - parameter="mini_map" + execute_function="Floater.ToolbarToggle" + execute_parameters="mini_map" /> <command name="move" available_in_toybox="true" icon="Command_Move_Icon" label_ref="Command_Move_Label" tooltip_ref="Command_Move_Tooltip" - function="Floater.ToolbarToggle" - parameter="moveview" + execute_function="Floater.ToolbarToggle" + execute_parameters="moveview" /> <command name="people" available_in_toybox="true" icon="Command_People_Icon" label_ref="Command_People_Label" tooltip_ref="Command_People_Tooltip" - function="Floater.ToolbarToggle" - parameter="people" + execute_function="Floater.ToolbarToggle" + execute_parameters="people" /> <command name="places" available_in_toybox="true" icon="Command_Places_Icon" label_ref="Command_Places_Label" tooltip_ref="Command_Places_Tooltip" - function="Floater.ToolbarToggle" - parameter="places" + execute_function="Floater.ToolbarToggle" + execute_parameters="places" /> <command name="preferences" available_in_toybox="true" icon="Command_Preferences_Icon" label_ref="Command_Preferences_Label" tooltip_ref="Command_Preferences_Tooltip" - function="Floater.ToolbarToggle" - parameter="preferences" + execute_function="Floater.ToolbarToggle" + execute_parameters="preferences" /> <command name="profile" available_in_toybox="true" icon="Command_Profile_Icon" label_ref="Command_Profile_Label" tooltip_ref="Command_Profile_Tooltip" - function="Floater.ToolbarToggle" - parameter="my_profile" + execute_function="Floater.ToolbarToggle" + execute_parameters="my_profile" /> <command name="search" available_in_toybox="true" icon="Command_Search_Icon" label_ref="Command_Search_Label" tooltip_ref="Command_Search_Tooltip" - function="Floater.ToolbarToggle" - parameter="search" + execute_function="Floater.ToolbarToggle" + execute_parameters="search" /> <command name="snapshot" available_in_toybox="true" icon="Command_Snapshot_Icon" label_ref="Command_Snapshot_Label" tooltip_ref="Command_Snapshot_Tooltip" - function="Floater.ToolbarToggle" - parameter="snapshot" + execute_function="Floater.ToolbarToggle" + execute_parameters="snapshot" /> <command name="speak" available_in_toybox="true" icon="Command_Speak_Icon" label_ref="Command_Speak_Label" tooltip_ref="Command_Speak_Tooltip" - function="Floater.ToolbarToggle" - parameter="speak" + execute_function="Floater.ToolbarToggle" + execute_parameters="speak" /> <command name="view" available_in_toybox="true" icon="Command_View_Icon" label_ref="Command_View_Label" tooltip_ref="Command_View_Tooltip" - function="Floater.ToolbarToggle" - parameter="camera" + execute_function="Floater.ToolbarToggle" + execute_parameters="camera" /> <command name="voice" available_in_toybox="true" icon="Command_Voice_Icon" label_ref="Command_Voice_Label" tooltip_ref="Command_Voice_Tooltip" - function="Floater.ToolbarToggle" - parameter="voice_controls" + execute_function="Floater.ToolbarToggle" + execute_parameters="voice_controls" /> </commands> diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 7a6afb4e33..cf22e071aa 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -61,8 +61,6 @@ 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(); @@ -97,46 +95,26 @@ BOOL LLFloaterToybox::postBuild() return TRUE; } -void LLFloaterToybox::onOpen(const LLSD& key) -{ - -} - -BOOL LLFloaterToybox::canClose() -{ - return TRUE; -} - -void LLFloaterToybox::onClose(bool app_quitting) -{ - -} - void LLFloaterToybox::draw() { llassert(gToolBarView != NULL); - LLCommandManager& cmdMgr = LLCommandManager::instance(); + const command_id_list_t& command_list = mToolBar->getCommandsList(); - for (U32 i = 0; i < cmdMgr.commandCount(); i++) + for (command_id_list_t::const_iterator it = command_list.begin(); it != command_list.end(); ++it) { - LLCommand * command = cmdMgr.getCommand(i); + const LLCommandId& id = *it; - if (command->availableInToybox()) - { - mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); - } + const bool commandOnToolbar = gToolBarView->hasCommand(id); + mToolBar->enableCommand(id, !commandOnToolbar); } LLFloater::draw(); } -void LLFloaterToybox::onFocusReceived() -{ -} - void LLFloaterToybox::onBtnRestoreDefaults() { + LLToolBarView::loadDefaultToolbars(); } diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h index 3574e060bf..f7245506c5 100644 --- a/indra/newview/llfloatertoybox.h +++ b/indra/newview/llfloatertoybox.h @@ -42,11 +42,7 @@ public: // virtuals BOOL postBuild(); - void onOpen(const LLSD& key); - BOOL canClose(); - void onClose(bool app_quitting); void draw(); - void onFocusReceived(); protected: void onBtnRestoreDefaults(); |