From 305b65f6f600b81de9a78e1246d2a5353cc3189b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 21 Sep 2011 12:11:23 -0700 Subject: EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars EXP-1210 FIX -- Implement new toybox floater window EXP-1231 FIX -- Add menu option to toggle the toybox floater on and off * Basic toybox floater implemented as its own class * Toybox is available through "Me -> Toolbars..." menu option or ctrl-T shortcut * Toolbars now have "side" type rather than simple orientation, as well as button state for "icons only" or "icons with text". Reviewed by Richard --- indra/newview/llfloatertoybox.cpp | 103 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 indra/newview/llfloatertoybox.cpp (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp new file mode 100644 index 0000000000..b4fb2e45ab --- /dev/null +++ b/indra/newview/llfloatertoybox.cpp @@ -0,0 +1,103 @@ +/** + * @file llfloatertoybox.cpp + * @brief The toybox for flexibilizing the UI. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatertoybox.h" + +#include "llbutton.h" +#include "llpanel.h" + + +LLFloaterToybox::LLFloaterToybox(const LLSD& key) + : LLFloater(key) + , mBtnRestoreDefaults(NULL) +{ + mCommitCallbackRegistrar.add("Toybox.RestoreDefaults", boost::bind(&LLFloaterToybox::onBtnRestoreDefaults, this)); +} + +LLFloaterToybox::~LLFloaterToybox() +{ +} + +BOOL LLFloaterToybox::postBuild() +{ + center(); + + mBtnRestoreDefaults = getChild("btn_restore_defaults"); + + // + // Create Buttons + // +/* + LLToyboxButtons::load(); + + for (size_t i = 0; i < LLToyboxButtons::buttonCount(); i++) + { + LLToyboxButton * button = LLToyboxButtons::get(i); + + // Panel opacity depends on whether or not button position is established + LLPanel * buttonPanel = createPanelForButton(button); + + mToolBar->add(buttonPanel); + } +*/ + + return TRUE; +} + +void LLFloaterToybox::onOpen(const LLSD& key) +{ + +} + +BOOL LLFloaterToybox::canClose() +{ + return TRUE; +} + +void LLFloaterToybox::onClose(bool app_quitting) +{ + +} + +void LLFloaterToybox::draw() +{ + LLFloater::draw(); +} + +void LLFloaterToybox::onFocusReceived() +{ + +} + +void LLFloaterToybox::onBtnRestoreDefaults() +{ + +} + + +// eof -- cgit v1.2.3 From 565483ee1f2ea7b8d525c6d89700452216481c5e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 22 Sep 2011 15:43:08 -0700 Subject: 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 PROGRESS -- Populate the toybox floater window with all FUI toolbar buttons EXP-1236 FIX -- The toybox floater should remember its position for the user * Basic addCommand function to the LLToolBar. Need proper implementation. * Added map for faster lookup of commands * Toybox now adds commands to its toolbar for basic button setup Reviewed by Richard. --- indra/newview/llfloatertoybox.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index b4fb2e45ab..eaaaeb3357 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -29,12 +29,15 @@ #include "llfloatertoybox.h" #include "llbutton.h" +#include "llcommandmanager.h" #include "llpanel.h" +#include "lltoolbar.h" LLFloaterToybox::LLFloaterToybox(const LLSD& key) : LLFloater(key) , mBtnRestoreDefaults(NULL) + , mToolBar(NULL) { mCommitCallbackRegistrar.add("Toybox.RestoreDefaults", boost::bind(&LLFloaterToybox::onBtnRestoreDefaults, this)); } @@ -48,23 +51,20 @@ BOOL LLFloaterToybox::postBuild() center(); mBtnRestoreDefaults = getChild("btn_restore_defaults"); + mToolBar = getChild("toybox_toolbar"); // // Create Buttons // -/* - LLToyboxButtons::load(); - for (size_t i = 0; i < LLToyboxButtons::buttonCount(); i++) - { - LLToyboxButton * button = LLToyboxButtons::get(i); + LLCommandManager& cmdMgr = LLCommandManager::instance(); - // Panel opacity depends on whether or not button position is established - LLPanel * buttonPanel = createPanelForButton(button); + for (U32 i = 0; i < cmdMgr.commandCount(); i++) + { + LLCommand * command = cmdMgr.getCommand(i); - mToolBar->add(buttonPanel); + mToolBar->addCommand(command); } -*/ return TRUE; } -- cgit v1.2.3 From 53a486649381af53d21de28aced388bc2aacac0f Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 26 Sep 2011 17:38:10 -0700 Subject: EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars * Command buttons are now enabled/disabled in toybox based on whether or not the LLToolBarView has them anywhere. * Commands now have argument to specify whether or not they should be in the toybox. * LLCommandId is now used a universal reference for commands. Reviewed by Richard. --- indra/newview/llfloatertoybox.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index eaaaeb3357..beb928ea36 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -32,6 +32,7 @@ #include "llcommandmanager.h" #include "llpanel.h" #include "lltoolbar.h" +#include "lltoolbarview.h" LLFloaterToybox::LLFloaterToybox(const LLSD& key) @@ -63,7 +64,13 @@ BOOL LLFloaterToybox::postBuild() { LLCommand * command = cmdMgr.getCommand(i); - mToolBar->addCommand(command); + if (command->availableInToybox()) + { + mToolBar->addCommand(command->id()); + + llassert(gToolBarView != NULL); + mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); + } } return TRUE; -- cgit v1.2.3 From fdf042bdb9aeefa209694e04d4012a3a1f911a52 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 28 Sep 2011 16:54:34 -0700 Subject: 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 --- indra/newview/llfloatertoybox.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') 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() { - } -- cgit v1.2.3 From cf4f436e5bda78096c945b1de0e0f6c923a9152d Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 29 Sep 2011 15:25:24 -0700 Subject: * Updated toybox so it will always display buttons in alphabetical order based on the localized button labels. --- indra/newview/llfloatertoybox.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index c3fa322f85..d7f114043d 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -33,6 +33,7 @@ #include "llpanel.h" #include "lltoolbar.h" #include "lltoolbarview.h" +#include "lltrans.h" LLFloaterToybox::LLFloaterToybox(const LLSD& key) @@ -47,6 +48,14 @@ LLFloaterToybox::~LLFloaterToybox() { } +bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2) +{ + std::string lab1 = LLTrans::getString(cmd1->labelRef()); + std::string lab2 = LLTrans::getString(cmd2->labelRef()); + + return (lab1 < lab2); +} + BOOL LLFloaterToybox::postBuild() { center(); @@ -54,11 +63,13 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); + LLCommandManager& cmdMgr = LLCommandManager::instance(); + // - // Create Buttons + // Sort commands by localized labels so they will appear alphabetized in all languages // - LLCommandManager& cmdMgr = LLCommandManager::instance(); + std::list alphabetized_commands; for (U32 i = 0; i < cmdMgr.commandCount(); i++) { @@ -66,10 +77,21 @@ BOOL LLFloaterToybox::postBuild() if (command->availableInToybox()) { - mToolBar->addCommand(command->id()); + alphabetized_commands.push_back(command); } } + alphabetized_commands.sort(compare_localized_command_labels); + + // + // Create Buttons + // + + for (std::list::iterator it = alphabetized_commands.begin(); it != alphabetized_commands.end(); ++it) + { + mToolBar->addCommand((*it)->id()); + } + return TRUE; } -- cgit v1.2.3 From cdc80b1dd34ef533d7500bf1ab89abf3c5d81bb3 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 30 Sep 2011 15:25:02 -0700 Subject: EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars EXP-1268 FIX -- The "Restore Defaults" button should reset the left/right/bottom toolbars to their default states * LLToolBarView::loadDefaultToolbars now a static function * Toybox button callback hooked up to properly restore defaults Reviewed by Merov --- indra/newview/llfloatertoybox.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index d7f114043d..7a6afb4e33 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -61,6 +61,8 @@ BOOL LLFloaterToybox::postBuild() center(); mBtnRestoreDefaults = getChild("btn_restore_defaults"); + mBtnRestoreDefaults->setCommitCallback(boost::bind(&LLToolBarView::loadDefaultToolbars)); + mToolBar = getChild("toybox_toolbar"); LLCommandManager& cmdMgr = LLCommandManager::instance(); -- cgit v1.2.3 From db2e763ff0537785336a330d03bb9307478cb79a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 14:09:03 -0700 Subject: * Modified commands to add functions for is_enabled, is_running and is_starting, currently not hooked to any functionality. --- indra/newview/llfloatertoybox.cpp | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') 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("btn_restore_defaults"); - mBtnRestoreDefaults->setCommitCallback(boost::bind(&LLToolBarView::loadDefaultToolbars)); - mToolBar = getChild("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(); } -- cgit v1.2.3 From 64d005bfed6c5adcd29df3ae0774747480a0d839 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Oct 2011 17:04:07 -0700 Subject: EXP-1286 : Add DaD to toybox --- indra/newview/llfloatertoybox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index cf22e071aa..58bb417b71 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -62,7 +62,10 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); - + mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); + mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); + mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + LLCommandManager& cmdMgr = LLCommandManager::instance(); // -- cgit v1.2.3 From feabe29f356ca2bae5275a5cb0d772614166d2c5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Oct 2011 18:30:57 -0700 Subject: EXP-1300 : Completed the drawing of drop zones on toolbars when dragging tools --- indra/newview/llfloatertoybox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 58bb417b71..609041803a 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -62,9 +62,9 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); - mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); - mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); - mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); + mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4)); + mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4)); LLCommandManager& cmdMgr = LLCommandManager::instance(); -- cgit v1.2.3 From 0526d673093b2279777dc8be5aae9cc33cb1c822 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 15:31:25 -0700 Subject: EXP-1312 FIX Floaters should appear in region not covered by toolbars moved floater snap region to middle of toolbars and constrained floaters to that snap region also made toybox floater pass all drag and drop events along to toolbar --- indra/newview/llfloatertoybox.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 609041803a..fa60022911 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -120,5 +120,16 @@ void LLFloaterToybox::onBtnRestoreDefaults() LLToolBarView::loadDefaultToolbars(); } +BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + S32 local_x = x - mToolBar->getRect().mLeft; + S32 local_y = y - mToolBar->getRect().mBottom; + return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); +} + // eof -- cgit v1.2.3 From f9e900f5ac9002f5ef3b44b02ac300971288e89b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 11 Oct 2011 17:36:23 -0700 Subject: * New floater positioning code. Better than what's checked in but not great. * Floater updates for positioning and to revert some earlier string changes. --- indra/newview/llfloatertoybox.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index fa60022911..84881655f8 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -58,8 +58,6 @@ bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2) BOOL LLFloaterToybox::postBuild() { - center(); - mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); -- cgit v1.2.3 From 45a316831636043663972bdf83adbefb345549de Mon Sep 17 00:00:00 2001 From: callum Date: Wed, 12 Oct 2011 16:08:53 -0700 Subject: EXP-1337 FIX Add Confirmation dialog to "Restore Defaults" in the Toybox Reviewed by Leslie --- indra/newview/llfloatertoybox.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatertoybox.cpp') diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 84881655f8..b4c9894271 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -30,12 +30,13 @@ #include "llbutton.h" #include "llcommandmanager.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" #include "llpanel.h" #include "lltoolbar.h" #include "lltoolbarview.h" #include "lltrans.h" - LLFloaterToybox::LLFloaterToybox(const LLSD& key) : LLFloater(key) , mBtnRestoreDefaults(NULL) @@ -113,9 +114,21 @@ void LLFloaterToybox::draw() LLFloater::draw(); } +static bool finish_restore_toybox(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 0) + { + LLToolBarView::loadDefaultToolbars(); + } + return false; +} +static LLNotificationFunctorRegistration finish_restore_toybox_reg("ConfirmRestoreToybox", finish_restore_toybox); + void LLFloaterToybox::onBtnRestoreDefaults() { - LLToolBarView::loadDefaultToolbars(); + LLNotificationsUtil::add("ConfirmRestoreToybox"); } BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, -- cgit v1.2.3