From 7e458d1989ea06d06c64db4732619e03b59cf223 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 30 Mar 2010 23:39:25 -0700 Subject: Made the AO toggle and work like an actual menu check --- linden/indra/newview/floaterao.cpp | 22 ++++++++++++++++++---- linden/indra/newview/floaterao.h | 2 ++ linden/indra/newview/llviewermenu.cpp | 15 +++++++++++++-- .../skins/default/xui/en-us/menu_viewer.xml | 3 ++- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp index e3083d3..d8844d8 100644 --- a/linden/indra/newview/floaterao.cpp +++ b/linden/indra/newview/floaterao.cpp @@ -249,11 +249,25 @@ LLFloaterAO::~LLFloaterAO() void LLFloaterAO::show(void*) { if (!sInstance) - sInstance = new LLFloaterAO(); - updateLayout(sInstance); - init(); + { + sInstance = new LLFloaterAO(); + updateLayout(sInstance); + init(); + + sInstance->open(); + } + else + { + sInstance->close(); + } +} - sInstance->open(); +bool LLFloaterAO::getInstance() +{ + if (sInstance) + return true; + else + return false; } BOOL LLFloaterAO::postBuild() diff --git a/linden/indra/newview/floaterao.h b/linden/indra/newview/floaterao.h index 3ab06e0..6b356cd 100644 --- a/linden/indra/newview/floaterao.h +++ b/linden/indra/newview/floaterao.h @@ -103,6 +103,8 @@ public: static LLUUID invfolderid; static const LLUUID& getAssetIDByName(const std::string& name); + + static bool getInstance(); private: diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 7a2cddf..7697f77 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -8598,7 +8598,7 @@ class LLAdvancedTogglePhantom: public view_listener_t }; -class LLAO : public view_listener_t +class LLViewToggleAO : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { @@ -8607,6 +8607,16 @@ class LLAO : public view_listener_t } }; +class LLViewCheckAO: public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getInstance()); + return true; + } +}; + + class LLAdvancedCheckPhantom: public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -10731,6 +10741,7 @@ void initialize_menus() addMenu(new LLZoomer(1/1.2f), "View.ZoomIn"); addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault"); addMenu(new LLViewFullscreen(), "View.Fullscreen"); + addMenu(new LLViewToggleAO(), "View.ToggleAO"); addMenu(new LLViewToggleAdvanced(), "View.ToggleAdvanced"); addMenu(new LLViewEnableMouselook(), "View.EnableMouselook"); @@ -10743,7 +10754,7 @@ void initialize_menus() addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent"); addMenu(new LLViewCheckRenderType(), "View.CheckRenderType"); addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments"); - addMenu(new LLAO(), "View.AO"); + addMenu(new LLViewCheckAO(), "View.CheckAO"); addMenu(new LLViewCheckAdvanced(), "View.CheckAdvanced"); // World menu diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 8f213c8..242cc8f 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -348,7 +348,8 @@ - + +