aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewermenu.cpp192
1 files changed, 3 insertions, 189 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index d78847e..b1cd9b6 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -146,7 +146,6 @@
146#include "llinventoryview.h" 146#include "llinventoryview.h"
147#include "llkeyboard.h" 147#include "llkeyboard.h"
148#include "llpanellogin.h" 148#include "llpanellogin.h"
149#include "llfloaterlandmark.h"
150#include "llmenucommands.h" 149#include "llmenucommands.h"
151#include "llmenugl.h" 150#include "llmenugl.h"
152#include "llmorphview.h" 151#include "llmorphview.h"
@@ -208,9 +207,6 @@
208 207
209#include "lltexlayer.h" 208#include "lltexlayer.h"
210 209
211void init_landmark_menu(LLMenuGL* menu);
212void clear_landmark_menu(LLMenuGL* menu);
213
214void init_client_menu(LLMenuGL* menu); 210void init_client_menu(LLMenuGL* menu);
215void init_server_menu(LLMenuGL* menu); 211void init_server_menu(LLMenuGL* menu);
216 212
@@ -256,7 +252,6 @@ LLPieMenu *gPieAttachment = NULL;
256LLPieMenu *gPieLand = NULL; 252LLPieMenu *gPieLand = NULL;
257 253
258// local constants 254// local constants
259const std::string LANDMARK_MENU_NAME("Landmarks");
260const std::string CLIENT_MENU_NAME("Advanced"); 255const std::string CLIENT_MENU_NAME("Advanced");
261const std::string SERVER_MENU_NAME("Admin"); 256const std::string SERVER_MENU_NAME("Admin");
262 257
@@ -274,7 +269,6 @@ LLPieMenu* gDetachPieMenu = NULL;
274LLPieMenu* gDetachScreenPieMenu = NULL; 269LLPieMenu* gDetachScreenPieMenu = NULL;
275LLPieMenu* gDetachBodyPartPieMenus[8]; 270LLPieMenu* gDetachBodyPartPieMenus[8];
276 271
277LLMenuGL* gLandmarkMenu = NULL;
278LLMenuItemCallGL* gAFKMenu = NULL; 272LLMenuItemCallGL* gAFKMenu = NULL;
279LLMenuItemCallGL* gBusyMenu = NULL; 273LLMenuItemCallGL* gBusyMenu = NULL;
280 274
@@ -336,8 +330,6 @@ void handle_audio_status_3(void*);
336void handle_audio_status_4(void*); 330void handle_audio_status_4(void*);
337#endif 331#endif
338void manage_landmarks(void*); 332void manage_landmarks(void*);
339void create_new_landmark(void*);
340void landmark_menu_action(void*);
341void reload_ui(void*); 333void reload_ui(void*);
342void handle_agent_stop_moving(void*); 334void handle_agent_stop_moving(void*);
343void print_packets_lost(void*); 335void print_packets_lost(void*);
@@ -497,55 +489,6 @@ BOOL enable_region_owner(void*);
497void menu_toggle_attached_lights(void* user_data); 489void menu_toggle_attached_lights(void* user_data);
498void menu_toggle_attached_particles(void* user_data); 490void menu_toggle_attached_particles(void* user_data);
499 491
500class LLLandmarkObserver : public LLInventoryObserver
501{
502public:
503 LLLandmarkObserver();
504 virtual ~LLLandmarkObserver();
505
506 virtual void changed(U32 mask)
507 {
508 // JC - Disabled for now - slows down client or causes crashes
509 // in inventory code.
510 //
511 // Also, this may not be faster than just rebuilding the menu each time.
512 // I believe gInventory.getObject() is not fast.
513 //
514 //const std::set<LLUUID>& changed_ids = gInventory.getChangedIDs();
515 //std::set<LLUUID>::const_iterator id_it;
516 //BOOL need_to_rebuild_menu = FALSE;
517 //for(id_it = changed_ids.begin(); id_it != changed_ids.end(); ++id_it)
518 //{
519 // LLInventoryObject* objectp = gInventory.getObject(*id_it);
520 // if (objectp && (objectp->getType() == LLAssetType::AT_LANDMARK || objectp->getType() == LLAssetType::AT_CATEGORY))
521 // {
522 // need_to_rebuild_menu = TRUE;
523 // }
524 //}
525 //if (need_to_rebuild_menu)
526 //{
527 // init_landmark_menu(gLandmarkMenu);
528 //}
529 }
530};
531
532// For debugging only, I think the inventory observer doesn't get
533// called if the inventory is loaded from cache.
534void build_landmark_menu(void*)
535{
536 init_landmark_menu(gLandmarkMenu);
537}
538
539LLLandmarkObserver::LLLandmarkObserver()
540{
541 gInventory.addObserver(this);
542}
543
544LLLandmarkObserver::~LLLandmarkObserver()
545{
546 gInventory.removeObserver(this);
547}
548
549class LLMenuParcelObserver : public LLParcelObserver 492class LLMenuParcelObserver : public LLParcelObserver
550{ 493{
551public: 494public:
@@ -555,7 +498,6 @@ public:
555}; 498};
556 499
557static LLMenuParcelObserver* gMenuParcelObserver = NULL; 500static LLMenuParcelObserver* gMenuParcelObserver = NULL;
558static LLLandmarkObserver* gLandmarkObserver = NULL;
559 501
560LLMenuParcelObserver::LLMenuParcelObserver() 502LLMenuParcelObserver::LLMenuParcelObserver()
561{ 503{
@@ -729,17 +671,6 @@ void init_menus()
729 // TomY TODO convert these two 671 // TomY TODO convert these two
730 LLMenuGL*menu; 672 LLMenuGL*menu;
731 673
732 // JC - Maybe we don't want a global landmark menu
733 /*
734 menu = new LLMenuGL(LANDMARK_MENU_NAME);
735 // Defer init_landmark_menu() until inventory observer reports that we actually
736 // have inventory. Otherwise findCategoryByUUID() will create an empty
737 // Landmarks folder in inventory. JC
738 gMenuBarView->appendMenu( menu );
739 menu->updateParent(LLMenuGL::sMenuContainer);
740 gLandmarkMenu = menu;
741 */
742
743 menu = new LLMenuGL(CLIENT_MENU_NAME); 674 menu = new LLMenuGL(CLIENT_MENU_NAME);
744 init_client_menu(menu); 675 init_client_menu(menu);
745 gMenuBarView->appendMenu( menu ); 676 gMenuBarView->appendMenu( menu );
@@ -755,9 +686,6 @@ void init_menus()
755 // Let land based option enable when parcel changes 686 // Let land based option enable when parcel changes
756 gMenuParcelObserver = new LLMenuParcelObserver(); 687 gMenuParcelObserver = new LLMenuParcelObserver();
757 688
758 // Let landmarks menu update when landmarks are added/removed
759 gLandmarkObserver = new LLLandmarkObserver();
760
761 // 689 //
762 // Debug menu visiblity 690 // Debug menu visiblity
763 // 691 //
@@ -775,64 +703,6 @@ void init_menus()
775 703
776 704
777 705
778void init_landmark_menu(LLMenuGL* menu)
779{
780 if (!menu) return;
781
782 // clear existing menu, as we might be rebuilding as result of inventory update
783 clear_landmark_menu(menu);
784
785 // *TODO: Translate
786 menu->append(new LLMenuItemCallGL("Organize Landmarks",
787 &manage_landmarks, NULL));
788 menu->append(new LLMenuItemCallGL("New Landmark...",
789 &create_new_landmark, NULL));
790 menu->appendSeparator();
791
792 // now collect all landmarks in inventory and build menu...
793 LLInventoryModel::cat_array_t* cats;
794 LLInventoryModel::item_array_t* items;
795 gInventory.getDirectDescendentsOf(gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK), cats, items);
796 if(items)
797 {
798 S32 count = items->count();
799 for(S32 i = 0; i < count; ++i)
800 {
801 LLInventoryItem* item = items->get(i);
802 std::string landmark_name = item->getName();
803 LLUUID* landmark_id_ptr = new LLUUID( item->getUUID() );
804 LLMenuItemCallGL* menu_item =
805 new LLMenuItemCallGL(landmark_name, landmark_menu_action,
806 NULL, NULL, landmark_id_ptr);
807 menu->append(menu_item);
808 }
809 }
810}
811
812void clear_landmark_menu(LLMenuGL* menu)
813{
814 if (!menu) return;
815
816 // We store the UUIDs of the landmark inventory items in the userdata
817 // field of the menus. Therefore when we clean up the menu we need to
818 // delete that data.
819 const LLView::child_list_t* child_list = menu->getChildList();
820 LLView::child_list_const_iter_t it = child_list->begin();
821 for ( ; it != child_list->end(); ++it)
822 {
823 LLView* view = *it;
824 LLMenuItemCallGL* menu_item = dynamic_cast<LLMenuItemCallGL*>(view);
825
826 if (menu_item && menu_item->getMenuCallback() == landmark_menu_action)
827 {
828 void* user_data = menu_item->getUserData();
829 delete (LLUUID*)user_data;
830 }
831 }
832
833 menu->empty();
834}
835
836void init_client_menu(LLMenuGL* menu) 706void init_client_menu(LLMenuGL* menu)
837{ 707{
838 LLMenuGL* sub_menu = NULL; 708 LLMenuGL* sub_menu = NULL;
@@ -1364,6 +1234,9 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1364 sub_menu->append(new LLMenuItemCheckGL("Raycasting", &LLPipeline::toggleRenderDebug, NULL, 1234 sub_menu->append(new LLMenuItemCheckGL("Raycasting", &LLPipeline::toggleRenderDebug, NULL,
1365 &LLPipeline::toggleRenderDebugControl, 1235 &LLPipeline::toggleRenderDebugControl,
1366 (void*)LLPipeline::RENDER_DEBUG_RAYCAST)); 1236 (void*)LLPipeline::RENDER_DEBUG_RAYCAST));
1237 sub_menu->append(new LLMenuItemCheckGL("Sculpt", &LLPipeline::toggleRenderDebug, NULL,
1238 &LLPipeline::toggleRenderDebugControl,
1239 (void*)LLPipeline::RENDER_DEBUG_SCULPTED));
1367 1240
1368 sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect)); 1241 sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect));
1369 1242
@@ -1602,14 +1475,9 @@ static std::vector<LLPointer<view_listener_t> > sMenus;
1602//----------------------------------------------------------------------------- 1475//-----------------------------------------------------------------------------
1603void cleanup_menus() 1476void cleanup_menus()
1604{ 1477{
1605 clear_landmark_menu(gLandmarkMenu);
1606
1607 delete gMenuParcelObserver; 1478 delete gMenuParcelObserver;
1608 gMenuParcelObserver = NULL; 1479 gMenuParcelObserver = NULL;
1609 1480
1610 delete gLandmarkObserver;
1611 gLandmarkObserver = NULL;
1612
1613 delete gPieSelf; 1481 delete gPieSelf;
1614 gPieSelf = NULL; 1482 gPieSelf = NULL;
1615 1483
@@ -3098,60 +2966,6 @@ void handle_audio_status_4(void*)
3098} 2966}
3099#endif 2967#endif
3100 2968
3101void manage_landmarks(void*)
3102{
3103 LLFloaterLandmark::showInstance(1);
3104}
3105
3106void create_new_landmark(void*)
3107{
3108 // Note this is temporary cut and paste of legacy functionality.
3109 // TODO: Make this spawn a floater allowing user customize before creating the inventory object
3110
3111 LLViewerRegion* agent_region = gAgent.getRegion();
3112 if(!agent_region)
3113 {
3114 llwarns << "No agent region" << llendl;
3115 return;
3116 }
3117 LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
3118 if (!agent_parcel)
3119 {
3120 llwarns << "No agent parcel" << llendl;
3121 return;
3122 }
3123 if (!agent_parcel->getAllowLandmark()
3124 && !LLViewerParcelMgr::isParcelOwnedByAgent(agent_parcel, GP_LAND_ALLOW_LANDMARK))
3125 {
3126 gViewerWindow->alertXml("CannotCreateLandmarkNotOwner");
3127 return;
3128 }
3129
3130 LLUUID folder_id;
3131 folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK);
3132 std::string pos_string;
3133 gAgent.buildLocationString(pos_string);
3134
3135 create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
3136 folder_id, LLTransactionID::tnull,
3137 pos_string, pos_string, // name, desc
3138 LLAssetType::AT_LANDMARK,
3139 LLInventoryType::IT_LANDMARK,
3140 NOT_WEARABLE, PERM_ALL,
3141 NULL);
3142}
3143
3144void landmark_menu_action(void* userdata)
3145{
3146 LLUUID item_id = *(LLUUID*)userdata;
3147
3148 LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
3149 if (itemp)
3150 {
3151 open_landmark(itemp, itemp->getName(), FALSE);
3152 }
3153}
3154
3155void reload_ui(void *) 2969void reload_ui(void *)
3156{ 2970{
3157 LLUICtrlFactory::getInstance()->rebuild(); 2971 LLUICtrlFactory::getInstance()->rebuild();