From 2450b435a730762add23570c262db2888b675a22 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 24 Jan 2014 21:41:56 -0500 Subject: [PATCH] Combine commonly created scroll list menus into single menus identified by menu_num instead of their menu_file sScrollListMenus is an array such that it will hold more menus in the future, such as groups. fmenu_file still exists and will still exhibit its old behavior if used. --- indra/llui/llscrolllistctrl.cpp | 12 +++++++++++- indra/newview/llviewermenu.cpp | 5 +++++ .../skins/default/xui/en-us/floater_about_land.xml | 4 ++-- .../default/xui/en-us/floater_active_speakers.xml | 2 +- .../skins/default/xui/en-us/floater_directory.xml | 2 +- .../skins/default/xui/en-us/floater_directory2.xml | 2 +- .../skins/default/xui/en-us/floater_directory3.xml | 2 +- .../skins/default/xui/en-us/panel_friends.xml | 2 +- .../skins/default/xui/en-us/panel_friends_horiz.xml | 2 +- .../skins/default/xui/en-us/panel_group_general.xml | 2 +- .../skins/default/xui/en-us/panel_group_roles.xml | 6 +++--- .../default/xui/en-us/panel_speaker_controls.xml | 2 +- 12 files changed, 29 insertions(+), 14 deletions(-) diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index bae86672c..fb9383ecb 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -57,6 +57,8 @@ static LLRegisterWidget r("scroll_list"); +LLMenuGL* sScrollListMenus[1] = {}; // List menus that recur, such as general avatars or groups menus + // local structures & classes. struct SortScrollListItem { @@ -2552,7 +2554,15 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node) node->getAttribute_bool("mouse_wheel_opaque", mMouseWheelOpaque); } - if (node->hasAttribute("menu_file")) + if (node->hasAttribute("menu_num")) + { + // Some scroll lists use common menus identified by number + // 0 is menu_avs_list.xml, 1 will be for groups, 2 could be for lists of objects + S32 menu_num; + node->getAttributeS32("menu_num", menu_num); + mPopupMenu = sScrollListMenus[menu_num]; + } + else if (node->hasAttribute("menu_file")) { std::string menu_file; node->getAttributeString("menu_file", menu_file); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ca85a2ac2..32e426544 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -239,6 +239,7 @@ extern BOOL gDebugTextEditorTips; extern BOOL gShowOverlayTitle; extern BOOL gOcclusionCull; extern AIHTTPView* gHttpView; +extern LLMenuGL* sScrollListMenus[1]; // // Globals // @@ -781,6 +782,10 @@ void init_menus() gMenuHolder->addChild(gLoginMenuBarView); + // Singu Note: Initialize common ScrollListMenus here + sScrollListMenus[0] = LLUICtrlFactory::getInstance()->buildMenu("menu_avs_list.xml", gMenuHolder); + //sScrollListMenus[1] = LLUICtrlFactory::getInstance()->buildMenu("menu_groups_list.xml"); // Singu TODO + LLView* ins = gMenuBarView->getChildView("insert_world", true, false); ins->setVisible(false); ins = gMenuBarView->getChildView("insert_agent", true, false); diff --git a/indra/newview/skins/default/xui/en-us/floater_about_land.xml b/indra/newview/skins/default/xui/en-us/floater_about_land.xml index fec011a1a..eac223645 100644 --- a/indra/newview/skins/default/xui/en-us/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en-us/floater_about_land.xml @@ -1383,7 +1383,7 @@ Select the thumbnail to choose a different texture. column_padding="0" draw_border="true" draw_heading="false" enabled="true" follows="top|bottom" heading_font="SansSerifSmall" heading_height="14" height="80" left="20" mouse_opaque="true" multi_select="true" - name="AccessList" tool_tip="([LISTED] listed, [MAX] max)" width="195" menu_file="menu_avs_list.xml"/> + name="AccessList" tool_tip="([LISTED] listed, [MAX] max)" width="195" menu_num="0"/>