diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-20 13:54:34 -0800 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-20 13:54:34 -0800 |
commit | a65188d85f75e848d224bd335a00ed8aa51f945e (patch) | |
tree | f43b390cba45d047fc0fa31659f6969f62b925d1 /indra/newview/llviewermenu.cpp | |
parent | 1a8008ea150d1eb9a8f4036988ef971fb1901cb3 (diff) | |
parent | 5ca943cd0279d35ffdf584fa0de3b795645f276c (diff) |
Merge from viewer2. Minor conflict resolved.
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 148 |
1 files changed, 94 insertions, 54 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index aefb8367a2..692474cb2d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -48,11 +48,10 @@ #include "llconsole.h" #include "lldebugview.h" #include "llfilepicker.h" -#include "llfirstuse.h" +//#include "llfirstuse.h" #include "llfloaterbuy.h" #include "llfloaterbuycontents.h" #include "llfloaterbuycurrency.h" -#include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloaterchatterbox.h" #include "llfloatergodtools.h" @@ -2491,7 +2490,7 @@ class LLObjectBuild : public view_listener_t LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use - LLFirstUse::useBuild(); + //LLFirstUse::useBuild(); return true; } }; @@ -2536,7 +2535,7 @@ void handle_object_edit() LLViewerJoystick::getInstance()->setNeedsReset(true); // Could be first use - LLFirstUse::useBuild(); + //LLFirstUse::useBuild(); return; } @@ -2587,7 +2586,7 @@ class LLLandBuild : public view_listener_t LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use - LLFirstUse::useBuild(); + //LLFirstUse::useBuild(); return true; } }; @@ -2824,7 +2823,7 @@ bool handle_go_to() } // Could be first use - LLFirstUse::useGoTo(); + //LLFirstUse::useGoTo(); return true; } @@ -3365,14 +3364,49 @@ void handle_show_side_tray() root->addChild(side_tray); } -class LLShowPanelPeopleTab : public view_listener_t +// Toggle one of "People" panel tabs in side tray. +class LLTogglePanelPeopleTab : public view_listener_t { bool handleEvent(const LLSD& userdata) { - // Open tab of the "People" panel in side tray. + std::string panel_name = userdata.asString(); + LLSD param; - param["people_panel_tab_name"] = userdata.asString(); - LLSideTray::getInstance()->showPanel("panel_people", param); + param["people_panel_tab_name"] = panel_name; + + static LLPanel* friends_panel = NULL; + static LLPanel* groups_panel = NULL; + static LLPanel* nearby_panel = NULL; + + if (panel_name == "friends_panel") + { + return togglePeoplePanel(friends_panel, panel_name, param); + } + else if (panel_name == "groups_panel") + { + return togglePeoplePanel(groups_panel, panel_name, param); + } + else if (panel_name == "nearby_panel") + { + return togglePeoplePanel(nearby_panel, panel_name, param); + } + else + { + return false; + } + } + + static bool togglePeoplePanel(LLPanel* &panel, const std::string& panel_name, const LLSD& param) + { + if(!panel) + { + panel = LLSideTray::getInstance()->getPanel(panel_name); + if(!panel) + return false; + } + + LLSideTray::getInstance()->togglePanel(panel, "panel_people", param); + return true; } }; @@ -3626,7 +3660,7 @@ void near_sit_down_point(BOOL success, void *) gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); // Might be first sit - LLFirstUse::useSit(); + //LLFirstUse::useSit(); } } @@ -5144,7 +5178,7 @@ void toggle_debug_menus(void*) gSavedSettings.setBOOL("UseDebugMenus", visible); if(visible) { - LLFirstUse::useDebugMenus(); + //LLFirstUse::useDebugMenus(); } show_debug_menus(); } @@ -6340,49 +6374,55 @@ class LLToolsSelectedScriptAction : public view_listener_t void handle_selected_texture_info(void*) { for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin(); - iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++) + iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++) { LLSelectNode* node = *iter; - - std::string msg; - msg.assign("Texture info for: "); - msg.append(node->mName); - LLChat chat(msg); - LLFloaterChat::addChat(chat); - - U8 te_count = node->getObject()->getNumTEs(); - // map from texture ID to list of faces using it - typedef std::map< LLUUID, std::vector<U8> > map_t; - map_t faces_per_texture; - for (U8 i = 0; i < te_count; i++) - { - if (!node->isTESelected(i)) continue; - - LLViewerTexture* img = node->getObject()->getTEImage(i); - LLUUID image_id = img->getID(); - faces_per_texture[image_id].push_back(i); - } - // Per-texture, dump which faces are using it. - map_t::iterator it; - for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it) - { - LLUUID image_id = it->first; - U8 te = it->second[0]; - LLViewerTexture* img = node->getObject()->getTEImage(te); - S32 height = img->getHeight(); - S32 width = img->getWidth(); - S32 components = img->getComponents(); - msg = llformat("%dx%d %s on face ", - width, - height, - (components == 4 ? "alpha" : "opaque")); - for (U8 i = 0; i < it->second.size(); ++i) - { - msg.append( llformat("%d ", (S32)(it->second[i]))); - } - LLChat chat(msg); - LLFloaterChat::addChat(chat); - } + + std::string msg; + msg.assign("Texture info for: "); + msg.append(node->mName); + + //TODO* CHAT: how to show this? + //LLSD args; + //args["MESSAGE"] = msg; + //LLNotificationsUtil::add("SystemMessage", args); + + U8 te_count = node->getObject()->getNumTEs(); + // map from texture ID to list of faces using it + typedef std::map< LLUUID, std::vector<U8> > map_t; + map_t faces_per_texture; + for (U8 i = 0; i < te_count; i++) + { + if (!node->isTESelected(i)) continue; + + LLViewerTexture* img = node->getObject()->getTEImage(i); + LLUUID image_id = img->getID(); + faces_per_texture[image_id].push_back(i); + } + // Per-texture, dump which faces are using it. + map_t::iterator it; + for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it) + { + LLUUID image_id = it->first; + U8 te = it->second[0]; + LLViewerTexture* img = node->getObject()->getTEImage(te); + S32 height = img->getHeight(); + S32 width = img->getWidth(); + S32 components = img->getComponents(); + msg = llformat("%dx%d %s on face ", + width, + height, + (components == 4 ? "alpha" : "opaque")); + for (U8 i = 0; i < it->second.size(); ++i) + { + msg.append( llformat("%d ", (S32)(it->second[i]))); + } + + //TODO* CHAT: how to show this? + //LLSD args; + //args["MESSAGE"] = msg; + //LLNotificationsUtil::add("SystemMessage", args); + } } } @@ -7898,7 +7938,7 @@ void initialize_menus() view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments"); // we don't use boost::bind directly to delay side tray construction - view_listener_t::addMenu( new LLShowPanelPeopleTab(), "SideTray.PanelPeopleTab"); + view_listener_t::addMenu( new LLTogglePanelPeopleTab(), "SideTray.PanelPeopleTab"); // Avatar pie menu view_listener_t::addMenu(new LLObjectMute(), "Avatar.Mute"); |