diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.cpp | 138 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.h | 97 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.cpp | 11 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.h | 1 | ||||
-rw-r--r-- | indra/llui/lltoolbarview.cpp | 74 | ||||
-rw-r--r-- | indra/llui/lltoolbarview.h | 52 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 5 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 1 | ||||
-rw-r--r-- | indra/newview/app_settings/commands.xml | 17 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 10 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/main_view.xml | 35 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 8 |
15 files changed, 466 insertions, 1 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index cf3f9b1a7b..4212812558 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -35,6 +35,7 @@ set(llui_SOURCE_FILES llcheckboxctrl.cpp llclipboard.cpp llcombobox.cpp + llcommandmanager.cpp llconsole.cpp llcontainerview.cpp llctrlselectioninterface.cpp @@ -100,6 +101,7 @@ set(llui_SOURCE_FILES lltransutil.cpp lltoggleablemenu.cpp lltoolbar.cpp + lltoolbarview.cpp lltooltip.cpp llui.cpp lluicolortable.cpp @@ -132,6 +134,7 @@ set(llui_HEADER_FILES llcheckboxctrl.h llclipboard.h llcombobox.h + llcommandmanager.h llconsole.h llcontainerview.h llctrlselectioninterface.h @@ -202,6 +205,7 @@ set(llui_HEADER_FILES lltimectrl.h lltoggleablemenu.h lltoolbar.h + lltoolbarview.h lltooltip.h lltransutil.h lluicolortable.h diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp new file mode 100644 index 0000000000..306b357d6a --- /dev/null +++ b/indra/llui/llcommandmanager.cpp @@ -0,0 +1,138 @@ +/** + * @file llcommandmanager.cpp + * @brief LLCommandManager class + * + * $LicenseInfo:firstyear=2001&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$ + */ + +// A control that displays the name of the chosen item, which when +// clicked shows a scrolling box of options. + +#include "linden_common.h" + +#include "llcommandmanager.h" +#include "lldir.h" +#include "llerror.h" +#include "llxuiparser.h" + +#include <boost/foreach.hpp> + + +// +// LLCommand class +// + +LLCommand::Params::Params() + : function("function") + , icon("icon") + , label_ref("label_ref") + , name("name") + , param("param") + , tooltip_ref("tooltip_ref") +{ +} + +LLCommand::LLCommand(const LLCommand::Params& p) + : mFunction(p.function) + , mIcon(p.icon) + , mLabelRef(p.label_ref) + , mName(p.name) + , mParam(p.param) + , mTooltipRef(p.tooltip_ref) +{ +} + + +// +// LLCommandManager class +// + +LLCommandManager::LLCommandManager() +{ +} + +LLCommandManager::~LLCommandManager() +{ +} + +U32 LLCommandManager::count() const +{ + return mCommands.size(); +} + +LLCommand * LLCommandManager::getCommand(U32 commandIndex) +{ + return mCommands[commandIndex]; +} + +LLCommand * LLCommandManager::getCommand(const std::string& commandName) +{ + LLCommand * command_name_match = NULL; + + for (CommandVector::iterator it = mCommands.begin(); it != mCommands.end(); ++it) + { + LLCommand * command = *it; + + if (command->name() == commandName) + { + command_name_match = command; + break; + } + } + + return command_name_match; +} + +//static +bool LLCommandManager::load() +{ + LLCommandManager& mgr = LLCommandManager::instance(); + + std::string commands_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "commands.xml"); + + LLCommandManager::Params commandsParams; + + LLSimpleXUIParser parser; + + if (!parser.readXUI(commands_file, commandsParams)) + { + llerrs << "Unable to load xml file: " << commands_file << llendl; + return false; + } + + if (!commandsParams.validateBlock()) + { + llerrs << "Unable to validate commands param block from file: " << commands_file << llendl; + return false; + } + + BOOST_FOREACH(LLCommand::Params& commandParams, commandsParams.commands) + { + LLCommand * command = new LLCommand(commandParams); + + mgr.mCommands.push_back(command); + + llinfos << "Successfully loaded command: " << command->name() << llendl; + } + + return true; +} diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h new file mode 100644 index 0000000000..4f3c9b2ada --- /dev/null +++ b/indra/llui/llcommandmanager.h @@ -0,0 +1,97 @@ +/** + * @file llcommandmanager.h + * @brief LLCommandManager class to hold commands + * + * $LicenseInfo:firstyear=2001&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$ + */ + +#ifndef LL_COMMANDMANAGER_H +#define LL_COMMANDMANAGER_H + +#include "llinitparam.h" +#include "llsingleton.h" + + +class LLCommand +{ +public: + struct Params : public LLInitParam::Block<Params> + { + Mandatory<std::string> function; + Mandatory<std::string> icon; + Mandatory<std::string> label_ref; + Mandatory<std::string> name; + Optional<std::string> param; + Mandatory<std::string> tooltip_ref; + + Params(); + }; + + LLCommand(const LLCommand::Params& p); + + const std::string& functionName() const { return mFunction; } + const std::string& icon() const { return mIcon; } + const std::string& labelRef() const { return mLabelRef; } + const std::string& name() const { return mName; } + const std::string& param() const { return mParam; } + const std::string& tooltipRef() const { return mTooltipRef; } + +private: + std::string mFunction; + std::string mIcon; + std::string mLabelRef; + std::string mName; + std::string mParam; + std::string mTooltipRef; +}; + + +class LLCommandManager +: public LLSingleton<LLCommandManager> +{ +public: + struct Params : public LLInitParam::Block<Params> + { + Multiple< LLCommand::Params, AtLeast<1> > commands; + + Params() + : commands("command") + { + } + }; + + LLCommandManager(); + ~LLCommandManager(); + + U32 count() const; + LLCommand * getCommand(U32 commandIndex); + LLCommand * getCommand(const std::string& commandName); + + static bool load(); + +private: + typedef std::vector<LLCommand *> CommandVector; + CommandVector mCommands; +}; + + +#endif // LL_COMMANDMANAGER_H diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index fc7dcfcc4e..bc740dde17 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -453,6 +453,17 @@ void LLFloaterReg::toggleFloaterInstance(const LLSD& sdname) } //static +void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) +{ + // Do some extra logic here for 3-state toolbar floater toggling madness :) + + LLSD key; + std::string name = sdname.asString(); + parse_name_key(name, key); + toggleInstance(name, key); +} + +//static bool LLFloaterReg::floaterInstanceVisible(const LLSD& sdname) { LLSD key; diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index a2027a77a0..6239d98a7d 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -127,6 +127,7 @@ public: static void showFloaterInstance(const LLSD& sdname); static void hideFloaterInstance(const LLSD& sdname); static void toggleFloaterInstance(const LLSD& sdname); + static void toggleToolbarFloaterInstance(const LLSD& sdname); static bool floaterInstanceVisible(const LLSD& sdname); static bool floaterInstanceMinimized(const LLSD& sdname); diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp new file mode 100644 index 0000000000..40d1ac3418 --- /dev/null +++ b/indra/llui/lltoolbarview.cpp @@ -0,0 +1,74 @@ +/** + * @file lltoolbarview.cpp + * @author Merov Linden + * @brief User customizable toolbar class + * + * $LicenseInfo:firstyear=2011&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 "linden_common.h" + +#include "lltoolbarview.h" +#include "llbutton.h" + +LLToolBarView* gToolBarView = NULL; + +static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view"); + +LLToolBarView::LLToolBarView(const Params& p) +: LLUICtrl(p) +{ +} + +BOOL LLToolBarView::postBuild() +{ + LLButton* btn = getChild<LLButton>("color_pipette"); + btn->setVisible(TRUE); + LLRect ctrl_rect = getRect(); + LLRect btn_rect = btn->getRect(); + llinfos << "Merov debug : control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl; + llinfos << "Merov debug : button rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl; + btn_rect.mLeft = 0; + btn_rect.mTop = ctrl_rect.getHeight(); + btn_rect.mRight = 28; + btn_rect.mBottom = btn_rect.mTop - 28; + btn->setRect(btn_rect); + btn_rect = btn->getRect(); + llinfos << "Merov debug : button rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl; + return TRUE; +} + +void LLToolBarView::draw() +{ + LLButton* btn = getChild<LLButton>("color_pipette"); + btn->setVisible(TRUE); + static bool debug_print = true; + if (debug_print) + { + LLRect ctrl_rect = getRect(); + LLRect btn_rect = btn->getRect(); + llinfos << "Merov debug : draw control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl; + llinfos << "Merov debug : draw button rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl; + debug_print = false; + } + LLUICtrl::draw(); +} diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h new file mode 100644 index 0000000000..0bd0070ab7 --- /dev/null +++ b/indra/llui/lltoolbarview.h @@ -0,0 +1,52 @@ +/** + * @file lltoolbarview.h + * @author Merov Linden + * @brief User customizable toolbar class + * + * $LicenseInfo:firstyear=2011&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$ + */ + +#ifndef LL_LLTOOLBARVIEW_H +#define LL_LLTOOLBARVIEW_H + +#include "lluictrl.h" + +// Parent of all LLToolBar + +class LLToolBarView : public LLUICtrl +{ +public: + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {}; + void draw(); + /*virtual*/ BOOL postBuild(); + +protected: + friend class LLUICtrlFactory; + LLToolBarView(const Params&); + +private: + LLHandle<LLView> mSnapView; +}; + +extern LLToolBarView* gToolBarView; + +#endif // LL_LLTOOLBARVIEW_H diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 593354ee9b..1bc575438c 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -41,6 +41,7 @@ #include "llgl.h" // Project includes +#include "llcommandmanager.h" #include "llcontrol.h" #include "llui.h" #include "lluicolortable.h" @@ -1617,6 +1618,7 @@ void LLUI::initClass(const settings_map_t& settings, // Callbacks for associating controls with floater visibilty: reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleFloaterInstance, _2)); + reg.add("Floater.ToolbarToggle", boost::bind(&LLFloaterReg::toggleToolbarFloaterInstance, _2)); reg.add("Floater.Show", boost::bind(&LLFloaterReg::showFloaterInstance, _2)); reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideFloaterInstance, _2)); reg.add("Floater.InitToVisibilityControl", boost::bind(&LLFloaterReg::initUICtrlToFloaterVisibilityControl, _1, _2)); @@ -1635,6 +1637,9 @@ void LLUI::initClass(const settings_map_t& settings, // Used by menus along with Floater.Toggle to display visibility as a checkmark LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::floaterInstanceVisible, _2)); + + // Parse the master list of commands + LLCommandManager::load(); } void LLUI::cleanupClass() diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 18e092eb4a..597a1dd603 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1409,6 +1409,7 @@ list(APPEND viewer_SOURCE_FILES ${viewer_XUI_FILES}) set(viewer_APPSETTINGS_FILES app_settings/anim.ini app_settings/cmd_line.xml + app_settings/commands.xml app_settings/grass.xml app_settings/high_graphics.xml app_settings/ignorable_dialogs.xml diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml new file mode 100644 index 0000000000..8e45e866ca --- /dev/null +++ b/indra/newview/app_settings/commands.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<commands> + <command name="avatar" + icon="Command_Avatar_Icon" + label_ref="Command_Avatar_Label" + tooltip_ref="Command_Avatar_Tooltip" + function="Floater.ToolbarToggle" + param="avatar" + /> + <command name="places" + icon="Command_Places_Icon" + label_ref="Command_Places_Label" + tooltip_ref="Command_Places_Tooltip" + function="Floater.ToolbarToggle" + param="places" + /> +</commands> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4e48a9e3f7..cc9e17409f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2652,6 +2652,17 @@ <key>Value</key> <integer>-1</integer> </map> + <key>DebugToolbarFUI</key> + <map> + <key>Comment</key> + <string>Turn on the FUI Toolbars</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>DebugViews</key> <map> <key>Comment</key> diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 114a422c1d..1055fd373b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -76,6 +76,7 @@ #include "lltimer.h" #include "timing.h" #include "llviewermenu.h" +#include "lltoolbarview.h" #include "lltooltip.h" #include "llmediaentry.h" #include "llurldispatcher.h" @@ -1778,6 +1779,14 @@ void LLViewerWindow::initBase() mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle(); mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle(); + // Update the toolbar global holder + // *TODO: Eventually, suppress the existence of this debug setting and turn toolbar FUI on permanently + if (gSavedSettings.getBOOL("DebugToolbarFUI")) + { + gToolBarView = main_view->getChild<LLToolBarView>("Toolbar View"); + } + + // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild<LLFloaterView>("Floater View"); gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle()); @@ -1981,6 +1990,7 @@ void LLViewerWindow::shutdownViews() gIMMgr = NULL; gToolTipView = NULL; + gToolBarView = NULL; gFloaterView = NULL; gMorphView = NULL; diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 4d83ec2902..598e39730c 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -125,6 +125,9 @@ with the same filename but different name <texture name="Checkbox_Press" file_name="widgets/Checkbox_Press.png" preload="true" /> <texture name="Check_Mark" file_name="icons/check_mark" preload="true" /> + <texture name="Command_Avatar_Icon" file_name="icons/SL_Logo.png" preload="true" /> + <texture name="Command_Places_Icon" file_name="icons/SL_Logo.png" preload="true" /> + <texture name="ComboButton_Disabled" file_name="widgets/ComboButton_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_UpSelected" file_name="widgets/ComboButton_UpSelected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index a7d1aa963c..54badb1386 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -162,6 +162,41 @@ top="0" width="1024"/> </panel> + + <panel follows="left|top" + layout="topleft" + height="500" + left="0" + mouse_opaque="false" + name="toolbar_view_holder" + tab_stop="false" + top="0" + visible="true" + width="1024"> + <toolbar_view follows="left|top" + layout="topleft" + height="100" + left="100" + mouse_opaque="false" + name="Toolbar View" + tab_stop="false" + top="100" + visible="true" + width="512"> + <button + follows="left|top" + height="28" + image_selected="eye_button_active.tga" + image_unselected="eye_button_inactive.tga" + layout="topleft" + top="0" + left="0" + name="color_pipette" + width="28" + visible="true" /> + </toolbar_view> + </panel> + </layout_panel> </layout_stack> <panel mouse_opaque="false" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c0154ae9b3..3b986664db 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3651,4 +3651,10 @@ Try enclosing path to the editor with double quotes. <string name="BeaconMedia">Viewing media beacons (white)</string> <string name="ParticleHiding">Hiding Particles</string> - </strings> + <!-- commands --> + <string name="Command_Avatar_Label">Avatar</string> + <string name="Command_Avatar_Tooltip">Customize your avatar</string> + <string name="Command_Places_Label">Places</string> + <string name="Command_Places_Tooltip">Destination guide</string> + +</strings> |