diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 097d8affca..636a630891 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1722,9 +1722,9 @@ void LLFloater::draw() { static LLUIColor titlebar_focus_color = LLUIColorTable::instance().getColor("TitleBarFocusColor"); - const LLFontGL* font = LLFontGL::getFontSansSerif(); + //const LLFontGL* font = LLFontGL::getFontSansSerif(); LLRect r = getRect(); - gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1, + gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - mHeaderHeight, titlebar_focus_color % mCurrentTransparency, 0, TRUE); } } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e687d9985a..3a9427c6b3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -66,6 +66,7 @@ include_directories( ) set(viewer_SOURCE_FILES + chatbar_as_cmdline.cpp kcwlinterface.cpp llagent.cpp llagentaccess.cpp @@ -605,6 +606,7 @@ endif (LINUX) set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake + chatbar_as_cmdline.h kcwlinterface.h llagent.h llagentaccess.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f954a21178..6ffacf50b2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10597,7 +10597,7 @@ Type S32 Value - 7 + 4 UIImgDefaultEyesUUID @@ -12567,6 +12567,226 @@ Value 300.0 + PhoenixCmdLine + + Comment + Enable usage of chat bar as a command line + Persist + 1 + Type + Boolean + Value + 1 + + PhoenixCmdLineMapToKeepPos + + Comment + Whether to use current local pos on tp to the new sim + Persist + 1 + Type + Boolean + Value + 0 + + PhoenixCmdLineAO + + Comment + Turn AO on/off + Persist + 1 + Type + String + Value + cao + + PhoenixCmdLineAutocorrect + + Comment + Command for adding new entries to autocorrect + Persist + 1 + Type + String + Value + /addac + + PhoenixCmdLineMedia + + Comment + Chat command for setting a media url + Persist + 1 + Type + String + Value + /media + + PhoenixCmdLineMusic + + Comment + Chat command for setting a music url + Persist + 1 + Type + String + Value + /music + + PhoenixCmdLineClearChat + + Comment + Clear chat hsitory to stop lag from chat spam + Persist + 1 + Type + String + Value + clrchat + + PhoenixCmdLineHeight + + Comment + Teleport to height function command + Persist + 1 + Type + String + Value + gth + + PhoenixCmdLinePos + + Comment + Teleport to position function command + Persist + 1 + Type + String + Value + gtp + + PhoenixCmdLineGround + + Comment + Teleport to ground function command + Persist + 1 + Type + String + Value + flr + + PhoenixCmdLineTeleportHome + + Comment + Teleport to home function command + Persist + 1 + Type + String + Value + tph + + PhoenixCmdLineRezPlatform + + Comment + Rez a platform underneath you + Persist + 1 + Type + String + Value + rezplat + + PhoenixCmdLinePlatformSize + + Comment + How wide the rezzed platform will appear to be. + Persist + 1 + Type + F32 + Value + 30 + + PhoenixCmdLineMapTo + + Comment + Teleport to a region by name rapidly + Persist + 1 + Type + String + Value + mapto + + PhoenixCmdLineDrawDistance + + Comment + Change draw distance quickly + Persist + 1 + Type + String + Value + dd + + PhoenixCmdTeleportToCam + + Comment + Teleport to your camera + Persist + 1 + Type + String + Value + tp2cam + + PhoenixCmdLineKeyToName + + Comment + Use a fast key to name query + Persist + 1 + Type + String + Value + key2name + + PhoenixCmdLineOfferTp + + Comment + Offer a teleport to target avatar + Persist + 1 + Type + String + Value + offertp + + PhoenixCmdLineCalc + + Comment + Calculates an expression + Persist + 1 + Type + String + Value + calc + + PhoenixCmdLineTP2 + + Comment + Teleport to a person by name, partials work. + Persist + 1 + Type + String + Value + tp2 + PhoenixWLParcelEnabled Comment diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp new file mode 100644 index 0000000000..1d2d7b3d2b --- /dev/null +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -0,0 +1,1390 @@ +/* Copyright (c) 2010 + * + * Modular Systems All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. Neither the name Modular Systems nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS “AS IS” + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "llviewerprecompiledheaders.h" + +#include "chatbar_as_cmdline.h" + +//#include "llcalc.h" + +#include "llchatbar.h" +#include "llagent.h" +#include "stdtypes.h" +#include "llviewerregion.h" +#include "llworld.h" +#include "lluuid.h" +#include "llviewercontrol.h" + +#include "material_codes.h" +#include "llvolume.h" +#include "object_flags.h" +#include "llvolumemessage.h" +#include "llurldispatcher.h" +#include "llworld.h" +#include "llworldmap.h" +//#include "floateravatarlist.h" +//#include "floaterao.h" +#include "llviewerobjectlist.h" +#include "llviewertexteditor.h" +#include "llvoavatar.h" +#include "lltooldraganddrop.h" +#include "llinventorymodel.h" +#include "llselectmgr.h" + +#include + +#include + + +#include "llnotificationmanager.h" +#include "llfloaterreg.h" + +#include "llfloaterchat.h" +#include "llviewerparcelmgr.h" +#include "llviewerparcelmedia.h" +#include "llparcel.h" +#include "llaudioengine.h" +#include "llviewerparcelmediaautoplay.h" +#include "lloverlaybar.h" +//#include "lggautocorrectfloater.h" +//#include "lggautocorrect.h" + +#include "rlvhandler.h" + +#include "llagentcamera.h" + + +void cmdline_printchat(std::string message); +void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.0); +//void cmdline_tp2name(std::string target); + +LLUUID cmdline_partial_name2key(std::string name); + + + +LLViewerInventoryItem::item_array_t findInventoryInFolder(const std::string& ifolder) +{ + LLUUID folder = gInventory.findCategoryByName(ifolder); + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + //ObjectContentNameMatches objectnamematches(ifolder); + gInventory.collectDescendents(folder,cats,items,FALSE);//,objectnamematches); + + return items; +} + +void doZdCleanup(); +class JCZdrop : public LLEventTimer +{ +public: + BOOL mRunning; + + JCZdrop(std::stack stack, LLUUID dest, std::string sFolder, std::string sUUID, bool package = false) : LLEventTimer(1.0), mRunning(FALSE) + { + mPackage = package; + instack = stack; + indest = dest; + dFolder = sFolder; + dUUID = sUUID; + } + ~JCZdrop() + { + doZdCleanup(); + if (errorCode == 1) + { + cmdline_printchat(llformat("The object with the UUID of \"%s\" can no longer be found in-world.",dUUID.c_str())); + cmdline_printchat("This can occur if the object was returned or deleted, or if your client is no longer rendering it."); + cmdline_printchat(llformat("Transfer from \"%s\" to \"%s\" aborted.",dFolder.c_str(),dUUID.c_str())); + } + else + { + if(mPackage) + { + cmdline_printchat("Packager finished, you may now pick up the prim that contains the objects."); + cmdline_printchat(llformat("Packaged what you had selected in world into the folder \"%s\" in your inventory and into the prim with the UUID of \"%s\"",dFolder.c_str(),dUUID.c_str())); + cmdline_printchat("Don't worry if you look at the contents of package right now, it may show as empty, it isn't, it's just a bug with Second Life itself."); + cmdline_printchat("If you take it into your inventory then rez it back out, all the contents will be there."); + } + else + { + cmdline_printchat(llformat("Completed transfer from \"%s\" to \"%s\".",dFolder.c_str(),dUUID.c_str())); + } + } + } + BOOL tick() + { + LLViewerInventoryItem* subj = instack.top(); + instack.pop(); + LLViewerObject *objectp = gObjectList.findObject(indest); + if(objectp) + { + cmdline_printchat(std::string("transferring ")+subj->getName()); + LLToolDragAndDrop::dropInventory(objectp,subj,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); + if (instack.size() > 0) + { + return mRunning; + } + else + { + return (instack.size() == 0); + } + } + else + { + errorCode = 1; + return TRUE; + } + } + + +private: + std::stack instack; + LLUUID indest; + std::string dFolder; + std::string dUUID; + int errorCode; + bool mPackage; +}; + +JCZdrop *zdrop; + +class ZdCleanup: public LLEventTimer +{ +public: + ZdCleanup() : LLEventTimer(0.2f) //Don't really need this long of a timer, but it can't be to short or tick() below may get called before the packager's tick() returns to the timer system. Things get ugly otherwise. + { + } + ~ZdCleanup() + { + } + BOOL tick() + { + zdrop = NULL; + return TRUE; + } +}; + +void doZdCleanup() +{ + new ZdCleanup(); +} +void doZtCleanup(); +class JCZtake : public LLEventTimer +{ +public: + BOOL mRunning; + + JCZtake(const LLUUID& target, bool package = false, LLUUID destination = LLUUID::null, std::string dtarget = "") : LLEventTimer(0.66f), mTarget(target), mRunning(FALSE), mCountdown(5), mPackage(package), mPackageDest(destination) + { + mFolderName = dtarget; + if(mPackage) + { + cmdline_printchat("Packager started. Phase 1 (taking in-world objects into inventory) starting in: "); + } + else + { + cmdline_printchat("Ztake activated. Taking selected in-world objects into inventory in: "); + } + } + ~JCZtake() + { + if(!mPackage) + { + cmdline_printchat("Ztake deactivated."); + } + } + BOOL tick() + { + { + LLMessageSystem *msg = gMessageSystem; + for(LLObjectSelection::root_iterator itr=LLSelectMgr::getInstance()->getSelection()->root_begin(); + itr!=LLSelectMgr::getInstance()->getSelection()->root_end();++itr) + { + LLSelectNode* node = (*itr); + LLViewerObject* objectp = node->getObject(); + U32 localid=objectp->getLocalID(); + if(mDonePrims.find(localid) == mDonePrims.end()) + { + mDonePrims.insert(localid); + mToTake.push_back(localid); + } + } + + if(mCountdown > 0) + { + cmdline_printchat(llformat("%i...", mCountdown--)); + } + else if(mToTake.size() > 0) + { + msg->newMessageFast(_PREHASH_DeRezObject); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_AgentBlock); + msg->addUUIDFast(_PREHASH_GroupID, LLUUID::null); + msg->addU8Fast(_PREHASH_Destination, 4); + msg->addUUIDFast(_PREHASH_DestinationID, mTarget); + LLUUID rand; + rand.generate(); + msg->addUUIDFast(_PREHASH_TransactionID, rand); + msg->addU8Fast(_PREHASH_PacketCount, 1); + msg->addU8Fast(_PREHASH_PacketNumber, 0); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_ObjectLocalID, mToTake[0]); + gAgent.sendReliableMessage(); + mToTake.erase(mToTake.begin()); + if(mToTake.size() % 10 == 0) + { + if(mToTake.size() == 0) + { + if(mPackage) + { + cmdline_printchat("Phase 1 of the packager finished."); + std::stack lolstack; + LLDynamicArray > lolinv = findInventoryInFolder(mFolderName); + for(LLDynamicArray >::iterator it = lolinv.begin(); it != lolinv.end(); ++it) + { + LLViewerInventoryItem* item = *it; + lolstack.push(item); + } + if(lolstack.size()) + { + cmdline_printchat("Do not have the destination prim selected while transfer is running to reduce the chances of \"Inventory creation on in-world object failed.\""); + LLUUID sdest = LLUUID(mPackageDest); + new JCZdrop(lolstack, sdest, mFolderName.c_str(), mPackageDest.asString().c_str(), true); + } + doZtCleanup(); + } + else + { + cmdline_printchat("Ztake has taken all selected objects. Say \"ztake off\" to deactivate ztake or select more objects to continue."); + } + } + else + { + if(mPackage) + { + cmdline_printchat(llformat("Packager: %i objects left to take.", mToTake.size())); + } + else + { + cmdline_printchat(llformat("Ztake: %i objects left to take.", mToTake.size())); + } + } + } + } + } + return mRunning; + } + +private: + std::set mDonePrims; + std::vector mToTake; + LLUUID mTarget; + int mCountdown; + bool mPackage; + LLUUID mPackageDest; + std::string mFolderName; +}; + +JCZtake *ztake; + +class LOZtCleanup: public LLEventTimer +{ +public: + LOZtCleanup() : LLEventTimer(0.2f) //Don't really need this long of a timer, but it can't be to short or tick() below may get called before the packager's tick() returns to the timer system. Things get ugly otherwise. + { + } + ~LOZtCleanup() + { + } + BOOL tick() + { + ztake->mRunning = TRUE; + delete ztake; + ztake = NULL; + return TRUE; + } +}; + +void doZtCleanup() +{ + new LOZtCleanup(); +} + +class TMZtake : public LLEventTimer +{ +public: + BOOL mRunning; + + + TMZtake(const LLUUID& target) : LLEventTimer(0.33f), mTarget(target), mRunning(FALSE), mCountdown(5) + { + cmdline_printchat("Mtake activated. Taking selected in-world objects into inventory in: "); + } + ~TMZtake() + { + cmdline_printchat("Mtake deactivated."); + } + BOOL tick() + { + { + LLMessageSystem *msg = gMessageSystem; + for(LLObjectSelection::iterator itr=LLSelectMgr::getInstance()->getSelection()->begin(); + itr!=LLSelectMgr::getInstance()->getSelection()->end();++itr) + { + LLSelectNode* node = (*itr); + LLViewerObject* object = node->getObject(); + U32 localid=object->getLocalID(); + if(mDonePrims.find(localid) == mDonePrims.end()) + {// would like to add ability to reset prim parameters to default. + mDonePrims.insert(localid); + std::string primX = llformat("%f",(float)object->getScale().mV[VX]); + std::string primY = llformat("%f",(float)object->getScale().mV[VY]); + std::string primZ = llformat("%f",(float)object->getScale().mV[VZ]); + zeroClearX = primX.find_last_not_of("0")+1; + primX = primX.substr(0,zeroClearX); + zeroClearY = primY.find_last_not_of("0")+1; + primY = primY.substr(0,zeroClearY); + zeroClearZ = primZ.find_last_not_of("0")+1; + primZ = primZ.substr(0,zeroClearZ); + zeroClearX = primX.find_last_not_of(".")+1; + primX = primX.substr(0,zeroClearX); + zeroClearY = primY.find_last_not_of(".")+1; + primY = primY.substr(0,zeroClearY); + zeroClearZ = primZ.find_last_not_of(".")+1; + primZ = primZ.substr(0,zeroClearZ); + std::string name = llformat("%sx%sx%s",primX.c_str(),primY.c_str(),primZ.c_str()); + msg->newMessageFast(_PREHASH_ObjectName); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_LocalID, localid); + msg->addStringFast(_PREHASH_Name, name); + gAgent.sendReliableMessage(); + mToTake.push_back(localid); + } + } + if(mCountdown > 0) + { + cmdline_printchat(llformat("%i...", mCountdown--)); + } + else if(mToTake.size() > 0) + { + msg->newMessageFast(_PREHASH_DeRezObject); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_AgentBlock); + msg->addUUIDFast(_PREHASH_GroupID, LLUUID::null); + msg->addU8Fast(_PREHASH_Destination, 4); + msg->addUUIDFast(_PREHASH_DestinationID, mTarget); + LLUUID rand; + rand.generate(); + msg->addUUIDFast(_PREHASH_TransactionID, rand); + msg->addU8Fast(_PREHASH_PacketCount, 1); + msg->addU8Fast(_PREHASH_PacketNumber, 0); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_ObjectLocalID, mToTake[0]); + gAgent.sendReliableMessage(); + mToTake.erase(mToTake.begin()); + if(mToTake.size() % 10 == 0) + { + if(mToTake.size() == 0) + { + cmdline_printchat("Mtake has taken all selected objects. Say \"Mtake off\" to deactivate Mtake or select more objects to continue."); + } + else + { + cmdline_printchat(llformat("Mtake: %i objects left to take.", mToTake.size())); + } + } + } + } + return mRunning; + } + +private: + std::set mDonePrims; + std::vector mToTake; + LLUUID mTarget; + int mCountdown; + int zeroClearX; + int zeroClearY; + int zeroClearZ; +}; +TMZtake *mtake; + +void invrepair() +{ + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + //ObjectContentNameMatches objectnamematches(ifolder); + gInventory.collectDescendents(gInventory.getRootFolderID(),cats,items,FALSE);//,objectnamematches); +} + +/*static BOOL *sPhoenixCmdLine; +static std::string *sPhoenixCmdLinePos; +static std::string *sPhoenixCmdLineDrawDistance; +static std::string *sPhoenixCmdTeleportToCam; +static std::string *sPhoenixCmdLineAO; +static std::string *sPhoenixCmdLineKeyToName; +static std::string *sPhoenixCmdLineOfferTp; +static std::string *sPhoenixCmdLineGround; +static std::string *sPhoenixCmdLineHeight; +static std::string *sPhoenixCmdLineTeleportHome; +static std::string *sPhoenixCmdLineRezPlatform; +static std::string *sPhoenixCmdLineMapTo; +static BOOL *sPhoenixCmdLineMapToKeepPos; +static std::string *sPhoenixCmdLineCalc; +static std::string *sPhoenixCmdLineTP2; +static std::string *sPhoenixCmdLineClearChat; +static F32 *sPhoenixCmdLinePlatformSize;*/ + +/* +class another_rebind_group +{ + +} + +template +class another_rebind +{ + T *mVal; + static std::map > instances; + + + +}; +*/ + + +#ifdef JC_PROFILE_GSAVED +std::map get_gsaved_calls(); +#endif + +bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) +{ + static LLCachedControl sPhoenixCmdLine(gSavedSettings, "PhoenixCmdLine"); + static LLCachedControl sPhoenixCmdLinePos(gSavedSettings, "PhoenixCmdLinePos"); + static LLCachedControl sPhoenixCmdLineDrawDistance(gSavedSettings, "PhoenixCmdLineDrawDistance"); + static LLCachedControl sPhoenixCmdTeleportToCam(gSavedSettings, "PhoenixCmdTeleportToCam"); + static LLCachedControl sPhoenixCmdLineAO(gSavedSettings, "PhoenixCmdLineAO"); + static LLCachedControl sPhoenixCmdLineKeyToName(gSavedSettings, "PhoenixCmdLineKeyToName"); + static LLCachedControl sPhoenixCmdLineOfferTp(gSavedSettings, "PhoenixCmdLineOfferTp"); + static LLCachedControl sPhoenixCmdLineGround(gSavedSettings, "PhoenixCmdLineGround"); + static LLCachedControl sPhoenixCmdLineHeight(gSavedSettings, "PhoenixCmdLineHeight"); + static LLCachedControl sPhoenixCmdLineTeleportHome(gSavedSettings, "PhoenixCmdLineTeleportHome"); + static LLCachedControl sPhoenixCmdLineRezPlatform(gSavedSettings, "PhoenixCmdLineRezPlatform"); + static LLCachedControl sPhoenixCmdLineMapTo(gSavedSettings, "PhoenixCmdLineMapTo"); + static LLCachedControl sPhoenixCmdLineMapToKeepPos(gSavedSettings, "PhoenixCmdLineMapToKeepPos"); + static LLCachedControl sPhoenixCmdLineCalc(gSavedSettings, "PhoenixCmdLineCalc"); + static LLCachedControl sPhoenixCmdLineTP2(gSavedSettings, "PhoenixCmdLineTP2"); + static LLCachedControl sPhoenixCmdLineClearChat(gSavedSettings, "PhoenixCmdLineClearChat"); + static LLCachedControl sPhoenixCmdLineMedia(gSavedSettings, "PhoenixCmdLineMedia"); + static LLCachedControl sPhoenixCmdLineMusic(gSavedSettings, "PhoenixCmdLineMusic"); + static LLCachedControl sPhoenixCmdLineAutocorrect(gSavedSettings, "PhoenixCmdLineAutocorrect"); + + if(sPhoenixCmdLine) + { + std::istringstream i(revised_text); + std::string command; + i >> command; + if(command != "") + { + if(command == std::string(sPhoenixCmdLinePos)) + { + F32 x,y,z; + if (i >> x) + { + if (i >> y) + { + if (i >> z) + { + LLVector3 agentPos = gAgent.getPositionAgent(); + LLViewerRegion* agentRegionp = gAgent.getRegion(); + if(agentRegionp) + { + LLVector3 targetPos(x,y,z); + LLVector3d pos_global = from_region_handle(agentRegionp->getHandle()); + pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]); + gAgent.teleportViaLocation(pos_global); + return false; + } + } + } + } + } + else if(command == std::string(sPhoenixCmdLineDrawDistance)) + { + if(from_gesture) + { + cmdline_printchat("Due to the changes in code, it is no longer necessary to use this gesture."); + gSavedSettings.setBOOL("RenderFarClipStepping",TRUE); + return false; + } + int drawDist; + if(i >> drawDist) + { + gSavedSettings.setF32("RenderFarClip", drawDist); + gAgentCamera.mDrawDistance=drawDist; + cmdline_printchat(std::string(llformat("Draw distance set to: %dm",drawDist))); + return false; + } + } + else if(command == std::string(sPhoenixCmdTeleportToCam)) + { + gAgent.teleportViaLocation(gAgentCamera.getCameraPositionGlobal()); + return false; + } + else if(command == std::string(sPhoenixCmdLineMedia)) + { + std::string url; + std::string type; + + if(i >> url) + { + if(i >> type) + { + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + parcel->setMediaURL(url); + parcel->setMediaType(type); + LLViewerParcelMedia::play(parcel); + LLViewerParcelMediaAutoPlay::playStarted(); + return false; + } + } + } +#if 0 + else if(command == std::string(sPhoenixCmdLineMusic)) + { + std::string status; + if(i >> status) + { + if(!gOverlayBar->musicPlaying()) + { + gOverlayBar->toggleMusicPlay(gOverlayBar); + } + gAudiop->startInternetStream(status); + return false; + } + } +#endif +#ifdef LL_LLFLOATERAO_H + else if(command == std::string(sPhoenixCmdLineAO)) + { + std::string status; + if(i >> status) + { + if (status == "on" ) + { + gSavedPerAccountSettings.setBOOL("PhoenixAOEnabled",TRUE); +// LLFloaterAO::init(); + LLFloaterAO::run(); + } + else if (status == "off" ) + { + gSavedPerAccountSettings.setBOOL("PhoenixAOEnabled",FALSE); + LLFloaterAO::run(); + } + else if (status == "sit" ) + { + gSavedPerAccountSettings.setBOOL("PhoenixAOSitsEnabled",!gSavedPerAccountSettings.getBOOL("PhoenixAOSitsEnabled")); + } + } + return false; + } +#endif + else if(command == std::string(sPhoenixCmdLineKeyToName)) + { + LLUUID targetKey; + if(i >> targetKey) + { + std::string object_name; + gCacheName->getFullName(targetKey, object_name); + char buffer[DB_IM_MSG_BUF_SIZE * 2]; + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + object_name = RlvStrings::getAnonym(object_name); + } + snprintf(buffer,sizeof(buffer),"%s: (%s)",targetKey.asString().c_str(), object_name.c_str()); + cmdline_printchat(std::string(buffer)); + } + return false; + } + else if(command == "/touch") + { + LLUUID targetKey; + if(i >> targetKey) + { + LLViewerObject* myObject = gObjectList.findObject(targetKey); + char buffer[DB_IM_MSG_BUF_SIZE * 2]; + + if (!myObject) + { + snprintf(buffer,sizeof(buffer),"Object with key %s not found!",targetKey.asString().c_str()); + cmdline_printchat(std::string(buffer)); + return false; + } + + if((!rlv_handler_t::isEnabled()) || (gRlvHandler.canTouch(myObject))) + { + LLMessageSystem *msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ObjectGrab); + msg->nextBlockFast( _PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast( _PREHASH_ObjectData); + msg->addU32Fast( _PREHASH_LocalID, myObject->mLocalID); + msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero ); + msg->nextBlock("SurfaceInfo"); + msg->addVector3("UVCoord", LLVector3::zero); + msg->addVector3("STCoord", LLVector3::zero); + msg->addS32Fast(_PREHASH_FaceIndex, 0); + msg->addVector3("Position", myObject->getPosition()); + msg->addVector3("Normal", LLVector3::zero); + msg->addVector3("Binormal", LLVector3::zero); + msg->sendMessage( myObject->getRegion()->getHost()); + + // *NOTE: Hope the packets arrive safely and in order or else + // there will be some problems. + // *TODO: Just fix this bad assumption. + msg->newMessageFast(_PREHASH_ObjectDeGrab); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_LocalID, myObject->mLocalID); + msg->nextBlock("SurfaceInfo"); + msg->addVector3("UVCoord", LLVector3::zero); + msg->addVector3("STCoord", LLVector3::zero); + msg->addS32Fast(_PREHASH_FaceIndex, 0); + msg->addVector3("Position", myObject->getPosition()); + msg->addVector3("Normal", LLVector3::zero); + msg->addVector3("Binormal", LLVector3::zero); + msg->sendMessage(myObject->getRegion()->getHost()); + snprintf(buffer,sizeof(buffer),"Touched object with key %s",targetKey.asString().c_str()); + cmdline_printchat(std::string(buffer)); + } + } + return false; + } + else if(command == "/siton") + { + LLUUID targetKey; + if(i >> targetKey) + { + LLViewerObject* myObject = gObjectList.findObject(targetKey); + char buffer[DB_IM_MSG_BUF_SIZE * 2]; + + if (!myObject) + { + snprintf(buffer,sizeof(buffer),"Object with key %s not found!",targetKey.asString().c_str()); + cmdline_printchat(std::string(buffer)); + return false; + } + if((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(myObject, LLVector3::zero))) + { + LLMessageSystem *msg = gMessageSystem; + msg->newMessageFast(_PREHASH_AgentRequestSit); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_TargetObject); + msg->addUUIDFast(_PREHASH_TargetID, targetKey); + msg->addVector3Fast(_PREHASH_Offset, LLVector3::zero); + gAgent.getRegion()->sendReliableMessage(); + + snprintf(buffer,sizeof(buffer),"Sat on object with key %s",targetKey.asString().c_str()); + cmdline_printchat(std::string(buffer)); + } + } + return false; + } + else if(command == "/standup") + { + if((!rlv_handler_t::isEnabled()) || (gRlvHandler.canStand( ))) + { + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + cmdline_printchat(std::string("Standing up")); + } + return false; + } + else if(command == std::string(sPhoenixCmdLineOfferTp)) + { + std::string avatarKey; +// llinfos << "CMD DEBUG 0 " << command << " " << avatarName << llendl; + if(i >> avatarKey) + { +// llinfos << "CMD DEBUG 0 afterif " << command << " " << avatarName << llendl; + LLUUID tempUUID; + if(LLUUID::parseUUID(avatarKey, &tempUUID)) + { + char buffer[DB_IM_MSG_BUF_SIZE * 2]; + LLDynamicArray ids; + ids.push_back(tempUUID); + std::string tpMsg="Join me!"; + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_StartLure); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Info); + msg->addU8Fast(_PREHASH_LureType, (U8)0); + + msg->addStringFast(_PREHASH_Message, tpMsg); + for(LLDynamicArray::iterator itr = ids.begin(); itr != ids.end(); ++itr) + { + msg->nextBlockFast(_PREHASH_TargetData); + msg->addUUIDFast(_PREHASH_TargetID, *itr); + } + gAgent.sendReliableMessage(); + snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str()); + cmdline_printchat(std::string(buffer)); + return false; + } + } + } + + else if(command == std::string(sPhoenixCmdLineGround)) + { + LLVector3 agentPos = gAgent.getPositionAgent(); + U64 agentRegion = gAgent.getRegion()->getHandle(); + LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],LLWorld::getInstance()->resolveLandHeightAgent(agentPos)); + LLVector3d pos_global = from_region_handle(agentRegion); + pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]); + gAgent.teleportViaLocation(pos_global); + return false; + } + else if(command == std::string(sPhoenixCmdLineHeight)) + { + F32 z; + if(i >> z) + { + LLVector3 agentPos = gAgent.getPositionAgent(); + U64 agentRegion = gAgent.getRegion()->getHandle(); + LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],z); + LLVector3d pos_global = from_region_handle(agentRegion); + pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]); + gAgent.teleportViaLocation(pos_global); + return false; + } + } + else if(command == std::string(sPhoenixCmdLineTeleportHome)) + { + gAgent.teleportHome(); + return false; + } + else if(command == std::string(sPhoenixCmdLineRezPlatform)) + { + if(!(gRlvHandler.hasBehaviour(RLV_BHVR_REZ))) + { + F32 width; + if (i >> width) cmdline_rezplat(false, width); + else cmdline_rezplat(); + } + return false; + } + else if(command == std::string(sPhoenixCmdLineMapTo)) + { + if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek + { + LLVector3d agentPos = gAgent.getPositionGlobal(); + S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) ); + S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) ); + S32 agent_z = llround( (F32)agentPos.mdV[VZ] ); + std::string region_name = LLWeb::escapeURL(revised_text.substr(command.length()+1)); + std::string url; + + if(!sPhoenixCmdLineMapToKeepPos) + { + agent_x = 128; + agent_y = 128; + agent_z = 0; + } + + url = llformat("secondlife:///app/teleport/%s/%d/%d/%d",region_name.c_str(),agent_x,agent_y,agent_z); + LLURLDispatcher::dispatch(url, NULL, true); + } + return false; + } +#ifdef LL_CALC_H + else if(command == *sPhoenixCmdLineCalc)//Cryogenic Blitz + { + bool success; + F32 result = 0.f; + if(revised_text.length() > command.length() + 1) + { + + std::string expr = revised_text.substr(command.length()+1); + LLStringUtil::toUpper(expr); + success = LLCalc::getInstance()->evalString(expr, result); + + std::string out; + + if (!success) + { + out = "Calculation Failed"; + } + else + { + // Replace the expression with the result + std::ostringstream result_str; + result_str << expr; + result_str << " = "; + result_str << result; + out = result_str.str(); + } + cmdline_printchat(out); + return false; + } + } +#endif +#if 0 + else if(command == std::string(sPhoenixCmdLineTP2)) + { + if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek + { + std::string name = revised_text.substr(command.length()+1); + cmdline_tp2name(name); + } + return false; + } +#endif + else if (revised_text == "xyzzy") + { + //Zwag: I wonder how many people will actually get this? + cmdline_printchat("Nothing happens."); + return false; + } + else if (revised_text == "/pimps") + { + //Thanks to the pimp's horrible code for shutting down the site... + cmdline_printchat("Pimps can't code."); + return true;//dont block chat + } +#ifdef LGG_AUTO_CORRECT + else if(revised_text == "/ac") + { + lggAutoCorrectFloaterStart::show(TRUE,NULL); + cmdline_printchat("Displaying Auto Correction Floater."); + return false; + } + else if(command == std::string(sPhoenixCmdLineAutocorrect)) + { + std::string info = revised_text.substr(std::string(sPhoenixCmdLineAutocorrect).length()+1); + //addac list name|wrong word|right word + int bar = info.find("|"); + if (bar==std::string::npos) + { + cmdline_printchat("Wrong usage, correct usage is"+ + std::string(sPhoenixCmdLineAutocorrect)+" list Name|wrong word|right word."); + return false; + } + + + std::string listName = info.substr(0,bar); + info = info.substr(bar+1); + + bar = info.find("|"); + if (bar==std::string::npos) + { + cmdline_printchat("Wrong usage, correct usage is"+ + std::string(sPhoenixCmdLineAutocorrect)+" list Name|wrong word|right word."); + return false; + } + + std::string wrong = info.substr(0,bar); + std::string right = info.substr(bar+1); + if(LGGAutoCorrect::getInstance()->addEntryToList(wrong,right,listName)) + { + cmdline_printchat("Added "+wrong+"=>"+right+" to the "+listName+" list."); + LGGAutoCorrect::getInstance()->save(); + return false; + } + + } +#endif +#if 0 //Uh, what do i do here? LGG can you help me here? + else if(command == std::string(sPhoenixCmdLineClearChat)) + { + LLFloaterChat* chat = LLFloaterChat::getInstance(LLSD()); + if(chat) + { + LLViewerTextEditor* history_editor = chat->getChild("Chat History Editor"); + LLViewerTextEditor* history_editor_with_mute = chat->getChild("Chat History Editor with mute"); + history_editor->clear(); + history_editor_with_mute->clear(); + return false; + } + } +#endif + else if(command == "zdrop") + { + std::string setting; + if(i >> setting) + { + if(setting == "on") + { + if(zdrop != NULL) + { + cmdline_printchat("Zdrop is already active."); + } + else + { + std::string loldest; + if(i >> loldest) + { + cmdline_printchat("Beginning Zdrop."); + cmdline_printchat("Verifying destination prim is present inworld..."); + if(loldest.length() != 36) + { + cmdline_printchat("UUID entered is of an invalid length! (Hint: use the \"copy key\" button in the build menu.)"); + } + else if (gObjectList.findObject(LLUUID(loldest)) == false) + { + cmdline_printchat("Unable to locate object. Please verify the object is rezzed and in view, and that the UUID is correct."); + } + else + { + std::string lolfolder; + std::string tmp; + while(i >> tmp) + { + lolfolder = lolfolder + tmp+ " "; + } + try + { + lolfolder = lolfolder.substr(0,lolfolder.length() - 1); + LLUUID folder = gInventory.findCategoryByName(lolfolder); + if(folder.notNull()) + { + cmdline_printchat("Verifying folder location..."); + std::stack lolstack; + LLDynamicArray > lolinv = findInventoryInFolder(lolfolder); + for(LLDynamicArray >::iterator it = lolinv.begin(); it != lolinv.end(); ++it) + { + LLViewerInventoryItem* item = *it; + lolstack.push(item); + } + if(lolstack.size()) + { + cmdline_printchat(llformat("Found folder \"%s\".", lolfolder.c_str())); + cmdline_printchat(llformat("Found prim \"%s\".", loldest.c_str())); + cmdline_printchat(llformat("Transferring inventory items from \"%s\" to prim \"%s\".", lolfolder.c_str(), loldest.c_str())); + cmdline_printchat("WARNING: No-copy items will be moved to the destination prim!"); + cmdline_printchat("Do not have the prim selected while transfer is running to reduce the chances of \"Inventory creation on in-world object failed.\""); + cmdline_printchat("Use \"Zdrop off\" to stop the transfer"); + LLUUID sdest = LLUUID(loldest); + zdrop = new JCZdrop(lolstack, sdest, lolfolder.c_str(), loldest.c_str()); + } + } + else + { + cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", lolfolder.c_str())); + cmdline_printchat("Zdrop cannot work if the folder is inside another folder."); + } + } + catch(std::out_of_range e) + { + cmdline_printchat("The Zdrop command transfers items from your inventory to a rezzed prim without the need to wait for the contents of the prim to load. No-copy items are moved to the prim. All other items are copied."); + cmdline_printchat("Valid command: Zdrop (rezzed prim UUID) (source inventory folder name)"); + } + } + } + else + { + cmdline_printchat("Please specify an object UUID to copy the items in this folder to."); + } + } + } + else if(setting == "off") + { + if(zdrop == NULL) + { + cmdline_printchat("Zdrop is already deactivated."); + } + else + { + zdrop ->mRunning = TRUE; + delete zdrop; + zdrop = NULL; + } + } + else + { + cmdline_printchat(llformat("Invalid command: \"%s\". Valid commands: Zdrop on (source inventory folder) (rezzed prim UUID) ; Zdrop off", setting.c_str())); + } + } + else + { + cmdline_printchat("The Zdrop command transfers items from your inventory to a rezzed prim without the need to wait for the contents of the prim to load. No-copy items are moved to the prim. All other items are copied."); + cmdline_printchat("Valid commands: Zdrop on (rezzed prim UUID) (source inventory folder name) ; Zdrop off"); + } + return false; + } + else if(command == "ztake") + { + std::string setting; + if(i >> setting) + { + if(setting == "on") + { + if(ztake != NULL) + { + cmdline_printchat("Ztake is already active."); + } + else + { + cmdline_printchat("Beginning Ztake."); + cmdline_printchat("Verifying folder location..."); + std::string folder_name; + std::string tmp; + while(i >> tmp) + { + folder_name = folder_name + tmp + " "; + } + try + { + folder_name = folder_name.substr(0,folder_name.length() - 1); + LLUUID folder = gInventory.findCategoryByName(folder_name); + if(folder.notNull()) + { + cmdline_printchat(llformat("Found destination folder \"%s\".", folder_name.c_str())); + ztake = new JCZtake(folder); + } + else + { + cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); + cmdline_printchat("Ztake cannot work if the folder is inside another folder."); + } + } + catch(std::out_of_range e) + { + cmdline_printchat("Please specify a destination folder in your inventory."); + } + } + } + else if(setting == "off") + { + if(ztake == NULL) + { + cmdline_printchat("Ztake is already deactivated."); + } + else + { + ztake->mRunning = TRUE; + delete ztake; + ztake = NULL; + } + } + else + { + cmdline_printchat(llformat("Invalid command: \"%s\". Valid commands: Ztake on (destination inventory folder) ; Ztake off", setting.c_str())); + } + return false; + } + else + { + cmdline_printchat("The Ztake command copies selected rezzed objects into the folder you specify in your inventory."); + cmdline_printchat("Valid commands: Ztake on (destination inventory folder name) ; Ztake off"); + } + return false; + } + else if(command == "lpackage") + { + std::string loldest; + if(i >> loldest) + { + cmdline_printchat("Verifying destination prim is present inworld..."); + if(loldest.length() != 36) + { + cmdline_printchat("UUID entered is of an invalid length! (Hint: use the \"copy key\" button in the build menu.)"); + } + else if (gObjectList.findObject(LLUUID(loldest)) == false) + { + cmdline_printchat("Unable to locate object. Please verify the object is rezzed, in view, and that the UUID is correct."); + } + else + { + std::string folder_name; + std::string tmp; + while(i >> tmp) + { + folder_name = folder_name + tmp + " "; + } + try + { + folder_name = folder_name.substr(0,folder_name.length() - 1); + LLUUID folder = gInventory.findCategoryByName(folder_name); + if(folder.notNull()) + { + cmdline_printchat(llformat("Found destination folder \"%s\".", folder_name.c_str())); + ztake = new JCZtake(folder, true, LLUUID(loldest), folder_name); + } + else + { + cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); + cmdline_printchat("The packager cannot work if the folder is inside another folder."); + } + } + catch(std::out_of_range e) + { + cmdline_printchat("Please specify a destination folder in your inventory."); + } + } + } + else + { + cmdline_printchat(llformat("Packager usage: \"%s destination_prim_UUID inventory folder name\"",command.c_str())); + } + return false; + } + else if(command == "mtake") + { + std::string setting; + if(i >> setting) + { + if(setting == "on") + { + if(mtake != NULL) + { + cmdline_printchat("Mtake is already active."); + } + else + { + cmdline_printchat("Beginning Mtake."); + cmdline_printchat("Verifying folder location..."); + std::string folder_name; + std::string tmp; + while(i >> tmp) + { + folder_name = folder_name + tmp + " "; + } + try + { + folder_name = folder_name.substr(0,folder_name.length() - 1); + LLUUID folder = gInventory.findCategoryByName(folder_name); + if(folder.notNull()) + { + cmdline_printchat(llformat("Found destination folder \"%s\".", folder_name.c_str())); + mtake = new TMZtake(folder); + } + else + { + cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); + cmdline_printchat("Mtake cannot work if the folder is inside another folder."); + } + } + catch(std::out_of_range e) + { + cmdline_printchat("Please specify a destination folder in your inventory."); + } + } + } + else if(setting == "off") + { + if(mtake == NULL) + { + cmdline_printchat("Mtake is already deactivated."); + } + else + { + mtake->mRunning = TRUE; + delete mtake; + mtake = NULL; + } + } + else + { + cmdline_printchat(llformat("Invalid command: \"%s\". Valid commands: Mtake on (destination inventory folder) ; Mtake off", setting.c_str())); + } + return false; + } + else + { + cmdline_printchat("The Mtake command renames selected rezzed objects to the dimensions of the prim, then copies them into the folder you specify in your inventory."); + cmdline_printchat("Valid commands: Mtake on (destination inventory folder name) ; Mtake off"); + } + return false; + } + else if(command == "invrepair") + { + invrepair(); + } + } + } + return true; +} + +//case insensitive search for avatar in draw distance +//TODO: make this use the avatar list floaters list so we have EVERYONE +// even if they are out of draw distance. +//TODO: re-hock this to the new radar system +#if 0 +LLUUID cmdline_partial_name2key(std::string partial_name) +{ + std::vector avatars; + std::string av_name; + LLStringUtil::toLower(partial_name); + LLWorld::getInstance()->getAvatars(&avatars); + typedef std::vector::const_iterator av_iter; + bool has_avatarlist = (LLFloaterAvatarList::getInstance() ? true : false); + if(has_avatarlist) + LLFloaterAvatarList::getInstance()->updateAvatarList(); + for(av_iter i = avatars.begin(); i != avatars.end(); ++i) + { + if(has_avatarlist) + { + LLAvatarListEntry* entry = LLFloaterAvatarList::getInstance()->getAvatarEntry(*i); + if(entry) + { + av_name = entry->getName(); + } + } + if (av_name.empty() && !gCacheName->getFullName(*i, av_name)) + { + LLViewerObject *obj = gObjectList.findObject(*i); + if(obj) + { + LLVOAvatar* avatarp = dynamic_cast(obj); + av_name = avatarp->getFullname(); + } + } + LLStringUtil::toLower(av_name); + if(strstr(av_name.c_str(), partial_name.c_str())) + { + return *i; + } + } + return LLUUID::null; +} + + +void cmdline_tp2name(std::string target) +{ + LLUUID avkey = cmdline_partial_name2key(target); + if(avkey.isNull()) + { + cmdline_printchat("Avatar not found."); + return; + } + LLFloaterAvatarList* avlist = LLFloaterAvatarList::getInstance(); + LLViewerObject* obj = gObjectList.findObject(avkey); + if(obj) + { + LLVector3d pos = obj->getPositionGlobal(); + pos.mdV[VZ] += 2.0; + gAgent.teleportViaLocation(pos); + } + else if(avlist) + { + LLAvatarListEntry* entry = avlist->getAvatarEntry(avkey); + if(entry) + { + LLVector3d pos = entry->getPosition(); + pos.mdV[VZ] += 2.0; + gAgent.teleportViaLocation(pos); + } + } +} + +#endif + +void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat() will still work... just will use the saved value +{ + LLVector3 agentPos = gAgent.getPositionAgent()+(gAgent.getVelocity()*(F32)0.333); + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ObjectAdd); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU8Fast(_PREHASH_PCode, LL_PCODE_VOLUME); + msg->addU8Fast(_PREHASH_Material, LL_MCODE_METAL); + + if(agentPos.mV[2] > 4096.0)msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED); + else msg->addU32Fast(_PREHASH_AddFlags, 0); + + LLVolumeParams volume_params; + + volume_params.setType( LL_PCODE_PROFILE_CIRCLE, 0x21 ); //TODO: make this use LL_PCODE_PATH_CIRCLE_33 again instead of the hardcoded value + volume_params.setRatio( 2, 2 ); + volume_params.setShear( 0, 0 ); + volume_params.setTaper(2.0f,2.0f); + volume_params.setTaperX(0.f); + volume_params.setTaperY(0.f); + + LLVolumeMessage::packVolumeParams(&volume_params, msg); + LLVector3 rezpos = agentPos - LLVector3(0.0f,0.0f,2.5f); + LLQuaternion rotation; + rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis); + + static LLCachedControl sPhoenixCmdLinePlatformSize(gSavedSettings, "PhoenixCmdLinePlatformSize"); + + if (use_saved_value) visual_radius = sPhoenixCmdLinePlatformSize; + F32 realsize = visual_radius / 3.0f; + if (realsize < 0.01f) realsize = 0.01f; + else if (realsize > 10.0f) realsize = 10.0f; + + msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.01f,realsize,realsize) ); + msg->addQuatFast(_PREHASH_Rotation, rotation ); + msg->addVector3Fast(_PREHASH_RayStart, rezpos ); + msg->addVector3Fast(_PREHASH_RayEnd, rezpos ); + msg->addU8Fast(_PREHASH_BypassRaycast, (U8)1 ); + msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE ); + msg->addU8Fast(_PREHASH_State, 0); + msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null ); + msg->sendReliable(gAgent.getRegionHost()); +} + +void cmdline_printchat(std::string message) +{ + + LLChat chat; + chat.mText = message; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLSD args; + args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + /*LLNearbyChatHandler* handle = dynamic_cast(mNotifyHandlers["nearbychat"].get()); + if(handle) + { + handle->processChat(chat, LLSD()); + } + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat", LLSD()); + if(nearby_chat) + { + nearby_chat->addMessage(chat); + }*/ +} diff --git a/indra/newview/chatbar_as_cmdline.h b/indra/newview/chatbar_as_cmdline.h new file mode 100644 index 0000000000..6c646aeb1d --- /dev/null +++ b/indra/newview/chatbar_as_cmdline.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2010 + * + * Modular Systems All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. Neither the name Modular Systems nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS “AS IS” + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "llviewerprecompiledheaders.h" + +#include "llchatbar.h" + +bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture = false); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 430d5a103e..c16d5e1185 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -380,6 +380,28 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe return rv; } +LLUUID LLInventoryModel::findCategoryByName(std::string name) +{ + LLUUID root_id = gInventory.getRootFolderID(); + if(root_id.notNull()) + { + cat_array_t* cats = NULL; + cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + if(cats) + { + S32 count = cats->count(); + for(S32 i = 0; i < count; ++i) + { + if(cats->get(i)->getName() == name) + { + return cats->get(i)->getUUID(); + } + } + } + } + return LLUUID::null; +} + // Convenience function to create a new category. You could call // updateCategory() with a newly generated UUID category, but this // version will take care of details like what the name should be diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index f6728fd575..43b16a9b2e 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -351,6 +351,7 @@ public: // Creation //-------------------------------------------------------------------- public: + LLUUID findCategoryByName(std::string name); // Returns the UUID of the new category. If you want to use the default // name based on type, pass in a NULL to the 'name' parameter. LLUUID createNewCategory(const LLUUID& parent_id, diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 266da58174..a82d407423 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -64,6 +64,8 @@ #include "llfavoritesbar.h" #include "llagentui.h" +#include "llstatusbar.h" + #include //-- LLTeleportHistoryMenuItem ----------------------------------------------- @@ -710,6 +712,7 @@ void LLNavigationBar::handleLoginComplete() { LLTeleportHistory::getInstance()->handleLoginComplete(); LLPanelTopInfoBar::instance().handleLoginComplete(); + gStatusBar->handleLoginComplete(); mCmbLocation->handleLoginComplete(); } diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 2157c74080..62c2d6338c 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -50,6 +50,7 @@ // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) #include "rlvhandler.h" // [/RLVa:KB] +#include "chatbar_as_cmdline.h" S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; @@ -639,7 +640,7 @@ void LLNearbyChatBar::sendChat( EChatType type ) type = processChatTypeTriggers(type, utf8_revised_text); - if (!utf8_revised_text.empty()) + if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, TRUE); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index d83cb370ea..323f2b7285 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -67,6 +67,15 @@ #include "llviewerthrottle.h" #include "lluictrlfactory.h" +#include "llagentui.h" +#include "llclipboard.h" +#include "lllandmarkactions.h" +#include "lllocationinputctrl.h" +#include "llparcel.h" +#include "llsidetray.h" +#include "llslurl.h" +#include "llviewerinventory.h" + #include "lltoolmgr.h" #include "llfocusmgr.h" #include "llappviewer.h" @@ -108,6 +117,23 @@ const S32 TEXT_HEIGHT = 18; static void onClickVolume(void*); +class LLStatusBar::LLParcelChangeObserver : public LLParcelObserver +{ +public: + LLParcelChangeObserver(LLStatusBar* topInfoBar) : mTopInfoBar(topInfoBar) {} + +private: + /*virtual*/ void changed() + { + if (mTopInfoBar) + { + mTopInfoBar->updateParcelIcons(); + } + } + + LLStatusBar* mTopInfoBar; +}; + LLStatusBar::LLStatusBar(const LLRect& rect) : LLPanel(), mTextTime(NULL), @@ -126,6 +152,9 @@ LLStatusBar::LLStatusBar(const LLRect& rect) mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); + + LLUICtrl::CommitCallbackRegistry::currentRegistrar() + .add("TopInfoBar.Action", boost::bind(&LLStatusBar::onContextMenuItemClicked, this, _2)); buildFromFile("panel_status_bar.xml"); } @@ -137,6 +166,27 @@ LLStatusBar::~LLStatusBar() delete mHealthTimer; mHealthTimer = NULL; + + if (mParcelChangedObserver) + { + LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver); + delete mParcelChangedObserver; + } + + if (mParcelPropsCtrlConnection.connected()) + { + mParcelPropsCtrlConnection.disconnect(); + } + + if (mParcelMgrConnection.connected()) + { + mParcelMgrConnection.disconnect(); + } + + if (mShowCoordsCtrlConnection.connected()) + { + mShowCoordsCtrlConnection.disconnect(); + } // LLView destructor cleans up children } @@ -149,6 +199,8 @@ LLStatusBar::~LLStatusBar() void LLStatusBar::draw() { refresh(); + updateParcelInfoText(); + updateHealth(); LLPanel::draw(); } @@ -227,6 +279,34 @@ BOOL LLStatusBar::postBuild() mPanelNearByMedia->setVisible(FALSE); mScriptOut = getChildView("scriptout"); + + mInfoBtn = getChild("place_info_btn"); + mInfoBtn->setClickedCallback(boost::bind(&LLStatusBar::onInfoButtonClicked, this)); + + mParcelInfoText = getChild("parcel_info_text"); + mDamageText = getChild("damage_text"); + + initParcelIcons(); + + mParcelChangedObserver = new LLParcelChangeObserver(this); + LLViewerParcelMgr::getInstance()->addObserver(mParcelChangedObserver); + + // Connecting signal for updating parcel icons on "Show Parcel Properties" setting change. + LLControlVariable* ctrl = gSavedSettings.getControl("NavBarShowParcelProperties").get(); + if (ctrl) + { + mParcelPropsCtrlConnection = ctrl->getSignal()->connect(boost::bind(&LLStatusBar::updateParcelIcons, this)); + } + + // Connecting signal for updating parcel text on "Show Coordinates" setting change. + ctrl = gSavedSettings.getControl("NavBarShowCoordinates").get(); + if (ctrl) + { + mShowCoordsCtrlConnection = ctrl->getSignal()->connect(boost::bind(&LLStatusBar::onNavBarShowParcelPropertiesCtrlChanged, this)); + } + + mParcelMgrConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( + boost::bind(&LLStatusBar::onAgentParcelChange, this)); return TRUE; } @@ -543,3 +623,279 @@ public: }; // register with command dispatch system LLBalanceHandler gBalanceHandler; + + +void LLStatusBar::initParcelIcons() +{ + mParcelIcon[VOICE_ICON] = getChild("voice_icon"); + mParcelIcon[FLY_ICON] = getChild("fly_icon"); + mParcelIcon[PUSH_ICON] = getChild("push_icon"); + mParcelIcon[BUILD_ICON] = getChild("build_icon"); + mParcelIcon[SCRIPTS_ICON] = getChild("scripts_icon"); + mParcelIcon[DAMAGE_ICON] = getChild("damage_icon"); + + mParcelIcon[VOICE_ICON]->setMouseDownCallback(boost::bind(&LLStatusBar::onParcelIconClick, this, VOICE_ICON)); + mParcelIcon[FLY_ICON]->setMouseDownCallback(boost::bind(&LLStatusBar::onParcelIconClick, this, FLY_ICON)); + mParcelIcon[PUSH_ICON]->setMouseDownCallback(boost::bind(&LLStatusBar::onParcelIconClick, this, PUSH_ICON)); + mParcelIcon[BUILD_ICON]->setMouseDownCallback(boost::bind(&LLStatusBar::onParcelIconClick, this, BUILD_ICON)); + mParcelIcon[SCRIPTS_ICON]->setMouseDownCallback(boost::bind(&LLStatusBar::onParcelIconClick, this, SCRIPTS_ICON)); + mParcelIcon[DAMAGE_ICON]->setMouseDownCallback(boost::bind(&LLStatusBar::onParcelIconClick, this, DAMAGE_ICON)); + + mDamageText->setText(LLStringExplicit("100%")); +} + +void LLStatusBar::handleLoginComplete() +{ + // An agent parcel update hasn't occurred yet, so + // we have to manually set location and the icons. + update(); +} + +void LLStatusBar::onNavBarShowParcelPropertiesCtrlChanged() +{ + std::string new_text; + + // don't need to have separate show_coords variable; if user requested the coords to be shown + // they will be added during the next call to the draw() method. + buildLocationString(new_text, false); + setParcelInfoText(new_text); +} + +void LLStatusBar::buildLocationString(std::string& loc_str, bool show_coords) +{ + LLAgentUI::ELocationFormat format = + (show_coords ? LLAgentUI::LOCATION_FORMAT_FULL : LLAgentUI::LOCATION_FORMAT_NO_COORDS); + + if (!LLAgentUI::buildLocationString(loc_str, format)) + { + loc_str = "???"; + } +} + +void LLStatusBar::setParcelInfoText(const std::string& new_text) +{ + const LLFontGL* font = mParcelInfoText->getDefaultFont(); + S32 new_text_width = font->getWidth(new_text); + + mParcelInfoText->setText(new_text); + + LLRect rect = mParcelInfoText->getRect(); + rect.setOriginAndSize(rect.mLeft, rect.mBottom, new_text_width, rect.getHeight()); + + mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE); + mParcelInfoText->setRect(rect); + layoutParcelIcons(); +} + +void LLStatusBar::update() +{ + std::string new_text; + + // don't need to have separate show_coords variable; if user requested the coords to be shown + // they will be added during the next call to the draw() method. + buildLocationString(new_text, false); + setParcelInfoText(new_text); + + updateParcelIcons(); +} + +void LLStatusBar::updateParcelInfoText() +{ + static LLUICachedControl show_coords("NavBarShowCoordinates", false); + + if (show_coords) + { + std::string new_text; + + buildLocationString(new_text, show_coords); + setParcelInfoText(new_text); + } +} + +void LLStatusBar::updateParcelIcons() +{ + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + + LLViewerRegion* agent_region = gAgent.getRegion(); + LLParcel* agent_parcel = vpm->getAgentParcel(); + if (!agent_region || !agent_parcel) + return; + + if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) + { + LLParcel* current_parcel; + LLViewerRegion* selection_region = vpm->getSelectionRegion(); + LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel(); + + // If agent is in selected parcel we use its properties because + // they are updated more often by LLViewerParcelMgr than agent parcel properties. + // See LLViewerParcelMgr::processParcelProperties(). + // This is needed to reflect parcel restrictions changes without having to leave + // the parcel and then enter it again. See EXT-2987 + if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID() + && selection_region == agent_region) + { + current_parcel = selected_parcel; + } + else + { + current_parcel = agent_parcel; + } + + bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel); + bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel); + bool allow_push = vpm->allowAgentPush(agent_region, current_parcel); + bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610. + bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel); + bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel); + + // Most icons are "block this ability" + mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); + mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); + mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); + mParcelIcon[BUILD_ICON]->setVisible( !allow_build ); + mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); + mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); + mDamageText->setVisible(allow_damage); + + layoutParcelIcons(); + } + else + { + for (S32 i = 0; i < ICON_COUNT; ++i) + { + mParcelIcon[i]->setVisible(false); + } + mDamageText->setVisible(false); + } +} + +void LLStatusBar::updateHealth() +{ + static LLUICachedControl show_icons("NavBarShowParcelProperties", false); + + // *FIXME: Status bar owns health information, should be in agent + if (show_icons && gStatusBar) + { + static S32 last_health = -1; + S32 health = gStatusBar->getHealth(); + if (health != last_health) + { + std::string text = llformat("%d%%", health); + mDamageText->setText(text); + last_health = health; + } + } +} + +void LLStatusBar::layoutParcelIcons() +{ + // TODO: remove hard-coded values and read them as xml parameters + static const int FIRST_ICON_HPAD = 16; + static const int LAST_ICON_HPAD = 11; + + S32 left = mParcelInfoText->getRect().mRight + FIRST_ICON_HPAD; + + left = layoutWidget(mDamageText, left); + + for (int i = ICON_COUNT - 1; i >= 0; --i) + { + left = layoutWidget(mParcelIcon[i], left); + } +} + +S32 LLStatusBar::layoutWidget(LLUICtrl* ctrl, S32 left) +{ + // TODO: remove hard-coded values and read them as xml parameters + static const int ICON_HPAD = 2; + + if (ctrl->getVisible()) + { + LLRect rect = ctrl->getRect(); + rect.mRight = left + rect.getWidth(); + rect.mLeft = left; + + ctrl->setRect(rect); + left += rect.getWidth() + ICON_HPAD; + } + + return left; +} + +void LLStatusBar::onParcelIconClick(EParcelIcon icon) +{ + switch (icon) + { + case VOICE_ICON: + LLNotificationsUtil::add("NoVoice"); + break; + case FLY_ICON: + LLNotificationsUtil::add("NoFly"); + break; + case PUSH_ICON: + LLNotificationsUtil::add("PushRestricted"); + break; + case BUILD_ICON: + LLNotificationsUtil::add("NoBuild"); + break; + case SCRIPTS_ICON: + { + LLViewerRegion* region = gAgent.getRegion(); + if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) + { + LLNotificationsUtil::add("ScriptsStopped"); + } + else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) + { + LLNotificationsUtil::add("ScriptsNotRunning"); + } + else + { + LLNotificationsUtil::add("NoOutsideScripts"); + } + break; + } + case DAMAGE_ICON: + LLNotificationsUtil::add("NotSafe"); + break; + case ICON_COUNT: + break; + // no default to get compiler warning when a new icon gets added + } +} + +void LLStatusBar::onAgentParcelChange() +{ + update(); +} + +void LLStatusBar::onContextMenuItemClicked(const LLSD::String& item) +{ + if (item == "landmark") + { + LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos(); + + if(landmark == NULL) + { + LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + } + else + { + LLSideTray::getInstance()->showPanel("panel_places", + LLSD().with("type", "landmark").with("id",landmark->getUUID())); + } + } + else if (item == "copy") + { + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl, false); + LLUIString location_str(slurl.getSLURLString()); + + gClipboard.copyFromString(location_str); + } +} + +void LLStatusBar::onInfoButtonClicked() +{ + LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent")); +} diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 2388aeb0c8..96c0b82699 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -43,6 +43,42 @@ class LLFrameTimer; class LLStatGraph; class LLPanelVolumePulldown; class LLPanelNearByMedia; +class LLIconCtrl; +class LLParcelChangeObserver; + + +class LLRegionDetails +{ +public: + LLRegionDetails() : + mRegionName("Unknown"), + mParcelName("Unknown"), + mAccessString("Unknown"), + mX(0), + mY(0), + mZ(0), + mArea (0), + mForSale(FALSE), + mOwner("Unknown"), + mTraffic(0), + mBalance(0), + mPing(0) + { + } + std::string mRegionName; + std::string mParcelName; + std::string mAccessString; + S32 mX; + S32 mY; + S32 mZ; + S32 mArea; + BOOL mForSale; + std::string mOwner; + F32 mTraffic; + S32 mBalance; + std::string mTime; + U32 mPing; +}; class LLStatusBar : public LLPanel @@ -73,6 +109,11 @@ public: void setVisibleForMouselook(bool visible); // some elements should hide in mouselook + /** + * Updates location and parcel icons on login complete + */ + void handleLoginComplete(); + // ACCESSORS S32 getBalance() const; S32 getHealth() const; @@ -81,6 +122,7 @@ public: S32 getSquareMetersCredit() const; S32 getSquareMetersCommitted() const; S32 getSquareMetersLeft() const; + LLRegionDetails mRegionDetails; LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; } @@ -94,10 +136,100 @@ private: void onClickScreen(S32 x, S32 y); static void onClickMediaToggle(void* data); + + class LLParcelChangeObserver; + + friend class LLParcelChangeObserver; + + enum EParcelIcon + { + VOICE_ICON = 0, + FLY_ICON, + PUSH_ICON, + BUILD_ICON, + SCRIPTS_ICON, + DAMAGE_ICON, + ICON_COUNT + }; + + /** + * Initializes parcel icons controls. Called from the constructor. + */ + void initParcelIcons(); + + /** + * Handles clicks on the parcel icons. + */ + void onParcelIconClick(EParcelIcon icon); + + /** + * Handles clicks on the info buttons. + */ + void onInfoButtonClicked(); + + /** + * Called when agent changes the parcel. + */ + void onAgentParcelChange(); + + /** + * Called when context menu item is clicked. + */ + void onContextMenuItemClicked(const LLSD::String& userdata); + + /** + * Called when user checks/unchecks Show Coordinates menu item. + */ + void onNavBarShowParcelPropertiesCtrlChanged(); + + /** + * Shorthand to call updateParcelInfoText() and updateParcelIcons(). + */ + void update(); + + /** + * Updates parcel info text (mParcelInfoText). + */ + void updateParcelInfoText(); + + /** + * Updates parcel icons (mParcelIcon[]). + */ + void updateParcelIcons(); + + /** + * Updates health information (mDamageText). + */ + void updateHealth(); + + /** + * Lays out all parcel icons starting from right edge of the mParcelInfoText + 11px + * (see screenshots in EXT-5808 for details). + */ + void layoutParcelIcons(); + + /** + * Lays out a widget. Widget's rect mLeft becomes equal to the 'left' argument. + */ + S32 layoutWidget(LLUICtrl* ctrl, S32 left); + + /** + * Generates location string and returns it in the loc_str parameter. + */ + void buildLocationString(std::string& loc_str, bool show_coords); + + /** + * Sets new value to the mParcelInfoText and updates the size of the top bar. + */ + void setParcelInfoText(const std::string& new_text); private: + LLTextBox *mTextBalance; + LLTextBox *mTextHealth; LLTextBox *mTextTime; + LLTextBox* mTextParcelName; + LLStatGraph *mSGBandwidth; LLStatGraph *mSGPacketLoss; @@ -114,6 +246,16 @@ private: LLFrameTimer* mHealthTimer; LLPanelVolumePulldown* mPanelVolumePulldown; LLPanelNearByMedia* mPanelNearByMedia; + + LLButton* mInfoBtn; + LLTextBox* mParcelInfoText; + LLTextBox* mDamageText; + LLIconCtrl* mParcelIcon[ICON_COUNT]; + LLParcelChangeObserver* mParcelChangedObserver; + + boost::signals2::connection mParcelPropsCtrlConnection; + boost::signals2::connection mShowCoordsCtrlConnection; + boost::signals2::connection mParcelMgrConnection; }; // *HACK: Status bar owns your cached money balance. JC diff --git a/indra/newview/skins/default/textures/windows/Window_Background.png b/indra/newview/skins/default/textures/windows/Window_Background.png index c6fef8a811..05e2e05c48 100644 Binary files a/indra/newview/skins/default/textures/windows/Window_Background.png and b/indra/newview/skins/default/textures/windows/Window_Background.png differ diff --git a/indra/newview/skins/default/textures/windows/Window_Foreground.png b/indra/newview/skins/default/textures/windows/Window_Foreground.png index 4a1125cabf..f8d749f99d 100644 Binary files a/indra/newview/skins/default/textures/windows/Window_Foreground.png and b/indra/newview/skins/default/textures/windows/Window_Foreground.png differ diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 9442e8bf91..e50c00dbe0 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -21,6 +21,97 @@ image_name="menu_bar.tga" left="0" width="1000" / --> + +