diff options
-rw-r--r-- | indra/llui/llcommandmanager.h | 16 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 79 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 23 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_test_toolbar.xml | 38 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_toolbar_view.xml | 25 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/toolbar.xml | 2 |
7 files changed, 106 insertions, 84 deletions
diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 7ed8785f17..8435d915f3 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -41,10 +41,22 @@ public: friend class LLCommand; friend class LLCommandManager; + struct Params : public LLInitParam::Block<Params> + { + Mandatory<std::string> name; + + Params() + : name("name") + {} + }; + LLCommandId(const std::string& name) : mName(name) - { - } + {} + + LLCommandId(const Params& p) + : mName(p.name) + {} const std::string& name() const { return mName; } diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index bd45cf4656..2fb9f249d4 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -74,7 +74,7 @@ namespace LLInitParam LLToolBar::Params::Params() : button_display_mode("button_display_mode"), - buttons("button"), + commands("command"), side("side", SIDE_TOP), button_icon("button_icon"), button_icon_and_text("button_icon_and_text"), @@ -187,17 +187,13 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); - BOOST_FOREACH (LLToolBarButton::Params button_p, p.buttons) + BOOST_FOREACH (const LLCommandId::Params& command_id, p.commands) { - button_p.fillFrom(mButtonParams[mButtonType]); - LLToolBarButton* buttonp = LLUICtrlFactory::create<LLToolBarButton>(button_p); - - mButtons.push_back(buttonp); - mButtonCommands.push_back(LLCommandId::null); - mButtonPanel->addChild(buttonp); - - mNeedsLayout = true; + mButtonCommands.push_back(command_id); } + createButtons(); + + mNeedsLayout = true; } bool LLToolBar::addCommand(const LLCommandId& commandId) @@ -206,26 +202,8 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) bool add_command = (command != NULL); - // - // Init basic toolbar button params - // - if (add_command) - { - LLToolBarButton::Params button_p(mButtonParams[mButtonType]); - button_p.name = commandId.name(); - button_p.label = LLTrans::getString(command->labelRef()); - button_p.tool_tip = LLTrans::getString(command->tooltipRef()); - - // - // Add it to the list of buttons - // - LLToolBarButton * toolbar_button = LLUICtrlFactory::create<LLToolBarButton>(button_p); - mButtons.push_back(toolbar_button); - mButtonCommands.push_back(commandId); - mButtonPanel->addChild(toolbar_button); - - mNeedsLayout = true; - } + mButtonCommands.push_back(commandId); + createButtons(); return add_command; } @@ -320,7 +298,10 @@ void LLToolBar::onSettingEnable(const LLSD& userdata) mButtonType = BTNTYPE_ICONS_ONLY; } - mNeedsLayout |= (current_button_type != mButtonType); + if(current_button_type != mButtonType) + { + createButtons(); + } } void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth) @@ -387,8 +368,8 @@ void LLToolBar::updateLayoutAsNeeded() std::vector<LLToolBarButton*> buttons_in_row; - BOOST_FOREACH(LLToolBarButton* button, mButtons) - { + BOOST_FOREACH(LLToolBarButton* button, mButtons) + { button->reshape(mMinButtonWidth, mButtonHeight); button->autoResize(); @@ -421,8 +402,8 @@ void LLToolBar::updateLayoutAsNeeded() max_row_girth = 0; } - LLRect button_rect; - if (orientation == LLLayoutStack::HORIZONTAL) + LLRect button_rect; + if (orientation == LLLayoutStack::HORIZONTAL) { button_rect.setLeftTopAndSize(cur_start, panel_rect.mTop - cur_row, button_clamped_width, button->getRect().getHeight()); } @@ -467,7 +448,7 @@ void LLToolBar::updateLayoutAsNeeded() reshape(total_girth, getRect().getHeight()); mButtonPanel->reshape(total_girth, max_row_length); - } + } // re-center toolbar buttons mCenteringStack->updateLayout(); @@ -489,3 +470,29 @@ void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) mNeedsLayout = true; } +void LLToolBar::createButtons() +{ + BOOST_FOREACH(LLToolBarButton* button, mButtons) + { + delete button; + } + mButtons.clear(); + + BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) + { + LLCommand* commandp = LLCommandManager::instance().getCommand(command_id); + if (!commandp) continue; + + LLToolBarButton::Params button_p; + button_p.label = LLTrans::getString(commandp->labelRef()); + button_p.image_overlay = LLUI::getUIImage(commandp->icon()); + button_p.overwriteFrom(mButtonParams[mButtonType]); + LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); + + mButtons.push_back(button); + mButtonPanel->addChild(button); + } + + mNeedsLayout = true; +} + diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 657e928319..75ae499a3d 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -32,9 +32,7 @@ #include "llcommandmanager.h" #include "lllayoutstack.h" #include "lluictrl.h" - - -class LLCommand; +#include "llcommandmanager.h" class LLToolBarButton : public LLButton @@ -110,7 +108,7 @@ public: pad_bottom, pad_between; // get rid of this - Multiple<LLToolBarButton::Params> buttons; + Multiple<LLCommandId::Params> commands; Optional<LLPanel::Params> button_panel; @@ -136,6 +134,7 @@ protected: private: void createContextMenu(); void updateLayoutAsNeeded(); + void createButtons(); void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 8f2194e652..be68c2873e 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -759,4 +759,27 @@ with the same filename but different name <texture name="Yellow_Gradient" file_name="windows/yellow_gradient.png"/> <texture name="Popup_Caution" file_name="icons/pop_up_caution.png"/> <texture name="Camera_Drag_Dot" file_name="world/CameraDragDot.png"/> + + <texture name="Command_Avatar_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Build_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Chat_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Compass_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Gestures_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_HowTo_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Landmarks_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Map_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_MiniMap_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Move_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_MyLand_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_MyStuff_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_People_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Places_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Search_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Settings_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Shop_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Snapshot_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Speak_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_Upload_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + <texture name="Command_View_Icon" file_name="taskpanel/TabIcon_Home_Off.png"/> + </textures> diff --git a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml index b58c006b3f..fbfbe51a69 100644 --- a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml +++ b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml @@ -16,14 +16,9 @@ min_button_width="0" max_button_width="100" side="top"> - <button auto_resize="true" - use_ellipses="true" - label="Button"/> - <button auto_resize="true" - label="Button with long label"/> - <button auto_resize="true" - use_ellipses="true" - label="Button with longest label of all"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> <toolbar name="test_toolbar_left" follows="left|bottom|top" @@ -33,12 +28,9 @@ top="70" min_button_width="100" side="left"> - <button height="30" - label="Button"/> - <button height="50" - label="Button with long label"/> - <button height="60" - label="Button with longest label of all"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> <toolbar name="test_toolbar_right" follows="right|bottom|top" @@ -47,12 +39,9 @@ right="500" top="70" side="right"> - <button auto_resize="true" - label="Button 1"/> - <button auto_resize="true" - label="Button with long label"/> - <button auto_resize="true" - label="Button with longest label of all"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> <toolbar name="test_toolbar_bottom" follows="left|right|bottom" @@ -62,11 +51,8 @@ bottom="500" min_button_width="100" side="bottom"> - <button auto_resize="true" - label="Button"/> - <button auto_resize="true" - label="Button with long label"/> - <button auto_resize="true" - label="Button with longest label of all"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> </floater> diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index b24f5c3347..23ea516b86 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -47,11 +47,9 @@ top="0" side="left" button_display_mode="icons_only"> - <button name="button1" label="Left Toolbar"/> - <button name="button2" label="Left Toolbar"/> - <button name="button3" label="Left Toolbar"/> - <button name="button4" label="Left Toolbar"/> - <button name="button5" label="Left Toolbar"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> </layout_panel> <layout_panel name="non_toolbar_panel" @@ -74,11 +72,9 @@ top="0" side="right" button_display_mode="icons_only"> - <button name="button1" label="Right Toolbar"/> - <button name="button2" label="Right Toolbar"/> - <button name="button3" label="Right Toolbar"/> - <button name="button4" label="Right Toolbar"/> - <button name="button5" label="Right Toolbar"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> </layout_panel> </layout_stack> @@ -100,12 +96,9 @@ follows="left|right|bottom" button_display_mode="icons_with_text" visible="true"> - <button name="button1" label="Bottom toolbar"/> - <button name="button2" label="Bottom toolbar"/> - <button name="button3" label="Bottom toolbar"/> - <button name="button4" label="Bottom toolbar"/> - <button name="button5" label="Bottom toolbar"/> - <button name="button6" label="Bottom toolbar"/> + <command name="avatar"/> + <command name="build"/> + <command name="chat"/> </toolbar> </layout_panel> </layout_stack> diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 29b5d02299..32bc88cc9a 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -13,9 +13,11 @@ background_opaque="true"/> <button_icon_and_text follows="left|top" chrome="true" + image_overlay_alignment="left" use_ellipses="true" auto_resize="true"/> <button_icon follows="left|top" + label="" chrome="true" use_ellipses="true" auto_resize="true"/> |