diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 1cfb4635a..421f03efa 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -219,10 +219,6 @@ public: virtual void saveAs() {} virtual void saveAsType(BOOL type=false) {} - // - virtual LLUUID getItemID() { return LLUUID::null; } - // - void setSnapTarget(LLHandle handle) { mSnappedTo = handle; } void clearSnapTarget() { mSnappedTo.markDead(); } LLHandle getSnapTarget() const { return mSnappedTo; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f8e7203b1..7cefb59c6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -693,6 +693,17 @@ Found in Advanced->Rendering->Info Displays Value 0 + FakeAway + + HideFromEditor + 1 + Persist + 0 + Type + Boolean + Value + 0 + InstantMessageLogPathAnyAccount Comment @@ -5493,6 +5504,28 @@ This should be as low as possible, but too low may break functionality Value 1 + ClickActionBuyEnabled + + Comment + Enable click to buy actions in tool pie menu + Persist + 1 + Type + Boolean + Value + 1 + + ClickActionPayEnabled + + Comment + Enable click to pay actions in tool pie menu + Persist + 1 + Type + Boolean + Value + 1 + DoubleClickAutoPilot Comment @@ -5537,10 +5570,21 @@ This should be as low as possible, but too low may break functionality Value 0.10000000149 + DragAndDropDistanceThreshold + + Comment + Number of pixels that mouse should move before triggering drag and drop mode + Persist + 1 + Type + S32 + Value + 3 + DropShadowButton Comment - Drop shadow width for buttons (pixels) + Drop shadow width for buttons (pixels) Persist 1 Type @@ -5647,6 +5691,17 @@ This should be as low as possible, but too low may break functionality Value 1 + EnableGrab + + Comment + Use Ctrl+mouse to grab and manipulate objects + Persist + 1 + Type + Boolean + Value + 1 + EnableGestureSounds Comment @@ -13008,6 +13063,17 @@ This should be as low as possible, but too low may break functionality Value 0 + DisableClickSitOtherOwner + + Comment + Never sit by clicking a prim that isn't owned by you + Persist + 1 + Type + Boolean + Value + 0 + PlayIMSound Comment @@ -16360,6 +16426,17 @@ This should be as low as possible, but too low may break functionality Value 1 + ClickToWalk + + Comment + Click in world to walk to location + Persist + 1 + Type + Boolean + Value + 0 + SimulateFBOFailure Comment diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 68d4a1f03..a0477fdda 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -80,6 +80,9 @@ LLPrefsAscentSys::LLPrefsAscentSys() childSetCommitCallback("AscentCmdLineTP2", onCommitCmdLine, this); childSetCommitCallback("SinguCmdLineAway", onCommitCmdLine, this); + //Security ---------------------------------------------------------------------------- + childSetCommitCallback("disable_click_sit_check", onCommitCheckBox, this); + //Build ------------------------------------------------------------------------------- childSetCommitCallback("next_owner_copy", onCommitCheckBox, this); childSetEnabled("next_owner_transfer", gSavedSettings.getBOOL("NextOwnerCopy")); @@ -129,59 +132,57 @@ LLPrefsAscentSys::~LLPrefsAscentSys() //static void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, void* user_data) { - LLPrefsAscentSys* self = (LLPrefsAscentSys*)user_data; + LLPrefsAscentSys* self = static_cast(user_data); // llinfos << "Change to " << ctrl->getControlName() << " aka " << ctrl->getName() << llendl; - - if (ctrl->getName() == "speed_rez_check") - { - bool enabled = self->childGetValue("speed_rez_check").asBoolean(); - self->childSetEnabled("speed_rez_interval", enabled); - self->childSetEnabled("speed_rez_seconds", enabled); - } - else if (ctrl->getName() == "double_click_teleport_check") - { - bool enabled = self->childGetValue("double_click_teleport_check").asBoolean(); - self->childSetEnabled("center_after_teleport_check", enabled); - self->childSetEnabled("offset_teleport_check", enabled); - } - else if (ctrl->getName() == "system_folder_check") - { - bool enabled = self->childGetValue("system_folder_check").asBoolean(); - self->childSetEnabled("temp_in_system_check", enabled); - } - else if (ctrl->getName() == "enable_clouds") - { - bool enabled = self->childGetValue("enable_clouds").asBoolean(); - self->childSetEnabled("enable_classic_clouds", enabled); - } - else if (ctrl->getName() == "power_user_check") - { - bool enabled = self->childGetValue("power_user_check").asBoolean(); - self->childSetEnabled("power_user_confirm_check", enabled); - self->childSetValue("power_user_confirm_check", false); - } - else if (ctrl->getName() == "power_user_confirm_check") - { - bool enabled = self->childGetValue("power_user_confirm_check").asBoolean(); - gSavedSettings.setBOOL("AscentPowerfulWizard", enabled); - - if (enabled) - { - LLVector3d lpos_global = gAgent.getPositionGlobal(); - gAudiop->triggerSound(LLUUID("58a38e89-44c6-c52b-deb8-9f1ddc527319"), gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - chat.mText = LLTrans::getString("PowerUser1") + "\n" + LLTrans::getString("PowerUser2") + "\n" + LLTrans::getString("Unlocked:") + "\n" + LLTrans::getString("PowerUser3") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser4") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser5"); - LLFloaterChat::addChat(chat); - } - } - else if (ctrl->getName() == "next_owner_copy") + const std::string name = ctrl->getName(); + bool enabled = ctrl->getValue().asBoolean(); + if (name == "speed_rez_check") { - bool copy = gSavedSettings.getBOOL("NextOwnerCopy"); - if (!copy) gSavedSettings.setBOOL("NextOwnerTransfer", true); - self->childSetEnabled("next_owner_transfer", copy); + self->childSetEnabled("speed_rez_interval", enabled); + self->childSetEnabled("speed_rez_seconds", enabled); + } + else if (name == "double_click_teleport_check") + { + self->childSetEnabled("center_after_teleport_check", enabled); + self->childSetEnabled("offset_teleport_check", enabled); + } + else if (name == "system_folder_check") + { + self->childSetEnabled("temp_in_system_check", enabled); + } + else if (name == "enable_clouds") + { + self->childSetEnabled("enable_classic_clouds", enabled); + } + else if (name == "power_user_check") + { + self->childSetEnabled("power_user_confirm_check", enabled); + self->childSetValue("power_user_confirm_check", false); + } + else if (name == "power_user_confirm_check") + { + gSavedSettings.setBOOL("AscentPowerfulWizard", enabled); + + if (enabled) + { + LLVector3d lpos_global = gAgent.getPositionGlobal(); + gAudiop->triggerSound(LLUUID("58a38e89-44c6-c52b-deb8-9f1ddc527319"), gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); + LLChat chat; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + chat.mText = LLTrans::getString("PowerUser1") + "\n" + LLTrans::getString("PowerUser2") + "\n" + LLTrans::getString("Unlocked:") + "\n" + LLTrans::getString("PowerUser3") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser4") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser5"); + LLFloaterChat::addChat(chat); + } + } + else if (name == "disable_click_sit_check") + { + self->childSetEnabled("disable_click_sit_own_check", !enabled); + } + else if (name == "next_owner_copy") + { + if (!enabled) gSavedSettings.setBOOL("NextOwnerTransfer", true); + self->childSetEnabled("next_owner_transfer", enabled); } } @@ -313,6 +314,7 @@ void LLPrefsAscentSys::refreshValues() mDetachBridge = gSavedSettings.getBOOL("SGDetachBridge"); mRevokePermsOnStandUp = gSavedSettings.getBOOL("RevokePermsOnStandUp"); mDisableClickSit = gSavedSettings.getBOOL("DisableClickSit"); + mDisableClickSitOtherOwner = gSavedSettings.getBOOL("DisableClickSitOtherOwner"); mDisplayScriptJumps = gSavedSettings.getBOOL("AscentDisplayTotalScriptJumps"); mNumScriptDiff = gSavedSettings.getF32("Ascentnumscriptdiff"); @@ -463,6 +465,7 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setBOOL("SGDetachBridge", mDetachBridge); gSavedSettings.setBOOL("RevokePermsOnStandUp", mRevokePermsOnStandUp); gSavedSettings.setBOOL("DisableClickSit", mDisableClickSit); + gSavedSettings.setBOOL("DisableClickSitOtherOwner", mDisableClickSitOtherOwner); gSavedSettings.setBOOL("AscentDisplayTotalScriptJumps", mDisplayScriptJumps); gSavedSettings.setF32("Ascentnumscriptdiff", mNumScriptDiff); diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 73765ee39..60cf4f4de 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -104,6 +104,7 @@ protected: BOOL mDetachBridge; BOOL mRevokePermsOnStandUp; BOOL mDisableClickSit; + bool mDisableClickSitOtherOwner; BOOL mDisplayScriptJumps; F32 mNumScriptDiff; //Build ------------------------------------------------------------------------------- diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2610a2732..1f46baa7e 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -229,9 +229,6 @@ private: // Statics // -BOOL LLAgent::exlPhantom = 0; -BOOL LLAgent::mForceTPose = 0; - const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; std::map LLAgent::sTeleportErrorMessages; @@ -652,17 +649,6 @@ BOOL LLAgent::getFlying() const return mControlFlags & AGENT_CONTROL_FLY; } -// Better Set Phantom options ~Charbl -void LLAgent::setPhantom(BOOL phantom) -{ - exlPhantom = phantom; -} - -BOOL LLAgent::getPhantom() -{ - return exlPhantom; -} - //----------------------------------------------------------------------------- // setFlying() //----------------------------------------------------------------------------- @@ -727,8 +713,14 @@ void LLAgent::setFlying(BOOL fly) //----------------------------------------------------------------------------- // toggleFlying() //----------------------------------------------------------------------------- +// static void LLAgent::toggleFlying() { + if ( gAgent.mAutoPilot ) + { + LLToolPie::instance().stopClickToWalk(); + } + BOOL fly = !gAgent.getFlying(); gAgent.setFlying( fly ); @@ -758,20 +750,6 @@ void LLAgent::standUp() // [/RLVa:KB] } -void LLAgent::togglePhantom() -{ - BOOL phan = !(exlPhantom); - - setPhantom( phan ); -} - -void LLAgent::toggleTPosed() -{ - BOOL posed = !(mForceTPose); - - setTPosed(posed); -} - void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) { llinfos << "called" << llendl; @@ -1315,17 +1293,6 @@ LLQuaternion LLAgent::getQuat() const //----------------------------------------------------------------------------- U32 LLAgent::getControlFlags() { -/* - // HACK -- avoids maintenance of control flags when camera mode is turned on or off, - // only worries about it when the flags are measured - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - if ( !(mControlFlags & AGENT_CONTROL_MOUSELOOK) ) - { - mControlFlags |= AGENT_CONTROL_MOUSELOOK; - } - } -*/ return mControlFlags; } @@ -1419,9 +1386,8 @@ void LLAgent::setAFK() //----------------------------------------------------------------------------- void LLAgent::clearAFK() { + if (gSavedSettings.getBOOL("FakeAway")) return; gAwayTriggerTimer.reset(); - if (!gSavedSettings.controlExists("FakeAway")) gSavedSettings.declareBOOL("FakeAway", FALSE, "", NO_PERSIST); - if (gSavedSettings.getBOOL("FakeAway") == TRUE) return; // Gods can sometimes get into away state (via gestures) // without setting the appropriate control flag. JC @@ -1917,8 +1883,7 @@ BOOL LLAgent::needsRenderHead() //----------------------------------------------------------------------------- void LLAgent::startTyping() { - if (gSavedSettings.getBOOL("FakeAway")) - return; + if (gSavedSettings.getBOOL("FakeAway")) return; mTypingTimer.reset(); if (getRenderState() & AGENT_STATE_TYPING) @@ -2035,6 +2000,7 @@ void LLAgent::endAnimationUpdateUI() { (*mMouselookModeOutSignal)(); } + // Only pop if we have pushed... if (TRUE == mViewsPushed) { @@ -4092,6 +4058,7 @@ void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) return; } // [/RLVa:KB] + mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLandmark(landmark_asset_id)); startTeleportRequest(); } @@ -4189,6 +4156,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global) } } // [/RLVa:KB] + mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocation(pos_global)); startTeleportRequest(); } @@ -4261,6 +4229,7 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global) return; } // [/RLVa:KB] + mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocationLookAt(pos_global)); startTeleportRequest(); } @@ -4729,6 +4698,16 @@ void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& dire gMessageSystem->addString("DirectoryVisibility", directory_visibility); gAgent.sendReliableMessage(); } + +void LLAgent::dumpGroupInfo() +{ + llinfos << "group " << mGroupName << llendl; + llinfos << "ID " << mGroupID << llendl; + llinfos << "powers " << mGroupPowers << llendl; + llinfos << "title " << mGroupTitle << llendl; + //llinfos << "insig " << mGroupInsigniaID << llendl; +} + // Draw a representation of current autopilot target void LLAgent::renderAutoPilotTarget() { @@ -4974,4 +4953,5 @@ void LLTeleportRequestViaLocationLookAt::restartTeleport() { gAgent.doTeleportViaLocationLookAt(getPosGlobal()); } + // EOF diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 51b8c2e6e..6ae193677 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -94,12 +94,13 @@ struct LLGroupData // forward declarations -// - +//------------------------------------------------------------------------ +// LLAgent +//------------------------------------------------------------------------ class LLAgent : public LLOldEvents::LLObservable { LOG_CLASS(LLAgent); - + public: friend class LLAgentDropGroupViewerNode; @@ -160,7 +161,7 @@ public: public: void getName(std::string& name); //Legacy void buildFullname(std::string &name) const; //Legacy - // *TODO remove, is not used as of August 20, 2009 + //*TODO remove, is not used as of August 20, 2009 void buildFullnameAndTitle(std::string &name) const; //-------------------------------------------------------------------- @@ -169,11 +170,11 @@ public: public: // On the very first login, gender isn't chosen until the user clicks // in a dialog. We don't render the avatar until they choose. - BOOL isGenderChosen() const { return mGenderChosen; } - void setGenderChosen(BOOL b) { mGenderChosen = b; } - private: + BOOL isGenderChosen() const { return mGenderChosen; } + void setGenderChosen(BOOL b) { mGenderChosen = b; } +private: BOOL mGenderChosen; - + /** Identity ** ** *******************************************************************************/ @@ -182,7 +183,7 @@ public: ** ** ** POSITION **/ - + //-------------------------------------------------------------------- // Position //-------------------------------------------------------------------- @@ -215,9 +216,9 @@ public: void resetAxes(); void resetAxes(const LLVector3 &look_at); // Makes reasonable left and up // The following three get*Axis functions return direction avatar is looking, not camera. - const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); } - const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); } - const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); } + const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); } + const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); } + const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); } LLQuaternion getQuat() const; // Returns the quat that represents the rotation of the agent in the absolute frame private: LLVector3d mAgentOriginGlobal; // Origin of agent coords from global coords @@ -229,7 +230,7 @@ private: //-------------------------------------------------------------------- public: void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers - void setHomePosRegion( const U64& region_handle, const LLVector3& pos_region ); + void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region); BOOL getHomePosGlobal(LLVector3d* pos_global); private: BOOL mHaveHomePosition; @@ -277,18 +278,18 @@ public: private: std::set mRegionsVisited; // Stat - what distinct regions has the avatar been to? F64 mDistanceTraveled; // Stat - how far has the avatar moved? - LLVector3d mLastPositionGlobal; // Used to calculate travel distance + LLVector3d mLastPositionGlobal; // Used to calculate travel distance /** Position ** ** *******************************************************************************/ - + /******************************************************************************** ** ** ** ACTIONS **/ - - //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- // Fidget //-------------------------------------------------------------------- // Trigger random fidget animations @@ -311,7 +312,7 @@ public: static void toggleFlying(); static bool enableFlying(); BOOL canFly(); // Does this parcel allow you to fly? - + //-------------------------------------------------------------------- // Chat //-------------------------------------------------------------------- @@ -405,7 +406,7 @@ public: BOOL getBusy() const; private: BOOL mIsBusy; - + //-------------------------------------------------------------------- // Grab //-------------------------------------------------------------------- @@ -443,7 +444,7 @@ private: //-------------------------------------------------------------------- // Animations - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- public: void stopCurrentAnimations(); void requestStopMotion(LLMotion* motion); @@ -675,7 +676,7 @@ public: // ! BACKWARDS COMPATIBILITY ! This function can go away after the AO transition (see llstartup.cpp). void setAOTransition(); private: - LLAgentAccess *mAgentAccess; + LLAgentAccess * mAgentAccess; //-------------------------------------------------------------------- // God @@ -720,7 +721,8 @@ public: bool isAdult() const; void setTeen(bool teen); void setMaturity(char text); - static int convertTextToMaturity(char text); + static int convertTextToMaturity(char text); + private: bool mIsDoSendMaturityPreferenceToServer; unsigned int mMaturityPreferenceRequestId; @@ -743,7 +745,6 @@ private: bool validateMaturity(const LLSD& newvalue); - /** Access ** ** *******************************************************************************/ @@ -778,20 +779,20 @@ private: // HUD //-------------------------------------------------------------------- public: - const LLColor4 &getEffectColor(); - void setEffectColor(const LLColor4 &color); + const LLColor4 &getEffectColor(); + void setEffectColor(const LLColor4 &color); private: LLColor4 *mEffectColor; /** Rendering ** ** *******************************************************************************/ - + /******************************************************************************** ** ** ** GROUPS **/ - + public: const LLUUID &getGroupID() const { return mGroupID; } // Get group information by group_id, or FALSE if not in group. @@ -828,7 +829,7 @@ public: private: std::string mGroupTitle; // Honorific, like "Sir" BOOL mHideGroupTitle; - + //-------------------------------------------------------------------- // Group Powers //-------------------------------------------------------------------- @@ -882,54 +883,22 @@ public: /** Messaging ** ** - *******************************************************************************/ + *******************************************************************************/ /******************************************************************************** ** ** ** DEBUGGING **/ - + public: - static void clearVisualParams(void *); + void dumpGroupInfo(); + static void clearVisualParams(void *); friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere); /** Debugging ** ** *******************************************************************************/ -/******************************************************************************** - ** ** - ** Phantom mode! - **/ - - public: - static BOOL getPhantom(); - static void setPhantom(BOOL phantom); - static void togglePhantom(); -private: - static BOOL exlPhantom; -/** PHANTOM - ** ** - *******************************************************************************/ - -/******************************************************************************** - ** ** - ** Depreciated stuff. Move when ready. - **/ -public: - //What's this t-posed stuff from? - static BOOL isTPosed() { return mForceTPose; } - static void setTPosed(BOOL TPose) { mForceTPose = TPose; } - static void toggleTPosed(); - -private: - static BOOL mForceTPose; - - -/** DEPRECIATED - ** ** - *******************************************************************************/ - }; extern LLAgent gAgent; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 433aa6f41..c360a03bb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3,10 +3,9 @@ * @brief The LLAppViewer class definitions * * $LicenseInfo:firstyear=2007&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2007-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -30,8 +29,8 @@ * $/LicenseInfo$ */ - #include "llviewerprecompiledheaders.h" + #include "llappviewer.h" #include "hippogridmanager.h" @@ -41,7 +40,6 @@ #include "llfeaturemanager.h" #include "lluictrlfactory.h" #include "lltexteditor.h" -#include "llalertdialog.h" #include "llerrorcontrol.h" #include "lleventtimer.h" #include "llviewertexturelist.h" @@ -56,14 +54,13 @@ #include "llmd5.h" #include "llmeshrepository.h" #include "llpumpio.h" -#include "llimpanel.h" #include "llmimetypes.h" #include "llstartup.h" #include "llfocusmgr.h" #include "llviewerjoystick.h" -#include "llfloaterjoystick.h" #include "llares.h" -#include "llfloatersnapshot.h" +#include "llcurl.h" +#include "llcalc.h" #include "lltexturestats.h" #include "llviewerwindow.h" #include "llviewerdisplay.h" @@ -80,7 +77,9 @@ #include "llfirstuse.h" #include "llrender.h" #include "llvector4a.h" -#include "llfontfreetype.h" +#include "llimpanel.h" // For LLVoiceClient and LLVoiceChannel +#include "llvoavatarself.h" +#include "llprogressview.h" #include "llvocache.h" #include "llvopartgroup.h" #include "llfloaterteleporthistory.h" @@ -92,10 +91,10 @@ #include "llavatarnamecache.h" #include "lldiriterator.h" #include "llimagej2c.h" +#include "llmemory.h" #include "llprimitive.h" #include "llnotifications.h" #include "llnotificationsutil.h" -#include "llcurl.h" #include #if LL_WINDOWS @@ -121,7 +120,6 @@ #include "aihttptimeoutpolicy.h" // // The files below handle dependencies from cleanup. -#include "llcalc.h" #include "llkeyframemotion.h" #include "llworldmap.h" #include "llhudmanager.h" @@ -133,7 +131,6 @@ #include "llviewermenu.h" #include "llselectmgr.h" #include "lltrans.h" -#include "lltrans.h" #include "lltracker.h" #include "llviewerparcelmgr.h" #include "llworldmapview.h" @@ -144,15 +141,12 @@ #include "lldebugview.h" #include "llconsole.h" #include "llcontainerview.h" -#include "llfloaterstats.h" #include "llhoverview.h" -#include "llfloatermemleak.h" #include "llsdserialize.h" #include "llworld.h" #include "llhudeffecttrail.h" -#include "llhudeffectlookat.h" #include "llvectorperfoptions.h" #include "llurlsimstring.h" #include "llwatchdog.h" @@ -160,24 +154,23 @@ // Included so that constants/settings might be initialized // in save_settings_to_globals() #include "llbutton.h" -#include "llcombobox.h" #include "llstatusbar.h" #include "llsurface.h" #include "llvosky.h" #include "llvotree.h" -#include "llvoavatarself.h" #include "llfolderview.h" #include "lltoolbar.h" #include "llframestats.h" #include "llagentpilot.h" -#include "llsrv.h" #include "llvovolume.h" #include "llflexibleobject.h" #include "llvosurfacepatch.h" +#include "llcommandlineparser.h" +#include "llfloatermemleak.h" +#include "llfloatersnapshot.h" #include "llfloaterinventory.h" // includes for idle() idleShutdown() -#include "floaterao.h" #include "llviewercontrol.h" #include "lleventnotifier.h" #include "llcallbacklist.h" @@ -192,10 +185,7 @@ #include "llviewerthrottle.h" #include "llparcel.h" #include "llviewerassetstats.h" -#include "llcommandlineparser.h" -#include "llprogressview.h" -#include "llmemory.h" #include "llmainlooprepeater.h" // [RLVa:KB] @@ -223,12 +213,6 @@ //---------------------------------------------------------------------------- // viewer.cpp - these are only used in viewer, should be easily moved. - - - - - - #if LL_DARWIN extern void init_apple_menu(const char* product); #endif // LL_DARWIN @@ -486,6 +470,7 @@ static void settings_to_globals() LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize")); LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLCoreProfile"); + LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic"); LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures"); LLVOVolume::sLODFactor = gSavedSettings.getF32("RenderVolumeLODFactor"); @@ -1199,6 +1184,7 @@ bool LLAppViewer::mainLoop() // canonical per-frame event mainloop.post(newFrame); + if (!LLApp::isExiting()) { pingMainloopTimeout("Main:JoystickKeyboard"); @@ -1206,7 +1192,7 @@ bool LLAppViewer::mainLoop() // Scan keyboard for movement keys. Command keys and typing // are handled by windows callbacks. Don't do this until we're // done initializing. JC - if (gViewerWindow->mWindow->getVisible() + if (gViewerWindow->mWindow->getVisible() && gViewerWindow->getActive() && !gViewerWindow->getWindow()->getMinimized() && LLStartUp::getStartupState() == STATE_STARTED @@ -1323,7 +1309,6 @@ bool LLAppViewer::mainLoop() ms_sleep(500); } - const F64 max_idle_time = run_multiple_threads ? 0.0 : llmin(.005*10.0*gFrameIntervalSeconds, 0.005); // 50ms/second, no more than 5ms/frame idleTimer.reset(); while(1) @@ -1385,7 +1370,6 @@ bool LLAppViewer::mainLoop() pingMainloopTimeout("Main:End"); } - } catch(std::bad_alloc) { @@ -1741,7 +1725,8 @@ bool LLAppViewer::cleanup() writeDebugInfo(); if(!gDirUtilp->getLindenUserDir(true).empty()) - LLViewerMedia::saveCookieFile(); + LLViewerMedia::saveCookieFile(); + // Stop the plugin read thread if it's running. LLPluginProcessParent::setUseReadThread(false); // Stop curl responder call backs. @@ -1761,11 +1746,11 @@ bool LLAppViewer::cleanup() pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread pending += LLVFSThread::updateClass(0); pending += LLLFSThread::updateClass(0); - if (pending == 0) + if (!pending) { break; } - if (idleTimer.getElapsedTimeF64() >= max_idle_time) + else if (idleTimer.getElapsedTimeF64() >= max_idle_time) { llwarns << "Quitting with pending background tasks." << llendl; break; @@ -1930,6 +1915,7 @@ bool LLAppViewer::initThreads() // Mesh streaming and caching gMeshRepo.init(); + // *FIX: no error handling here! return true; } @@ -2125,20 +2111,14 @@ bool LLAppViewer::initConfiguration() if(!loadSettingsFromDirectory(settings_w, "Default", set_defaults)) { std::ostringstream msg; - msg << "Second Life could not load its default settings file. \n" - << "The installation may be corrupted. \n"; - - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); - + msg << "Unable to load default settings file. The installation may be corrupted."; + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return false; } LLUICtrlFactory::getInstance()->setupPaths(); // setup paths for LLTrans based on settings files only LLTrans::parseStrings("strings.xml", default_trans_args); - + //COA vars in gSavedSettings will be linked to gSavedPerAccountSettings entries that will be created if not present. //Signals will be shared between linked vars. gSavedSettings.connectCOAVars(gSavedPerAccountSettings); @@ -2168,8 +2148,8 @@ bool LLAppViewer::initConfiguration() // timeout for mac and linux. There is no call stack info // on these platform to help debug. #ifndef LL_RELEASE_FOR_DOWNLOAD - gSavedSettings.setBOOL("WatchdogEnabled", FALSE); gSavedSettings.setBOOL("QAMode", TRUE ); + gSavedSettings.setBOOL("WatchdogEnabled", 0); #endif #ifndef LL_WINDOWS @@ -2213,6 +2193,7 @@ bool LLAppViewer::initConfiguration() LLControlGroupCLP clp; std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cmd_line.xml"); + clp.configure(cmd_line_config, &gSavedSettings); if(!initParseCommandLine(clp)) @@ -2248,9 +2229,8 @@ bool LLAppViewer::initConfiguration() clp.notify(); // Register the core crash option as soon as we can - // if we want gdb post-mortum on cores we need to be up and running + // if we want gdb post-mortem on cores we need to be up and running // ASAP or we might miss init issue etc. - if(clp.hasOption("disablecrashlogger")) { llwarns << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" <getControl(name); - // if(c) - // { - // c->setDefault(value); - // } - // else - // { - // llwarns << "'--setdefault' specified with unknown setting: '" - // << name << "'." << llendl; - // } - // } - //} - } - if(clp.hasOption("set")) { const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); @@ -2551,7 +2501,7 @@ bool LLAppViewer::initConfiguration() if ( nextLoginLocation.length() ) { LLURLSimString::setString( nextLoginLocation ); - }; + } gLastRunVersion = gSavedSettings.getString("LastRunVersion"); @@ -2743,7 +2693,6 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["SLLog"] = LLError::logFileName(); gDebugInfo["ClientInfo"]["Name"] = gVersionChannel; - gDebugInfo["ClientInfo"]["MajorVersion"] = gVersionMajor; gDebugInfo["ClientInfo"]["MinorVersion"] = gVersionMinor; gDebugInfo["ClientInfo"]["PatchVersion"] = gVersionPatch; @@ -2751,7 +2700,6 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); - //need to put in something to lie about this stuff gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString(); gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily(); gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMHz(); @@ -2764,10 +2712,10 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); // The user is not logged on yet, but record the current grid choice login url - // which may have been the intended grid. This can b + // which may have been the intended grid. gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel(); - // *FIX:Mani - move this ddown in llappviewerwin32 + // *FIX:Mani - move this down in llappviewerwin32 #ifdef LL_WINDOWS DWORD thread_id = GetCurrentThreadId(); gDebugInfo["MainloopThreadID"] = (S32)thread_id; @@ -2817,6 +2765,7 @@ void LLAppViewer::handleViewerCrash() llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ; LLMemory::logMemoryInfo(true) ; + //print out recorded call stacks if there are any. LLError::LLCallStacks::print(); @@ -2845,7 +2794,6 @@ void LLAppViewer::handleViewerCrash() //We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version //to check against no matter what - gDebugInfo["ClientInfo"]["Name"] = gVersionChannel; gDebugInfo["ClientInfo"]["MajorVersion"] = gVersionMajor; @@ -3023,13 +2971,11 @@ void LLAppViewer::initMarkerFile() std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME); std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); - if (LLAPRFile::isExist(mMarkerFileName, LL_APR_RB) && !anotherInstanceRunning()) { gLastExecEvent = LAST_EXEC_FROZE; LL_INFOS("MarkerFile") << "Exec marker found: program froze on previous execution" << LL_ENDL; } - if(LLAPRFile::isExist(logout_marker_file, LL_APR_RB)) { gLastExecEvent = LAST_EXEC_LOGOUT_FROZE; @@ -3741,17 +3687,6 @@ void LLAppViewer::loadNameCache() { if(gCacheName->importFile(cache_file)) return; } - - // Try to load from the legacy format. This should go away after a - // while. Phoenix 2008-01-30 -#if 0 - LLFILE* name_cache_fp = LLFile::fopen(name_cache, "r"); // Flawfinder: ignore - if (name_cache_fp) - { - gCacheName->importFile(name_cache_fp); - fclose(name_cache_fp); - } -#endif } void LLAppViewer::saveNameCache() @@ -3804,6 +3739,7 @@ static LLFastTimer::DeclareTimer FTM_WORLD_UPDATE("Update World"); static LLFastTimer::DeclareTimer FTM_NETWORK("Network"); static LLFastTimer::DeclareTimer FTM_AGENT_NETWORK("Agent Network"); static LLFastTimer::DeclareTimer FTM_VLMANAGER("VL Manager"); + /////////////////////////////////////////////////////// // idle() // @@ -3864,7 +3800,6 @@ void LLAppViewer::idle() // // Special case idle if still starting up // - if (LLStartUp::getStartupState() < STATE_STARTED) { // Skip rest if idle startup returns false (essentially, no world yet) @@ -3916,10 +3851,7 @@ void LLAppViewer::idle() LLFastTimer t(FTM_AGENT_UPDATE); // Send avatar and camera info last_control_flags = gAgent.getControlFlags(); - if(!gAgent.getPhantom()) - { - send_agent_update(TRUE); - } + send_agent_update(TRUE); agent_update_timer.reset(); } } @@ -3929,7 +3861,6 @@ void LLAppViewer::idle() // Manage statistics // // - { // Initialize the viewer_stats_timer with an already elapsed time // of SEND_STATS_PERIOD so that the initial stats report will @@ -4328,7 +4259,6 @@ void LLAppViewer::sendLogoutRequest() { if(!mLogoutRequestSent && gMessageSystem) { - LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_LogoutRequest); msg->nextBlockFast(_PREHASH_AgentData); @@ -4432,6 +4362,7 @@ static LLFastTimer::DeclareTimer FTM_RETRANSMIT("Retransmit"); static LLFastTimer::DeclareTimer FTM_TIMEOUT_CHECK("Timeout Check"); static LLFastTimer::DeclareTimer FTM_DYNAMIC_THROTTLE("Dynamic Throttle"); static LLFastTimer::DeclareTimer FTM_CHECK_REGION_CIRCUIT("Check Region Circuit"); + void LLAppViewer::idleNetwork() { pingMainloopTimeout("idleNetwork"); @@ -4449,7 +4380,8 @@ void LLAppViewer::idleNetwork() // Read all available packets from network const S64 frame_count = gFrameCount; // U32->S64 F32 total_time = 0.0f; - while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) + + while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) { if (gDoDisconnect) { diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 06d1590b1..102d950f5 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -88,10 +88,6 @@ #include "lltrans.h" -// -#include "llviewercontrol.h" -// - // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 50f7044cb..d4830adbf 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -295,6 +295,7 @@ public: mAvatarPauseHandles.clear(); mQualityMouseUpConnection.disconnect(); } + static void onClickDiscard(void* data); static void onClickKeep(void* data); static void onCommitSave(LLUICtrl* ctrl, void* data); static void onClickNewSnapshot(void* data); @@ -1851,7 +1852,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool de floater->childSetVisible("keep_aspect", is_advance); floater->childSetVisible("type_label3", is_advance); floater->childSetVisible("format_label", is_advance && is_local); - floater->childSetVisible("local_format_combo", is_local); + floater->childSetVisible("local_format_combo", is_advance && is_local); floater->childSetVisible("layer_types", is_advance); floater->childSetVisible("layer_type_label", is_advance); floater->childSetVisible("aspect_one_label", is_advance); @@ -1863,7 +1864,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool de floater->childSetVisible("keep_open_check", is_advance); floater->childSetVisible("freeze_time_check", is_advance); floater->childSetVisible("auto_snapshot_check", is_advance); - floater->childSetVisible("image_quality_slider", show_slider); + floater->childSetVisible("image_quality_slider", is_advance && show_slider); floater->childSetVisible("temp_check", is_advance); BOOL got_bytes = previewp && previewp->getDataSize() > 0; @@ -1931,6 +1932,23 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, } } +// static +void LLFloaterSnapshot::Impl::onClickDiscard(void* data) +{ + LLFloaterSnapshot* view = static_cast(data); + if (gSavedSettings.getBOOL("FreezeTime")) + { + LLSnapshotLivePreview* previewp = view->impl.getPreviewView(); + if (previewp && previewp->getShowFreezeFrameSnapshot()) + previewp->showFreezeFrameSnapshot(false); + view->impl.freezeTime(false); + } + else + { + view->close(); + } +} + // static void LLFloaterSnapshot::Impl::onCommitFeedResolution(LLUICtrl* ctrl, void* data) { @@ -2924,6 +2942,7 @@ BOOL LLFloaterSnapshot::postBuild() childSetAction("send_btn", Impl::onClickKeep, this); childSetAction("feed_btn", Impl::onClickKeep, this); childSetCommitCallback("save_btn", Impl::onCommitSave, this); + childSetAction("discard_btn", Impl::onClickDiscard, this); childSetCommitCallback("image_quality_slider", Impl::onCommitQuality, this); childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality")); diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index 5f0c183ee..ed0c6c54e 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -31,79 +31,26 @@ */ #include "llviewerprecompiledheaders.h" - -#include // for std::pair<> - -#include "llinventorypanel.h" -#include "llpanelobjectinventory.h" -#include "llinventorybridge.h" - -#include "message.h" - -#include "llagent.h" #include "llagentwearables.h" -#include "llcallingcard.h" -#include "llcheckboxctrl.h" // for radio buttons -#include "llfoldervieweventlistener.h" -#include "llnotificationsutil.h" -#include "llradiogroup.h" -#include "llspinctrl.h" -#include "lltextbox.h" -#include "llui.h" - - -#include "llviewercontrol.h" -#include "llfirstuse.h" -#include "llfloateravatarinfo.h" -#include "llfloaterchat.h" -#include "llfloatercustomize.h" -#include "llfloaterinventory.h" -#include "llfloaterproperties.h" -#include "llfocusmgr.h" -#include "llfolderview.h" -#include "llgesturemgr.h" -#include "lliconctrl.h" +#include "llimview.h" #include "llinventoryfunctions.h" +#include "llinventorybridge.h" #include "llinventoryclipboard.h" #include "llinventorymodelbackgroundfetch.h" -#include "lllineeditor.h" +#include "llinventorypanel.h" #include "llmakeoutfitdialog.h" -#include "llmenugl.h" -#include "llpreviewanim.h" -#include "llpreviewgesture.h" -#include "llpreviewlandmark.h" -#include "llpreviewnotecard.h" -#include "llpreviewscript.h" -#include "llpreviewsound.h" -#include "llpreviewtexture.h" -#include "llresmgr.h" -#include "llscrollcontainer.h" -#include "llimview.h" -#include "lltooldraganddrop.h" -#include "llviewertexturelist.h" -#include "llviewerinventory.h" -#include "llviewerobjectlist.h" -#include "llviewerwindow.h" +#include "llnotificationsutil.h" +#include "llpanelmaininventory.h" +#include "llpanelobjectinventory.h" +#include "llpreview.h" // For LLMultiPreview +#include "llfoldervieweventlistener.h" +#include "lltrans.h" #include "llvoavatarself.h" -#include "llwearable.h" -#include "llwearablelist.h" -#include "llviewermessage.h" -#include "llviewerregion.h" -#include "lltabcontainer.h" -#include "lluictrlfactory.h" -#include "llselectmgr.h" -// -#include "lllocalinventory.h" -#include "statemachine/aifilepicker.h" -// +extern LLUUID gAgentID; using namespace LLOldEvents; -const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) -const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not) -const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not) - typedef LLMemberListener object_inventory_listener_t; typedef LLMemberListener inventory_listener_t; typedef LLMemberListener inventory_panel_listener_t; @@ -116,42 +63,39 @@ bool doToSelected(LLFolderView* folder, std::string action) folder->startRenamingSelectedItem(); return true; } - if ("delete" == action) + else if ("delete" == action) { folder->removeSelectedItems(); return true; } - - if ("copy" == action || "cut" == action) + else if ("copy" == action || "cut" == action) { LLInventoryClipboard::instance().reset(); } std::set selected_items = folder->getSelectionList(); - LLMultiPreview* multi_previewp = NULL; - LLMultiProperties* multi_propertiesp = NULL; + LLMultiFloater* multi_floaterp = NULL; if (("task_open" == action || "open" == action) && selected_items.size() > 1) { S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); - multi_previewp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100)); - gFloaterView->addChild(multi_previewp); + multi_floaterp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100)); + gFloaterView->addChild(multi_floaterp); - LLFloater::setFloaterHost(multi_previewp); - + LLFloater::setFloaterHost(multi_floaterp); } else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1) { S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); - multi_propertiesp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100)); - gFloaterView->addChild(multi_propertiesp); + multi_floaterp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100)); + gFloaterView->addChild(multi_floaterp); - LLFloater::setFloaterHost(multi_propertiesp); + LLFloater::setFloaterHost(multi_floaterp); } std::set::iterator set_iter; @@ -167,13 +111,9 @@ bool doToSelected(LLFolderView* folder, std::string action) } LLFloater::setFloaterHost(NULL); - if (multi_previewp) + if (multi_floaterp) { - multi_previewp->open(); - } - else if (multi_propertiesp) - { - multi_propertiesp->open(); /*Flawfinder: ignore*/ + multi_floaterp->open(); } return true; @@ -183,12 +123,11 @@ class LLDoToSelectedPanel : public object_inventory_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - std::string action = userdata.asString(); LLPanelObjectInventory *panel = mPtr; LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; - return doToSelected(folder, action); + return doToSelected(folder, userdata.asString()); } }; @@ -196,12 +135,11 @@ class LLDoToSelectedFloater : public inventory_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - std::string action = userdata.asString(); LLInventoryPanel *panel = mPtr->getPanel(); LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; - return doToSelected(folder, action); + return doToSelected(folder, userdata.asString()); } }; @@ -209,12 +147,11 @@ class LLDoToSelected : public inventory_panel_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - std::string action = userdata.asString(); LLInventoryPanel *panel = mPtr; LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; - return doToSelected(folder, action); + return doToSelected(folder, userdata.asString()); } }; @@ -356,7 +293,7 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, else if ("lsl" == type) { LLUUID parent_id = self ? self->getUUID() : model->findCategoryUUIDForType(LLFolderType::FT_LSL_TEXT); - ptr->createNewItem(NEW_LSL_NAME, + ptr->createNewItem(LLTrans::getString("New Script"), parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, @@ -365,7 +302,7 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, else if ("notecard" == type) { LLUUID parent_id = self ? self->getUUID() : model->findCategoryUUIDForType(LLFolderType::FT_NOTECARD); - ptr->createNewItem(NEW_NOTECARD_NAME, + ptr->createNewItem(LLTrans::getString("New Note"), parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, @@ -374,7 +311,7 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, else if ("gesture" == type) { LLUUID parent_id = self ? self->getUUID() : model->findCategoryUUIDForType(LLFolderType::FT_GESTURE); - ptr->createNewItem(NEW_GESTURE_NAME, + ptr->createNewItem(LLTrans::getString("New Gesture"), parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, @@ -383,11 +320,11 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, else if ("outfit" == type) { new LLMakeOutfitDialog(false); + return; } else { - LLWearableType::EType wear_type = LLWearableType::typeNameToType(type); - LLAgentWearables::createWearable(wear_type, false, self ? self->getUUID() : LLUUID::null); + LLAgentWearables::createWearable(LLWearableType::typeNameToType(type), false, self ? self->getUUID() : LLUUID::null); } ptr->getRootFolder()->setNeedsAutoRename(TRUE); } @@ -411,14 +348,6 @@ class LLDoCreateFloater : public inventory_listener_t LLInventoryModel* model = mPtr->getPanel()->getModel(); if(!model) return false; std::string type = userdata.asString(); - // - if(type == "pretend") - { - LLFloaterNewLocalInventory* floater = new LLFloaterNewLocalInventory(); - floater->center(); - } - else - // do_create(model, mPtr->getPanel(), type); return true; } @@ -484,28 +413,6 @@ class LLSetSortBy : public inventory_listener_t } }; -// -class LLLoadInvCacheFloater : public inventory_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLInventoryModel* model = mPtr->getPanel()->getModel(); - if(!model) return false; - AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(FFLOAD_INVGZ, "", "invgz"); - filepicker->run(boost::bind(&LLLoadInvCacheFloater::filepicker_callback, this, filepicker)); - return true; - } - - void filepicker_callback(AIFilePicker* filepicker) - { - if(filepicker->hasFilename()) - { - LLLocalInventory::loadInvCache(filepicker->getFilename()); - } - } -}; - class LLRefreshInvModel : public inventory_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -522,8 +429,7 @@ class LLSetSearchType : public inventory_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - std::string toggle = userdata.asString(); - U32 flags = mPtr->getActivePanel()->getRootFolder()->toggleSearchType(toggle); + U32 flags = mPtr->getActivePanel()->getRootFolder()->toggleSearchType(userdata.asString()); mPtr->getControl("Inventory.SearchName")->setValue((BOOL)(flags & 1)); mPtr->getControl("Inventory.SearchDesc")->setValue((BOOL)(flags & 2)); mPtr->getControl("Inventory.SearchCreator")->setValue((BOOL)(flags & 4)); @@ -546,8 +452,7 @@ class LLBeginIMSession : public inventory_panel_listener_t LLDynamicArray members; EInstantMessage type = IM_SESSION_CONFERENCE_START; - std::set::const_iterator iter; - for (iter = selected_items.begin(); iter != selected_items.end(); iter++) + for (std::set::const_iterator iter = selected_items.begin(); iter != selected_items.end(); iter++) { LLUUID item = *iter; @@ -577,11 +482,10 @@ class LLBeginIMSession : public inventory_panel_listener_t { // create the session gIMMgr->setFloaterOpen(TRUE); - S32 i; - + LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; - for(i = 0; i < count; ++i) + for(S32 i = 0; i < count; ++i) { id = item_array.get(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) @@ -660,27 +564,28 @@ class LLAttachObject : public inventory_panel_listener_t break; } } - if (attachmentp == NULL) + if (!attachmentp) { return true; } - LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(id); - - if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())) + if (LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(id)) { - rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu - } - else if(item && item->isFinished()) - { - // must be in library. copy it to our inventory and put it on. - LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp, false)); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); + if(gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())) + { + rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu + } + else if(item->isFinished()) + { + // must be in library. copy it to our inventory and put it on. + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp, false)); + copy_inventory_item( + gAgentID, + item->getPermissions().getOwner(), + item->getUUID(), + LLUUID::null, + std::string(), + cb); + } } gFocusMgr.setKeyboardFocus(NULL); @@ -688,16 +593,6 @@ class LLAttachObject : public inventory_panel_listener_t } }; -/* -class LL : public listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - return true; - } -}; -*/ - void init_object_inventory_panel_actions(LLPanelObjectInventory *panel) { (new LLDoToSelectedPanel())->registerListener(panel, "Inventory.DoToSelected"); @@ -709,9 +604,6 @@ void init_inventory_actions(LLInventoryView *floater) (new LLCloseAllFoldersFloater())->registerListener(floater, "Inventory.CloseAllFolders"); (new LLEmptyTrashFloater())->registerListener(floater, "Inventory.EmptyTrash"); (new LLDoCreateFloater())->registerListener(floater, "Inventory.DoCreate"); - // - (new LLLoadInvCacheFloater())->registerListener(floater, "Inventory.LoadInvCache"); - // (new LLNewWindow())->registerListener(floater, "Inventory.NewWindow"); (new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters"); @@ -719,7 +611,6 @@ void init_inventory_actions(LLInventoryView *floater) (new LLSetSortBy())->registerListener(floater, "Inventory.SetSortBy"); (new LLSetSearchType())->registerListener(floater, "Inventory.SetSearchType"); - } void init_inventory_panel_actions(LLInventoryPanel *panel) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 6316714b1..a68754942 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3,10 +3,9 @@ * @brief Implementation of the Inventory-Folder-View-Bridge classes. * * $LicenseInfo:firstyear=2001&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2001-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -31,18 +30,8 @@ */ #include "llviewerprecompiledheaders.h" - -#include // for std::pair<> - #include "llinventorybridge.h" -#include "message.h" - -#include "llcheckboxctrl.h" // for radio buttons -#include "llradiogroup.h" -#include "llspinctrl.h" -#include "lltextbox.h" -#include "llui.h" #include "lluictrlfactory.h" #include "llagent.h" @@ -55,15 +44,12 @@ #include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" -#include "llfloaterinventory.h" #include "llfloateropenobject.h" #include "llfloaterproperties.h" #include "llfloaterworldmap.h" -#include "llfocusmgr.h" #include "llfolderview.h" #include "llgesturemgr.h" #include "llgiveinventory.h" -#include "lliconctrl.h" #include "llimview.h" #include "llinventoryclipboard.h" #include "llinventorydefines.h" @@ -72,9 +58,7 @@ #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" -#include "lllineeditor.h" #include "llmarketplacefunctions.h" -#include "llmenugl.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpreviewanim.h" @@ -84,40 +68,19 @@ #include "llpreviewscript.h" #include "llpreviewsound.h" #include "llpreviewtexture.h" -#include "llresmgr.h" #include "llselectmgr.h" -#include "llscrollcontainer.h" #include "lltooldraganddrop.h" -#include "lltabcontainer.h" #include "lltrans.h" #include "llviewerassettype.h" -#include "llviewercontrol.h" #include "llviewerfoldertype.h" -#include "llviewerinventory.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "llviewertexturelist.h" #include "llviewerwindow.h" #include "llvoavatar.h" -#include "llfoldertype.h" #include "llwearable.h" #include "llwearablelist.h" -// -#include "llappviewer.h" // System Folders -#include "llfloateranimpreview.h" // for reuploads -#include "llfloaterimagepreview.h" // for reuploads -#include "statemachine/aifilepicker.h" -// - -// Editing wearables from inventory is an include-hungry feature -.- -SG -#include "llviewerparcelmgr.h" -#include "llfloatertools.h" -#include "lltoolcomp.h" -#include "llviewerjoystick.h" -#include "lltoolmgr.h" - #include "hippogridmanager.h" // [RLVa:KB] @@ -125,6 +88,8 @@ #include "rlvlocks.h" // [/RLVa:KB] +extern LLUUID gSystemFolderRoot; + // Marketplace outbox current disabled #define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 #define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 1 @@ -229,22 +194,6 @@ public: } }; -// -void gotImageForSaveItemAs(BOOL success, - LLViewerTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata); -void gotAssetForSaveItemAs(LLVFS *vfs, - const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); -// - - - // +=================================================+ // | LLInvFVBridge | // +=================================================+ @@ -434,9 +383,6 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArraygetParentUUID() == trash_id) continue; move_ids.push_back(item->getUUID()); - // don't do stuff that messes with gMessageSystem - //LLPreview::hide(item->getUUID()); - // --update[item->getParentUUID()]; ++update[trash_id]; // @@ -475,6 +421,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArraysetEnabled(enabled); } } @@ -893,7 +841,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -1556,19 +1503,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) folder_view_itemp->getListener()->pasteLinkFromClipboard(); return; } - - // - else if("reupload" == action) - { - LLInventoryItem* item = model->getItem(mUUID); - if (item && item->getType() == LLAssetType::AT_TEXTURE) - { - AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(FFLOAD_IMAGE, "", "image"); - filepicker->run(boost::bind(&LLItemBridge::showFloaterImagePreview, item, filepicker)); - } - } - // else if (isMarketplaceCopyAction(action)) { llinfos << "Copy item to marketplace action!" << llendl; @@ -1581,16 +1515,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) } } -// static -void LLItemBridge::showFloaterImagePreview(LLInventoryItem* item, AIFilePicker* filepicker) -{ - if (filepicker->hasFilename()) - { - LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filepicker->getFilename(), item); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); - } -} - void LLItemBridge::selectItem() { LLViewerInventoryItem* item = static_cast(getItem()); @@ -1634,17 +1558,17 @@ void LLItemBridge::restoreToWorld() itemp->packMessage(msg); msg->sendReliable(gAgent.getRegion()->getHost()); - //remove local inventory copy, sim will deal with permissions and removing the item - //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) - { + //remove local inventory copy, sim will deal with permissions and removing the item + //from the actual inventory if its a no-copy etc + if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) + { remove_from_inventory = true; - } + } - // Check if it's in the trash. (again similar to the normal rez logic) + // Check if it's in the trash. (again similar to the normal rez logic) const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) - { + if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) + { remove_from_inventory = true; } } @@ -1689,7 +1613,7 @@ PermissionMask LLItemBridge::getPermissionMask() const if (item) perm_mask = item->getPermissionMask(); return perm_mask; } - + const std::string& LLItemBridge::getDisplayName() const { if(mDisplayName.empty()) @@ -1701,9 +1625,9 @@ const std::string& LLItemBridge::getDisplayName() const void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name) { - if(item) + if(item) { - name.assign(item->getName()); + name.assign(item->getName()); } else { @@ -1741,7 +1665,7 @@ std::string LLItemBridge::getLabelSuffix() const static std::string BROKEN_LINK = LLTrans::getString("broken_link"); std::string suffix; LLInventoryItem* item = getItem(); - if(item) + if(item) { // Any type can have the link suffix... BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType()); @@ -1770,7 +1694,7 @@ std::string LLItemBridge::getLabelSuffix() const { suffix += NO_XFER; } - + BOOL temp = item->getPermissions().getGroup() == gAgent.getID(); if (temp) @@ -2017,7 +1941,6 @@ void LLFolderBridge::selectItem() { } - // Iterate through a folder's children to determine if // all the children are removable. class LLIsItemRemovable : public LLFolderViewFunctor @@ -2147,7 +2070,6 @@ BOOL LLFolderBridge::isClipboardPasteable() const } - BOOL LLFolderBridge::isClipboardPasteableAsLink() const { // Check normal paste-as-link permissions @@ -2288,7 +2210,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel* model = getInventoryModel(); if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL - if(!model) return FALSE; + if (!model) return FALSE; if (!isAgentAvatarValid()) return FALSE; if (!isAgentInventory()) return FALSE; // cannot drag categories into library @@ -2759,9 +2681,9 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Move to next if current folder empty if ((item_count == 0) && (cat_count == 0)) - { + { continue; - } + } uuid_vec_t ids; LLRightClickInventoryFetchObserver* outfit = NULL; @@ -2834,7 +2756,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryWearObserver // -// Observer for "copy and wear" operation to support knowing +// Observer for "copy and wear" operation to support knowing // when the all of the contents have been added to inventory. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLInventoryCopyAndWearObserver : public LLInventoryObserver @@ -2857,7 +2779,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) { if((mask & (LLInventoryObserver::ADD)) != 0) { - if (!mFolderAdded) + if (!mFolderAdded) { const std::set& changed_items = gInventory.getChangedIDs(); @@ -2865,7 +2787,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) std::set::const_iterator id_end = changed_items.end(); for (;id_it != id_end; ++id_it) { - if ((*id_it) == mCatID) + if ((*id_it) == mCatID) { mFolderAdded = TRUE; break; @@ -2873,13 +2795,13 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) } } - if (mFolderAdded) + if (mFolderAdded) { LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); if (NULL == category) { llwarns << "gInventory.getCategory(" << mCatID - << ") was NULL" << llendl; + << ") was NULL" << llendl; } else { @@ -2890,7 +2812,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, FALSE); delete this; } - } + } } } @@ -2961,10 +2883,10 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) if(!model) return; LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - - remove_inventory_category_from_avatar ( cat ); + + remove_inventory_category_from_avatar( cat ); return; - } + } else if ("purge" == action) { purgeItem(model, mUUID); @@ -3123,6 +3045,7 @@ BOOL LLFolderBridge::removeItem() return TRUE; } + BOOL LLFolderBridge::removeSystemFolder() { const LLViewerInventoryCategory *cat = getCategory(); @@ -3405,7 +3328,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) { // This is the lost+found folder. mItems.push_back(std::string("Empty Lost And Found")); - + mDisabledItems.push_back(std::string("New Folder")); mDisabledItems.push_back(std::string("New Script")); mDisabledItems.push_back(std::string("New Note")); @@ -3413,7 +3336,6 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) mDisabledItems.push_back(std::string("New Clothes")); mDisabledItems.push_back(std::string("New Body Parts")); } - if(trash_id == mUUID) { // This is the trash. @@ -3431,7 +3353,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) } else if(isAgentInventory()) // do not allow creating in library { - LLViewerInventoryCategory *cat = getCategory(); + LLViewerInventoryCategory *cat = getCategory(); // BAP removed protected check to re-enable standard ops in untyped folders. // Not sure what the right thing is to do here. if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) @@ -3475,7 +3397,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) { mCallingCards=TRUE; } - + LLFindWearables is_wearable; LLIsType is_object( LLAssetType::AT_OBJECT ); LLIsType is_gesture( LLAssetType::AT_GESTURE ); @@ -3497,14 +3419,13 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) { - // *TODO: Translate - + // Build folder specific options back up LLInventoryModel* model = getInventoryModel(); if(!model) return; const LLInventoryCategory* category = model->getCategory(mUUID); if(!category) return; - + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id == mUUID) return; if (isItemInTrash()) return; @@ -3518,7 +3439,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) const bool is_outfit = (type == LLFolderType::FT_OUTFIT); // [/SL:KB] - // Only enable calling-card related options for non-default folders. + // Only enable calling-card related options for non-system folders. if (!is_system_folder) { LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); @@ -3555,7 +3476,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) { mItems.push_back(std::string("Folder Wearables Separator")); - // Only enable add/replace outfit for non-default folders. + // Only enable add/replace outfit for non-system folders. if (!is_system_folder) { if (InventoryLinksEnabled() && @@ -3565,7 +3486,8 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) mItems.push_back(std::string("Add To Outfit")); } else if(!InventoryLinksEnabled()) - mItems.push_back(std::string("Wearable And Object Wear")); + mItems.push_back(std::string("Wearable And Object Wear")); + mItems.push_back(std::string("Replace Outfit")); } mItems.push_back(std::string("Remove From Outfit")); @@ -3597,7 +3519,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryModel* model = getInventoryModel(); if(!model) return; - + buildContextMenuBaseOptions(flags); // Add menu items that are dependent on the contents of the folder. @@ -3849,9 +3771,9 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response } two_uuids_list_t::iterator move_it; - for (move_it = move_inv->mMoveList.begin(); - move_it != move_inv->mMoveList.end(); - ++move_it) + for (move_it = move_inv->mMoveList.begin(); + move_it != move_inv->mMoveList.end(); + ++move_it) { object->moveInventory(move_it->first, move_it->second); } @@ -3956,8 +3878,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { LLInventoryModel* model = getInventoryModel(); - if(!model || !inv_item) return FALSE; - if(!isAgentInventory()) return FALSE; // cannot drag into library + if (!model || !inv_item) return FALSE; + if (!isAgentInventory()) return FALSE; // cannot drag into library if (!isAgentAvatarValid()) return FALSE; LLInventoryPanel* destination_panel = mInventoryPanel.get(); @@ -3993,22 +3915,22 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, switch (inv_item->getActualType()) { - //case LLFolderType::FT_ROOT_CATEGORY: - // is_movable = FALSE; - // break; + //case LLFolderType::FT_ROOT_CATEGORY: + // is_movable = FALSE; + // break; - case LLAssetType::AT_CATEGORY: - is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); - break; - default: - break; + case LLAssetType::AT_CATEGORY: + is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); + break; + default: + break; } - + // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) { is_movable = FALSE; } - + // [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g if ( (rlv_handler_t::isEnabled()) && (is_movable) ) { @@ -4103,7 +4025,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (!active_folder_view) return false; } - if(accept && drop) + if (accept && drop) { if (inv_item->getType() == LLAssetType::AT_GESTURE && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) @@ -4117,9 +4039,27 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, active_panel->unSelectAll(); } + //-------------------------------------------------------------------------------- + // Destination folder logic + // + + /* Singu TODO: Favorites + // REORDER + // (only reorder the item in Favorites folder) + if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites) + { + LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem(); + if (itemp) + { + LLUUID srcItemId = inv_item->getUUID(); + LLUUID destItemId = itemp->getListener()->getUUID(); + gInventory.rearrangeFavoriteLandmarks(srcItemId, destItemId); + } + } + // FAVORITES folder // (copy the item) - if (move_is_into_favorites) + else */if (move_is_into_favorites) { dropToFavorites(inv_item); } @@ -4161,13 +4101,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, //-------------------------------------------------------------------------------- } } - else if(LLToolDragAndDrop::SOURCE_WORLD == source) + else if (LLToolDragAndDrop::SOURCE_WORLD == source) { // Make sure the object exists. If we allowed dragging from // anonymous objects, it would be possible to bypass // permissions. object = gObjectList.findObject(inv_item->getParentUUID()); - if(!object) + if (!object) { llinfos << "Object not found for drop." << llendl; return FALSE; @@ -4177,7 +4117,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // move/copy this item. LLPermissions perm(inv_item->getPermissions()); BOOL is_move = FALSE; - if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) + if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { @@ -4227,12 +4167,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { // store dad inventory item to select added one later. See EXT-4347 set_dad_inventory_item(inv_item, mUUID); + LLNotification::Params params("MoveInventoryFromObject"); params.functor(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); } } - } else if(LLToolDragAndDrop::SOURCE_NOTECARD == source) { @@ -4376,23 +4316,6 @@ void LLTextureBridge::openItem() } } -// virtual -void LLTextureBridge::performAction(LLInventoryModel* model, std::string action) -{ - // TODO - /*if ("save_as" == action) - { - LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); - LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance("preview_texture", mUUID); - if (preview_texture) - { - preview_texture->openToSave(); - } - } - else*/ - LLItemBridge::performAction(model, action); -} - void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; @@ -4412,8 +4335,9 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); - //TODO - /*items.push_back(std::string("Texture Separator")); + + /* Singu TODO + items.push_back(std::string("Texture Separator")); items.push_back(std::string("Save As")); if (!canSaveTexture()) { @@ -4423,6 +4347,21 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } +// virtual +void LLTextureBridge::performAction(LLInventoryModel* model, std::string action) +{ + /* Singu TODO + if ("save_as" == action) + { + LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); + LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance("preview_texture", mUUID); + if (preview_texture) + { + preview_texture->openToSave(); + } + } + else*/ LLItemBridge::performAction(model, action); +} // +=================================================+ // | LLSoundBridge | @@ -4430,8 +4369,8 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) void LLSoundBridge::openItem() { - LLViewerInventoryItem* item = getItem(); - if(item) + const LLViewerInventoryItem* item = getItem(); + if (item) { LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } @@ -4553,6 +4492,7 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Teleport To Landmark")); } + hide_context_entries(menu, items, disabled_items); } @@ -4590,7 +4530,7 @@ void LLLandmarkBridge::performAction(LLInventoryModel* model, std::string action open_landmark(item, std::string(" Landmark: ") + item->getName(), FALSE); } } - else + else { LLItemBridge::performAction(model, action); } @@ -4660,9 +4600,9 @@ public: LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {} virtual ~LLCallingCardObserver() { mBridgep = NULL; } virtual void changed(U32 mask) -{ - mBridgep->refreshFolderViewItem(); -} + { + mBridgep->refreshFolderViewItem(); + } protected: LLCallingCardBridge* mBridgep; }; @@ -4764,7 +4704,6 @@ void LLCallingCardBridge::openItem() void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -4779,10 +4718,12 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + /* Singu Note: Multiple profiles get opened in a multifloater if ((flags & FIRST_SELECTED_ITEM) == 0) { disabled_items.push_back(std::string("Open")); } + */ addOpenRightClickMenuOption(items); items.push_back(std::string("Properties")); @@ -4859,7 +4800,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, } break; } - case DAD_CATEGORY: + case DAD_CATEGORY: { LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data; if( gInventory.getCategory( inv_cat->getUUID() ) ) @@ -4881,8 +4822,8 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, } break; } - default: - break; + default: + break; } } return rv; @@ -4956,7 +4897,6 @@ void LLNotecardBridge::openItem() } } - // +=================================================+ // | LLGestureBridge | // +=================================================+ @@ -5086,7 +5026,6 @@ BOOL LLGestureBridge::removeItem() void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5139,7 +5078,6 @@ void LLGestureBridge::playGesture(const LLUUID& item_id) void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5168,7 +5106,6 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } hide_context_entries(menu, items, disabled_items); - } // virtual @@ -5177,28 +5114,28 @@ void LLAnimationBridge::performAction(LLInventoryModel* model, std::string actio if ((action == "playworld") || (action == "playlocal")) { // See if we can bring an existing preview to the front - if(LLPreview::show( mUUID )) + if (LLPreview::show(mUUID)) return; - if( getItem() ) + if (getItem()) { LLPreviewAnim::e_activation_type activate = LLPreviewAnim::NONE; if ("playworld" == action) activate = LLPreviewAnim::PLAY; if ("playlocal" == action) activate = LLPreviewAnim::AUDITION; - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - LLPreviewAnim* preview = new LLPreviewAnim("preview anim", - rect, - "Animations: " + getItem()->getName(), - mUUID, - activate); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + S32 left, top; + gFloaterView->getNewFloaterPosition(&left, &top); + LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); + rect.translate( left - rect.mLeft, top - rect.mTop ); + LLPreviewAnim* preview = new LLPreviewAnim("preview anim", + rect, + "Animations: " + getItem()->getName(), + mUUID, + activate); + // Force to be entirely onscreen. + gFloaterView->adjustToFitScreen(preview, FALSE); } + } else { LLItemBridge::performAction(model, action); @@ -5243,7 +5180,7 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, LLUIImagePtr LLObjectBridge::getIcon() const { - return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject ); + return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject); } LLInventoryObject* LLObjectBridge::getObject() const @@ -5267,7 +5204,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) item = (LLViewerInventoryItem*)gInventory.getItem(object_id); if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID())) { - rez_attachment(item, NULL, true); + rez_attachment(item, NULL, true); // Replace if "Wear"ing. } else if(item && item->isFinished()) { @@ -5293,52 +5230,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) } else if ("edit" == action) { - if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) - return; - LLVOAvatar* avatarp = gAgentAvatarp; - if (!avatarp) - return; - LLViewerObject* objectp = avatarp->getWornAttachment(mUUID); - if (!objectp) - return; - - // [Selective copy/paste from LLObjectEdit::handleEvent()] - LLViewerParcelMgr::getInstance()->deselectLand(); - LLSelectMgr::getInstance()->deselectAll(); - - if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) - { - if (objectp->isHUDAttachment() || !gSavedSettings.getBOOL("EditCameraMovement")) - { - // always freeze camera in space, even if camera doesn't move - // so, for example, follow cam scripts can't affect you when in build mode - gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - } - else - { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - - // zoom in on object center instead of where we clicked, as we need to see the manipulator handles - gAgentCamera.setFocusGlobal(objectp->getPositionGlobal(), objectp->getID()); - gAgentCamera.cameraZoomIn(0.666f); - gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); - gViewerWindow->moveCursorToCenter(); - } - } - - gFloaterTools->open(); - - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); - - LLViewerJoystick::getInstance()->moveObjects(true); - LLViewerJoystick::getInstance()->setNeedsReset(true); - - LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); - - // Could be first use - LLFirstUse::useBuild(); + handle_attachment_edit(mUUID); } else LLItemBridge::performAction(model, action); } @@ -5359,25 +5251,14 @@ std::string LLObjectBridge::getLabelSuffix() const { return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn"); } - bool unsupportedPoint = false; //Unsupported points are given special names, translate them as they're named, not later. std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID); if (attachment_point_name == LLStringUtil::null) // Error condition, invalid attach point { attachment_point_name = "Invalid Attachment"; - std::map >::iterator iter = gAgentAvatarp->mUnsupportedAttachmentPoints.begin(); - std::map >::iterator end = gAgentAvatarp->mUnsupportedAttachmentPoints.end(); - for( ; iter != end; ++iter) - { - if((*iter).second.first == mUUID) - { - attachment_point_name = llformat((LLTrans::getString("unsupported point")+" %d)").c_str(), (*iter).first); - } - } - unsupportedPoint = attachment_point_name != "Invalid Attachment"; } // e.g. "(worn on ...)" / "(attached to ...)" LLStringUtil::format_map_t args; - args["[ATTACHMENT_POINT]"] = unsupportedPoint ? attachment_point_name : LLTrans::getString(attachment_point_name); + args["[ATTACHMENT_POINT]"] = LLTrans::getString(attachment_point_name); if(gRlvAttachmentLocks.canDetach(getItem())) return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args); @@ -5464,7 +5345,7 @@ bool confirm_attachment_rez(const LLSD& notification, const LLSD& response) { LLUUID item_id = notification["payload"]["item_id"].asUUID(); LLViewerInventoryItem* itemp = gInventory.getItem(item_id); - + if (itemp) { /* @@ -5545,13 +5426,6 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Detach From Yourself")); // [/RLVa:KB] } - else - // testzone attachpt - if( gAgentAvatarp->isWearingUnsupportedAttachment( mUUID ) ) - { - items.push_back(std::string("Detach From Yourself")); - } - // else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder()) { items.push_back(std::string("Wearable And Object Separator")); @@ -5562,7 +5436,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Attach To HUD")); // commented out for DEV-32347 - AND Commented back in for non-morons. -HgB items.push_back(std::string("Restore to Last Position")); - + if (!gAgentAvatarp->canAttachMoreObjects()) { disabled_items.push_back(std::string("Wearable And Object Wear")); @@ -5638,7 +5512,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) buildDisplayName(new_item, mDisplayName); new_item->updateServer(FALSE); model->updateItem(new_item); - model->notifyObservers(); if (isAgentAvatarValid()) @@ -5824,6 +5697,7 @@ std::string LLWearableBridge::getLabelSuffix() const { return LLItemBridge::getLabelSuffix() + LLTrans::getString("locked"); } + // e.g. "(worn)" return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn"); } else @@ -5911,7 +5785,6 @@ void LLWearableBridge::openItem() void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5953,7 +5826,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) getClipboardEntries(true, items, disabled_items, flags); items.push_back(std::string("Wearable And Object Separator")); - + items.push_back(std::string("Wearable Edit")); /*// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4a) | Added: RLVa-1.1.4a if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) @@ -6071,6 +5944,7 @@ void LLWearableBridge::onWearOnAvatar(void* user_data) void LLWearableBridge::wearOnAvatar() { + // TODO: investigate wearables may not be loaded at this point EXT-8231 // Don't wear anything until initial wearables are loaded, can // destroy clothing items. if (!gAgentWearables.areWearablesLoaded()) @@ -6165,7 +6039,7 @@ BOOL LLWearableBridge::canEditOnAvatar(void* user_data) return (get_is_item_worn(self->mUUID)); } -// static +// static void LLWearableBridge::onEditOnAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; @@ -6259,7 +6133,7 @@ void LLWearableBridge::removeFromAvatar() // +=================================================+ // | LLLinkItemBridge | // +=================================================+ -// For broken links +// For broken item links std::string LLLinkItemBridge::sPrefix("Link: "); @@ -6326,7 +6200,6 @@ void LLMeshBridge::previewItem() } } - void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { lldebugs << "LLMeshBridge::buildContextMenu()" << llendl; @@ -6398,7 +6271,7 @@ void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Find Original")); addDeleteContextMenuOptions(items, disabled_items); - } + } hide_context_entries(menu, items, disabled_items); } void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action) @@ -6492,8 +6365,7 @@ class LLTextureBridgeAction: public LLInvFVBridgeAction public: virtual void doIt() { - LLViewerInventoryItem* item = getItem(); - if (item) + if (const LLViewerInventoryItem* item = getItem()) { open_texture(mUUID, std::string("Texture: ") + item->getName(), FALSE); } @@ -6550,7 +6422,7 @@ public: payload["asset_id"] = item->getAssetUUID(); payload["item_id"] = item->getUUID(); - + LLSD args; args["LOCATION"] = item->getName(); @@ -6641,7 +6513,6 @@ public: // See if we can bring an existing preview to the front if(!LLPreview::show( mUUID )) { - S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); @@ -6761,14 +6632,18 @@ void LLWearableBridgeAction::wearOnAvatar() { // TODO: investigate wearables may not be loaded at this point EXT-8231 - static LLCachedControl add(gSavedSettings, "LiruAddNotReplace"); LLViewerInventoryItem* item = getItem(); if(item) { if (get_is_item_worn(item)) + { LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); + } else + { + static LLCachedControl add(gSavedSettings, "LiruAddNotReplace"); LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, !add); + } } } @@ -6816,6 +6691,10 @@ LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_ return action; } +/** Bridge Actions + ** + ********************************************************************************/ + /************************************************************************/ /* Recent Inventory Panel related classes */ /************************************************************************/ @@ -6840,27 +6719,14 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( U32 flags /*= 0x00*/ ) const { LLInvFVBridge* new_listener = NULL; - switch(asset_type) + if (asset_type == LLAssetType::AT_CATEGORY + && actual_asset_type != LLAssetType::AT_LINK_FOLDER) { - case LLAssetType::AT_CATEGORY: - if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) - { - // *TODO: Create a link folder handler instead if it is necessary - new_listener = LLInventoryFVBridgeBuilder::createBridge( - asset_type, - actual_asset_type, - inv_type, - inventory, - root, - uuid, - flags); - break; - } new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid); - break; - default: - new_listener = LLInventoryFVBridgeBuilder::createBridge( - asset_type, + } + else + { + new_listener = LLInventoryFVBridgeBuilder::createBridge(asset_type, actual_asset_type, inv_type, inventory, @@ -6869,8 +6735,6 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( flags); } return new_listener; - } - // EOF diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c795e6c57..fdcfac11c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -74,7 +74,6 @@ BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; ///---------------------------------------------------------------------------- //BOOL decompress_file(const char* src_filename, const char* dst_filename); - const char CACHE_FORMAT_STRING[] = "%s.inv"; struct InventoryIDPtrLess @@ -531,8 +530,8 @@ private: LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, - void (*callback)(const LLSD&, void*)/*=NULL*/, - void* user_data/*=NULL*/) + void (*callback)(const LLSD&, void*), //Default to NULL + void* user_data) //Default to NULL { LLUUID id; if(!isInventoryUsable()) @@ -1100,9 +1099,6 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, const LLUUID& new_parent_id, BOOL restamp) { - // - bool send_parent_update = gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getRootFolderID()); - // if (item->getParentUUID() == new_parent_id) { LL_DEBUGS("Inventory") << "'" << item->getName() << "' (" << item->getUUID() @@ -1123,7 +1119,7 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, LLPointer new_item = new LLViewerInventoryItem(item); new_item->setParent(new_parent_id); // - if(send_parent_update) + if(gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getRootFolderID())) // new_item->updateParentOnServer(restamp); updateItem(new_item); @@ -1254,7 +1250,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) return; } LLPointer cat = getCategory(id); - if(cat.notNull()) + if (cat.notNull()) { if (LLInventoryClipboard::instance().hasContents() && LLInventoryClipboard::instance().isCutMode()) { @@ -1290,7 +1286,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) // Fast purge // do the cache accounting llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName() - << llendl; + << llendl; S32 descendents = cat->getDescendentCount(); if(descendents > 0) { @@ -1325,6 +1321,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) { deleteObject(items.get(i)->getUUID()); } + count = categories.count(); for(S32 i = 0; i < count; ++i) { @@ -1377,7 +1374,6 @@ void LLInventoryModel::notifyObservers() iter != mObservers.end(); ) { LLInventoryObserver* observer = *iter; - observer->changed(mModifyMask); // safe way to increment since changed may delete entries! (@!##%@!@&*!) @@ -1563,7 +1559,7 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category) } // try to localize default names first. See EXT-8319, EXT-7051. - //category->localizeName(); + category->localizeName(); // Insert category uniquely into the map mCategoryMap[category->getUUID()] = category; // LLPointer will deref and delete the old one @@ -1643,7 +1639,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const cat->setVersion(++version); lldebugs << "accounted: '" << cat->getName() << "' " << version << " with " << descendents_actual - << " descendents." << llendl; + << " descendents." << llendl; } } if(!accounted) @@ -1890,7 +1886,7 @@ bool LLInventoryModel::loadSkeleton( LLViewerInventoryCategory* tcat = *cit; // we can safely ignore anything loaded from file, but - // not sent down in the skeleton. + // not sent down in the skeleton. Must have been removed from inventory. if (cit == not_cached) { continue; @@ -2351,73 +2347,6 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const return (mID > rhs.mID); } -// Given the current state of the inventory items, figure out the -// clone information. *FIX: This is sub-optimal, since we can insert -// this information snurgically, but this makes sure the implementation -// works before we worry about optimization. -//void LLInventoryModel::recalculateCloneInformation() -//{ -// //dumpInventory(); -// -// // This implements a 'multi-map' like structure to keep track of -// // how many clones we find. -// typedef LLDynamicArray viewer_item_array_t; -// typedef std::map clone_map_t; -// clone_map_t clone_map; -// LLUUIDAndName id_and_name; -// viewer_item_array_t* clones = NULL; -// LLViewerInventoryItem* item = NULL; -// for(item = (LLViewerInventoryItem*)mItemMap.getFirstData(); -// item != NULL; -// item = (LLViewerInventoryItem*)mItemMap.getNextData()) -// { -// if(item->getType() == LLAssetType::AT_CALLINGCARD) -// { -// // if it's a calling card, we key off of the creator id, not -// // the asset id. -// id_and_name.mID = item->getCreatorUUID(); -// } -// else -// { -// // if it's not a calling card, we key clones from the -// // asset id. -// id_and_name.mID = item->getAssetUUID(); -// } -// if(id_and_name.mID == LLUUID::null) -// { -// continue; -// } -// id_and_name.mName = item->getName(); -// if(clone_map.checkData(id_and_name)) -// { -// clones = clone_map.getData(id_and_name); -// } -// else -// { -// clones = new viewer_item_array_t; -// clone_map.addData(id_and_name, clones); -// } -// clones->put(item); -// } -// -// S32 count = 0; -// for(clones = clone_map.getFirstData(); -// clones != NULL; -// clones = clone_map.getNextData()) -// { -// count = clones->count(); -// for(S32 i = 0; i < count; i++) -// { -// item = clones->get(i); -// item->setCloneCount(count - 1); -// //clones[i] = NULL; -// } -// delete clones; -// } -// clone_map.removeAllData(); -// //dumpInventory(); -//} - // static bool LLInventoryModel::loadFromFile(const std::string& filename, LLInventoryModel::cat_array_t& categories, @@ -2480,7 +2409,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, { if (is_cache_obsolete) break; - + LLPointer inv_item = new LLViewerInventoryItem; if( inv_item->importFileLocal(file) ) { @@ -3002,7 +2931,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // << titem->getParentUUID() << llendl; U32 callback_id; msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id); - if(titem->getUUID().notNull()) + if(titem->getUUID().notNull() ) // && callback_id.notNull() ) { items.push_back(titem); cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID())); @@ -3116,6 +3045,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getS32("AgentData", "Version", version); S32 descendents; msg->getS32("AgentData", "Descendents", descendents); + S32 i; S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); LLPointer tcategory = new LLViewerInventoryCategory(owner_id); @@ -3421,7 +3351,8 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c } //* @param[in] items vector of items in order to be saved. -/*void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items) +/* +void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items) { int sortField = 0; @@ -3441,8 +3372,8 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c } notifyObservers(); -}*/ - +} +*/ // See also LLInventorySort where landmarks in the Favorites folder are sorted. /*class LLViewerInventoryItemSort { @@ -3466,7 +3397,8 @@ public: // * @param source_item_id - LLUUID of the source item to be moved into new position // * @param target_item_id - LLUUID of the target item before which source item should be placed. -/*void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id) +/* +void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -3481,7 +3413,10 @@ public: updateItemsOrder(items, source_item_id, target_item_id); saveItemsOrder(items); -}*/ +} +*/ +//---------------------------------------------------------------------------- + // *NOTE: DEBUG functionality void LLInventoryModel::dumpInventory() const { @@ -3493,8 +3428,8 @@ void LLInventoryModel::dumpInventory() const if(cat) { llinfos << " " << cat->getUUID() << " '" << cat->getName() << "' " - << cat->getVersion() << " " << cat->getDescendentCount() << " parent: " << cat->getParentUUID() - << LL_ENDL; + << cat->getVersion() << " " << cat->getDescendentCount() << " parent: " << cat->getParentUUID() + << llendl; } else { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 887f0a474..9db175ec2 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -102,12 +102,12 @@ void LLInventoryCompletionObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as // appropriate. - if(!mIncomplete.empty()) + if (!mIncomplete.empty()) { - for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) + for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { - LLViewerInventoryItem* item = gInventory.getItem(*it); - if(!item) + const LLViewerInventoryItem* item = gInventory.getItem(*it); + if (!item) { it = mIncomplete.erase(it); continue; @@ -120,7 +120,7 @@ void LLInventoryCompletionObserver::changed(U32 mask) } ++it; } - if(mIncomplete.empty()) + if (mIncomplete.empty()) { done(); } @@ -129,7 +129,7 @@ void LLInventoryCompletionObserver::changed(U32 mask) void LLInventoryCompletionObserver::watchItem(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { mIncomplete.push_back(id); } @@ -158,6 +158,7 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) // appropriate. if (!mIncomplete.empty()) { + // Have we exceeded max wait time? bool timeout_expired = mFetchingPeriod.hasExpired(); @@ -201,6 +202,7 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) void fetch_items_from_llsd(const LLSD& items_llsd) { if (!items_llsd.size() || gDisconnected) return; + LLSD body; body[0]["cap_name"] = "FetchInventory2"; body[1]["cap_name"] = "FetchLib2"; @@ -244,7 +246,7 @@ void fetch_items_from_llsd(const LLSD& items_llsd) for (S32 j=0; jnewMessageFast(_PREHASH_FetchInventory); @@ -255,13 +257,13 @@ void fetch_items_from_llsd(const LLSD& items_llsd) msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_OwnerID, item_entry["owner_id"].asUUID()); msg->addUUIDFast(_PREHASH_ItemID, item_entry["item_id"].asUUID()); - if(msg->isSendFull(NULL)) + if (msg->isSendFull(NULL)) { start_new_message = TRUE; gAgent.sendReliableMessage(); } } - if(!start_new_message) + if (!start_new_message) { gAgent.sendReliableMessage(); } @@ -335,8 +337,8 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask) { for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();) { - LLViewerInventoryCategory* cat = gInventory.getCategory(*it); - if(!cat) + const LLViewerInventoryCategory* cat = gInventory.getCategory(*it); + if (!cat) { it = mIncomplete.erase(it); continue; @@ -465,7 +467,7 @@ void LLInventoryFetchComboObserver::startFetch() void LLInventoryExistenceObserver::watchItem(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { mMIA.push_back(id); } @@ -475,12 +477,12 @@ void LLInventoryExistenceObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as // appropriate. - if(!mMIA.empty()) + if (!mMIA.empty()) { - for(uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); ) + for (uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); ) { LLViewerInventoryItem* item = gInventory.getItem(*it); - if(!item) + if (!item) { ++it; continue; @@ -488,7 +490,7 @@ void LLInventoryExistenceObserver::changed(U32 mask) mExist.push_back(*it); it = mMIA.erase(it); } - if(mMIA.empty()) + if (mMIA.empty()) { done(); } @@ -589,7 +591,7 @@ void LLInventoryAddedObserver::changed(U32 mask) LLPointer titem = new LLViewerInventoryItem; S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); - for(S32 i = 0; i < num_blocks; ++i) + for (S32 i = 0; i < num_blocks; ++i) { titem->unpackMessage(msg, _PREHASH_InventoryData, i); if (!(titem->getUUID().isNull())) @@ -639,18 +641,18 @@ LLInventoryTransactionObserver::LLInventoryTransactionObserver(const LLTransacti void LLInventoryTransactionObserver::changed(U32 mask) { - if(mask & LLInventoryObserver::ADD) + if (mask & LLInventoryObserver::ADD) { // This could be it - see if we are processing a bulk update LLMessageSystem* msg = gMessageSystem; - if(msg->getMessageName() + if (msg->getMessageName() && (0 == strcmp(msg->getMessageName(), "BulkUpdateInventory"))) { // we have a match for the message - now check the // transaction id. LLUUID id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, id); - if(id == mTransactionID) + if (id == mTransactionID) { // woo hoo, we found it uuid_vec_t folders; @@ -658,19 +660,19 @@ void LLInventoryTransactionObserver::changed(U32 mask) S32 count; count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); S32 i; - for(i = 0; i < count; ++i) + for (i = 0; i < count; ++i) { msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_FolderID, id, i); - if(id.notNull()) + if (id.notNull()) { folders.push_back(id); } } count = msg->getNumberOfBlocksFast(_PREHASH_ItemData); - for(i = 0; i < count; ++i) + for (i = 0; i < count; ++i) { msg->getUUIDFast(_PREHASH_ItemData, _PREHASH_ItemID, id, i); - if(id.notNull()) + if (id.notNull()) { items.push_back(id); } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 99991e769..1b2600a19 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -113,10 +113,10 @@ static bool nameSplit(const std::string& full, std::string& first, std::string& first = fragments[0]; if (fragments.size() == 1) { - if (gHippoGridManager->getConnectedGrid()->isSecondLife()) - last = "Resident"; - else + if (gHippoGridManager->getConnectedGrid()->isAurora()) last = ""; + else + last = "Resident"; } else last = fragments[1]; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 821ebd4a0..90714d99f 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2490,6 +2490,18 @@ void LLPanelObject::onCopyRot(void* user_data) gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(stringVec)); } +namespace +{ + bool texturePermsCheck(const LLUUID& id) + { + return (id.notNull() && !gInventory.isObjectDescendentOf(id, gInventory.getLibraryRootFolderID()) + && id != LLUUID(gSavedSettings.getString("UIImgWhiteUUID")) + && id != LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")) + && id != LLUUID(std::string("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")) // alpha + && LLPanelObject::findItemID(id).isNull()); + } +} + void LLPanelObject::onCopyParams(void* user_data) { LLPanelObject* self = (LLPanelObject*) user_data; @@ -2500,36 +2512,19 @@ void LLPanelObject::onCopyParams(void* user_data) LLViewerObject* objp = self->mObject; - mClipboardFlexiParams = (LLFlexibleObjectData*)objp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); - mClipboardLightParams = (LLLightParams*)objp->getParameterEntry(LLNetworkData::PARAMS_LIGHT); - mClipboardSculptParams = (LLSculptParams*)objp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + mClipboardFlexiParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE)) : NULL; + mClipboardLightParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_LIGHT)) : NULL; + mClipboardSculptParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_SCULPT)) : NULL; if (mClipboardSculptParams) { - LLUUID id = mClipboardSculptParams->getSculptTexture(); - - // Texture perms check - if (!(id.isNull() || gInventory.isObjectDescendentOf(id, gInventory.getLibraryRootFolderID()) - || id == LLUUID(gSavedSettings.getString("UIImgWhiteUUID")) - || id == LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")) - || id == LLUUID(std::string("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"))) // alpha - && findItemID(id).isNull()) - { - mClipboardSculptParams->setSculptTexture(LLUUID(SCULPT_DEFAULT_TEXTURE)); - } + const LLUUID id = mClipboardSculptParams->getSculptTexture(); + if (id != LLUUID(SCULPT_DEFAULT_TEXTURE) && !texturePermsCheck(id)) + mClipboardSculptParams = NULL; } - mClipboardLightImageParams = (LLLightImageParams*)objp->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (mClipboardLightImageParams) + mClipboardLightImageParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE)) : NULL; + if (mClipboardLightImageParams && texturePermsCheck(mClipboardLightImageParams->getLightTexture())) { - LLUUID id = mClipboardLightImageParams->getLightTexture(); - - // Texture perms check - if (!(id.isNull() || gInventory.isObjectDescendentOf(id, gInventory.getLibraryRootFolderID()) - || id == LLUUID(gSavedSettings.getString("UIImgWhiteUUID")) - || id == LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")) - || id == LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"))) // alpha - { - mClipboardLightImageParams->setLightTexture(findItemID(id)); - } + mClipboardLightImageParams = NULL; } } @@ -2542,16 +2537,27 @@ void LLPanelObject::onPasteParams(void* user_data) LLViewerObject* objp = self->mObject; - objp->updateVolume(mClipboardVolumeParams); - if (mClipboardFlexiParams) objp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, *mClipboardFlexiParams, true); + else + objp->setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, false, true); + if (mClipboardLightParams) objp->setParameterEntry(LLNetworkData::PARAMS_LIGHT, *mClipboardLightParams, true); + else + objp->setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, false, true); + if (mClipboardSculptParams) objp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, *mClipboardSculptParams, true); + else + objp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, false, true); + if (mClipboardLightImageParams) objp->setParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE, *mClipboardLightImageParams, true); + else + objp->setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, false, true); + + objp->updateVolume(mClipboardVolumeParams); } void LLPanelObject::onLinkObj(void* user_data) diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 0dc00f826..f3a1831db 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -3,10 +3,9 @@ * @brief LLToolPie class implementation * * $LicenseInfo:firstyear=2001&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2001-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -42,7 +41,6 @@ #include "llagentcamera.h" #include "llfocusmgr.h" #include "llfirstuse.h" -#include "llfloateravatarinfo.h" #include "llfloaterland.h" #include "llfloaterscriptdebug.h" #include "llhoverview.h" @@ -64,81 +62,86 @@ #include "llviewerobject.h" #include "llviewerparcelmgr.h" #include "llviewerwindow.h" -#include "llwindow.h" #include "llviewermedia.h" #include "llvoavatarself.h" #include "llviewermediafocus.h" #include "llworld.h" #include "llui.h" #include "llweb.h" - -// [RLVa:KB] +// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) #include "rlvhandler.h" // [/RLVa:KB] -extern void handle_buy(); - extern BOOL gDebugClicks; -static bool handle_media_click(const LLPickInfo& info); -static bool handle_media_hover(const LLPickInfo& info); static void handle_click_action_play(); static void handle_click_action_open_media(LLPointer objectp); static ECursorType cursor_from_parcel_media(U8 click_action); - LLToolPie::LLToolPie() : LLTool(std::string("Pie")), - mPieMouseButtonDown( FALSE ), - mGrabMouseButtonDown( FALSE ), - mMouseOutsideSlop( FALSE ), - mClickAction(0) -{ } + mMouseButtonDown( false ), + mMouseOutsideSlop( false ), + mMouseSteerX(-1), + mMouseSteerY(-1), + mBlockClickToWalk(false), + mClickAction(0), + mClickActionBuyEnabled("ClickActionBuyEnabled"), + mClickActionPayEnabled("ClickActionPayEnabled") +{ +} BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) { + mMouseOutsideSlop = FALSE; + mMouseDownX = x; + mMouseDownY = y; + //left mouse down always picks transparent - gViewerWindow->pickAsync(x, y, mask, leftMouseCallback, TRUE, TRUE); - mGrabMouseButtonDown = TRUE; + mPick = gViewerWindow->pickImmediate(x, y, TRUE); + mPick.mKeyMask = mask; + + mMouseButtonDown = true; + + handleLeftClickPick(); + return TRUE; } -// static -void LLToolPie::leftMouseCallback(const LLPickInfo& pick_info) -{ - LLToolPie::getInstance()->mPick = pick_info; - LLToolPie::getInstance()->pickAndShowMenu(FALSE); -} - +// Spawn context menus on right mouse down so you can drag over and select +// an item. BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) { // don't pick transparent so users can't "pay" transparent objects - gViewerWindow->pickAsync(x, y, mask, rightMouseCallback, FALSE, TRUE); - mPieMouseButtonDown = TRUE; - // don't steal focus from UI + mPick = gViewerWindow->pickImmediate(x, y, FALSE); + mPick.mKeyMask = mask; + + // claim not handled so UI focus stays same + + handleRightClickPick(); + return FALSE; } +BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) +{ + LLToolMgr::getInstance()->clearTransientTool(); + return LLTool::handleRightMouseUp(x, y, mask); +} + BOOL LLToolPie::handleScrollWheel(S32 x, S32 y, S32 clicks) { return LLViewerMediaFocus::getInstance()->handleScrollWheel(x, y, clicks); } -// static -void LLToolPie::rightMouseCallback(const LLPickInfo& pick_info) -{ - LLToolPie::getInstance()->mPick = pick_info; - LLToolPie::getInstance()->pickAndShowMenu(TRUE); -} - // True if you selected an object. -BOOL LLToolPie::pickAndShowMenu(BOOL always_show) +BOOL LLToolPie::handleLeftClickPick() { S32 x = mPick.mMousePt.mX; S32 y = mPick.mMousePt.mY; MASK mask = mPick.mKeyMask; - if (!always_show && mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL) + if (mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel(); if (parcel) @@ -176,13 +179,15 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) parent = object->getRootEdit(); } - BOOL touchable = (object && object->flagHandleTouch()) - || (parent && parent->flagHandleTouch()); + if (handleMediaClick(mPick)) + { + return TRUE; + } // If it's a left-click, and we have a special action, do it. - if (useClickAction(always_show, mask, object, parent)) + if (useClickAction(mask, object, parent)) { -// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l +// [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l // Block left-click special actions when fartouch restricted if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (!gRlvHandler.canTouch(object, mPick.mObjectOffset)) ) @@ -207,22 +212,47 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // touch behavior down below... break; case CLICK_ACTION_SIT: - if ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting()) - && (!gSavedSettings.getBOOL("DisableClickSit"))) // agent not already sitting { - handle_sit_or_stand(); - // put focus in world when sitting on an object - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } // else nothing (fall through to touch) - + if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting + { + bool disable_click_sit = gSavedSettings.getBOOL("DisableClickSit"); + if (!disable_click_sit) + { + if (gSavedSettings.getBOOL("DisableClickSitOtherOwner")) + { + disable_click_sit = !object->permYouOwner(); + } + } + if (disable_click_sit) return true; + handle_object_sit_or_stand(); + // put focus in world when sitting on an object + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } // else nothing (fall through to touch) + } case CLICK_ACTION_PAY: - if ((object && object->flagTakesMoney()) - || (parent && parent->flagTakesMoney())) + if ( mClickActionPayEnabled ) { - // pay event goes to object actually clicked on - mClickActionObject = object; - mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); + if ((object && object->flagTakesMoney()) + || (parent && parent->flagTakesMoney())) + { + // pay event goes to object actually clicked on + mClickActionObject = object; + mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); + if (LLSelectMgr::getInstance()->selectGetAllValid()) + { + // call this right away, since we have all the info we need to continue the action + selectionPropertiesReceived(); + } + return TRUE; + } + } + break; + case CLICK_ACTION_BUY: + if ( mClickActionBuyEnabled ) + { + mClickActionObject = parent; + mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action @@ -231,15 +261,6 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) return TRUE; } break; - case CLICK_ACTION_BUY: - mClickActionObject = parent; - mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); - if (LLSelectMgr::getInstance()->selectGetAllValid()) - { - // call this right away, since we have all the info we need to continue the action - selectionPropertiesReceived(); - } - return TRUE; case CLICK_ACTION_OPEN: if (parent && parent->allowOpen()) { @@ -259,27 +280,53 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // mClickActionObject = object; handle_click_action_open_media(object); return TRUE; + case CLICK_ACTION_ZOOM: + { + const F32 PADDING_FACTOR = 2.f; + LLViewerObject* object = gObjectList.findObject(mPick.mObjectID); + + if (object) + { + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + + LLBBox bbox = object->getBoundingBoxAgent() ; + F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); + F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view); + + LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent(); + obj_to_cam.normVec(); + + LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent()); + gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance), + object_center_global, + mPick.mObjectID ); + } + } + return TRUE; default: // nothing break; } } - if (!always_show && handle_media_click(mPick)) + // put focus back "in world" + if (gFocusMgr.getKeyboardFocus()) { - return FALSE; + // don't click to walk on attempt to give focus to world + mBlockClickToWalk = true; + gFocusMgr.setKeyboardFocus(NULL); } - // put focus back "in world" - gFocusMgr.setKeyboardFocus(NULL); + BOOL touchable = (object && object->flagHandleTouch()) + || (parent && parent->flagHandleTouch()); // Switch to grab tool if physical or triggerable if (object && !object->isAvatar() && - ((object->flagUsePhysics() || (parent && !parent->isAvatar() && parent->flagUsePhysics())) || touchable) && - !always_show) + ((object->flagUsePhysics() || (parent && !parent->isAvatar() && parent->flagUsePhysics())) || touchable) + ) { -// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l +// [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l // Triggered by left-clicking on a touchable object if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object, mPick.mObjectOffset)) ) { @@ -288,6 +335,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // [/RLVa:KB] gGrabTransientTool = this; + mMouseButtonDown = false; LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); return LLToolGrab::getInstance()->handleObjectHit( mPick ); } @@ -300,13 +348,12 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // If left-click never selects or spawns a menu // Eat the event. - if (!gSavedSettings.getBOOL("LeftClickShowMenu") - && !always_show) + if (!gSavedSettings.getBOOL("LeftClickShowMenu")) { // mouse already released - if (!mGrabMouseButtonDown) + if (!mMouseButtonDown) { - return TRUE; + return true; } while( object && object->isAttachment() && !object->flagHandleTouch()) @@ -318,9 +365,10 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) } object = (LLViewerObject*)object->getParent(); } - if (object && object == gAgentAvatarp) + if (object && object == gAgentAvatarp && !gSavedSettings.getBOOL("ClickToWalk")) { // we left clicked on avatar, switch to focus mode + mMouseButtonDown = false; LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); gViewerWindow->hideCursor(); LLToolCamera::getInstance()->setMouseCapture(TRUE); @@ -339,7 +387,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) return LLTool::handleMouseDown(x, y, mask); } - if (!always_show && gAgent.leftButtonGrabbed()) + if (gAgent.leftButtonGrabbed()) { // if the left button is grabbed, don't put up the pie menu return LLTool::handleMouseDown(x, y, mask); @@ -349,175 +397,15 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); // Spawn pie menu - if (mPick.mPickType == LLPickInfo::PICK_LAND) - { - LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal ); - gMenuHolder->setParcelSelection(selection); - gPieLand->show(x, y, mPieMouseButtonDown); - - // - if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) - { - // - // VEFFECT: ShowPie - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); - effectp->setPositionGlobal(mPick.mPosGlobal); - effectp->setColor(LLColor4U(gAgent.getEffectColor())); - effectp->setDuration(0.25f); - // - } - // - } - else if (mPick.mObjectID == gAgent.getID() ) - { - if(!gPieSelf) - { - //either at very early startup stage or at late quitting stage, - //this event is ignored. - return TRUE ; - } - - gPieSelf->show(x, y, mPieMouseButtonDown); - } - else if (object) - { - gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); - - if (object->isAvatar() - || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) - { - // Find the attachment's avatar - while( object && object->isAttachment()) - { - object = (LLViewerObject*)object->getParent(); - } - - if (!object) - { - return TRUE; // unexpected, but escape - } - - // Object is an avatar, so check for mute by id. - LLVOAvatar* avatar = (LLVOAvatar*)object; - std::string name = avatar->getFullname(); - if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) - { - gMenuHolder->childSetText("Avatar Mute", LLTrans::getString("UnmuteAvatar")); - //gMutePieMenu->setLabel("Unmute"); - } - else - { - gMenuHolder->childSetText("Avatar Mute", LLTrans::getString("MuteAvatar")); - //gMutePieMenu->setLabel("Mute"); - } - - //gPieAvatar->show(x, y, mPieMouseButtonDown); -// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l - // Don't show the pie menu on empty selection when fartouch/interaction restricted [see LLToolSelect::handleObjectSelection()] - if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || - (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) - { - gPieAvatar->show(x, y, mPieMouseButtonDown); - } - else - { - make_ui_sound("UISndInvalidOp"); - } -// [/RLVa:KB] - } - else if (object->isAttachment()) - { - //gPieAttachment->show(x, y, mPieMouseButtonDown); -// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l - // Don't show the pie menu on empty selection when fartouch/interaction restricted [see LLToolSelect::handleObjectSelection()] - if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || - (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) - { - gPieAttachment->show(x, y, mPieMouseButtonDown); - } - else - { - make_ui_sound("UISndInvalidOp"); - } -// [/RLVa:KB] - } - else - { - // BUG: What about chatting child objects? - std::string name; - LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); - if (node) - { - name = node->mName; - } - if (LLMuteList::getInstance()->isMuted(object->getID(), name)) - { - gMenuHolder->childSetText("Object Mute", LLTrans::getString("UnmuteObject")); - //gMuteObjectPieMenu->setLabel("Unmute"); - } - else - { - gMenuHolder->childSetText("Object Mute", LLTrans::getString("MuteObject2")); - //gMuteObjectPieMenu->setLabel("Mute"); - } - -// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l - // Don't show the pie menu on empty selection when fartouch/interaction restricted - // (not entirely accurate in case of Tools / Select Only XXX [see LLToolSelect::handleObjectSelection()] - if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || - (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) - { -// [/RLVa:KB] - gPieObject->show(x, y, mPieMouseButtonDown); - - // - if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) - { - // - // VEFFECT: ShowPie object - // Don't show when you click on someone else, it freaks them - // out. - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect( - LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); - effectp->setPositionGlobal(mPick.mPosGlobal); - effectp->setColor(LLColor4U(gAgent.getEffectColor())); - effectp->setDuration(0.25f); - // - } - // -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f - } - else - { - make_ui_sound("UISndInvalidOp"); - } -// [/RLVa:KB] - } - } - - if (always_show) - { - // ignore return value - LLTool::handleRightMouseDown(x, y, mask); - } - else - { - // ignore return value - LLTool::handleMouseDown(x, y, mask); - } - - // We handled the event. + LLTool::handleRightMouseDown(x, y, mask); return TRUE; } - -BOOL LLToolPie::useClickAction(BOOL always_show, - MASK mask, +BOOL LLToolPie::useClickAction(MASK mask, LLViewerObject* object, LLViewerObject* parent) { - return !always_show - && mask == MASK_NONE + return mask == MASK_NONE && object && !object->isAttachment() && LLPrimitive::isPrimitive(object->getPCode()) @@ -548,7 +436,7 @@ U8 final_click_action(LLViewerObject* obj) return click_action; } -ECursorType cursor_from_object(LLViewerObject* object) +ECursorType LLToolPie::cursorFromObject(LLViewerObject* object) { LLViewerObject* parent = NULL; if (object) @@ -560,17 +448,22 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: -// if ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting())) // not already sitting? -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - if ( ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) && // not already sitting? - ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, gViewerWindow->getHoverPick().mObjectOffset))) ) -// [/RLVa:KB] { - cursor = UI_CURSOR_TOOLSIT; +// if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting? +// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.2.0g + if ( (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) && + ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, LLToolPie::getInstance()->getHoverPick().mObjectOffset))) ) +// [/RLVa:KB] + { + cursor = UI_CURSOR_TOOLSIT; + } } break; case CLICK_ACTION_BUY: - cursor = UI_CURSOR_TOOLBUY; + if ( mClickActionBuyEnabled ) + { + cursor = UI_CURSOR_TOOLBUY; + } break; case CLICK_ACTION_OPEN: // Open always opens the parent. @@ -580,12 +473,18 @@ ECursorType cursor_from_object(LLViewerObject* object) } break; case CLICK_ACTION_PAY: - if ((object && object->flagTakesMoney()) - || (parent && parent->flagTakesMoney())) + if ( mClickActionPayEnabled ) { - cursor = UI_CURSOR_TOOLPAY; + if ((object && object->flagTakesMoney()) + || (parent && parent->flagTakesMoney())) + { + cursor = UI_CURSOR_TOOLPAY; + } } break; + case CLICK_ACTION_ZOOM: + cursor = UI_CURSOR_TOOLZOOMIN; + break; case CLICK_ACTION_PLAY: case CLICK_ACTION_OPEN_MEDIA: cursor = cursor_from_parcel_media(click_action); @@ -603,6 +502,20 @@ void LLToolPie::resetSelection() mClickAction = 0; } +void LLToolPie::walkToClickedLocation() +{ + /* Singu TODO: llhudeffectblob + if(mAutoPilotDestination) { mAutoPilotDestination->markDead(); } + mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE); + mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal); + mAutoPilotDestination->setPixelSize(5); + mAutoPilotDestination->setColor(LLColor4U(170, 210, 190)); + mAutoPilotDestination->setDuration(3.f); + */ + + handle_go_to(); +} + // When we get object properties after left-clicking on an object // with left-click = buy, if it's the same object, do the buy. @@ -628,10 +541,16 @@ void LLToolPie::selectionPropertiesReceived() switch (click_action) { case CLICK_ACTION_BUY: - handle_buy(); + if ( LLToolPie::getInstance()->mClickActionBuyEnabled ) + { + handle_buy(); + } break; case CLICK_ACTION_PAY: - handle_give_money_dialog(); + if ( LLToolPie::getInstance()->mClickActionPayEnabled ) + { + handle_give_money_dialog(); + } break; case CLICK_ACTION_OPEN: handle_object_open(); @@ -646,40 +565,18 @@ void LLToolPie::selectionPropertiesReceived() BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) { - /* - // If auto-rotate occurs, tag mouse-outside-slop to make sure the drag - // gets started. - const S32 ROTATE_H_MARGIN = (S32) (0.1f * gViewerWindow->getWindowWidth() ); - const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; - const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped; - // ...normal modes can only yaw - if (x < ROTATE_H_MARGIN) - { - gAgent.yaw(rotate_angle); - mMouseOutsideSlop = TRUE; - } - else if (x > gViewerWindow->getWindowWidth() - ROTATE_H_MARGIN) - { - gAgent.yaw(-rotate_angle); - mMouseOutsideSlop = TRUE; - } - */ - - - LLViewerObject *object = NULL; + mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE); LLViewerObject *parent = NULL; -// object = gViewerWindow->getHoverPick().getObject(); -// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l + LLViewerObject *object = mHoverPick.getObject(); +// [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l // Block all special click action cursors when: // - @fartouch=n restricted and the object is out of range // - @interact=n restricted and the object isn't a HUD attachment - const LLPickInfo& pick = gViewerWindow->getHoverPick(); - object = pick.getObject(); if ( (object) && (rlv_handler_t::isEnabled()) && - ( (((gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH))) && (!gRlvHandler.canTouch(object, pick.mObjectOffset))) || + ( ((gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH))) && (!gRlvHandler.canTouch(object, mHoverPick.mObjectOffset)) || ((gRlvHandler.hasBehaviour(RLV_BHVR_INTERACT)) && (!object->isHUDAttachment())) ) ) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); return TRUE; } // [/RLVa:KB] @@ -687,49 +584,78 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) if (object) { parent = object->getRootEdit(); + } - if (object && useClickAction(FALSE, mask, object, parent)) + if (handleMediaHover(mHoverPick)) + { + // cursor set by media object + } + else if (!mMouseOutsideSlop + && mMouseButtonDown + && gSavedSettings.getBOOL("ClickToWalk")) + { + S32 delta_x = x - mMouseDownX; + S32 delta_y = y - mMouseDownY; + S32 threshold = gSavedSettings.getS32("DragAndDropDistanceThreshold"); + if (delta_x * delta_x + delta_y * delta_y > threshold * threshold) { - ECursorType cursor = cursor_from_object(object); - gViewerWindow->getWindow()->setCursor(cursor); + startCameraSteering(); + steerCameraWithMouse(x, y); + gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); } - else if (handle_media_hover(gViewerWindow->getHoverPick())) + else { - // cursor set by media object + gViewerWindow->setCursor(UI_CURSOR_ARROW); } -// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Added: RLVa-1.1.0l - else if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object)) ) + } + else if (inCameraSteerMode()) + { + steerCameraWithMouse(x, y); + gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); + } + else + { + // perform a separate pick that detects transparent objects since they respond to 1-click actions + LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, TRUE); + + LLViewerObject* click_action_object = click_action_pick.getObject(); + + if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit())) + { + ECursorType cursor = cursorFromObject(click_action_object); + gViewerWindow->setCursor(cursor); + } +// [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Added: RLVa-1.1.0l + else if ( (object) && (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object)) ) { // Block showing the "grab" or "touch" cursor if we can't touch the object (@fartouch=n is handled above) - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); } // [/RLVa:KB] else if ((object && !object->isAvatar() && object->flagUsePhysics()) || (parent && !parent->isAvatar() && parent->flagUsePhysics())) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLGRAB); + gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); } else if ( (object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_HAND); + gViewerWindow->setCursor(UI_CURSOR_HAND); } - - else + else { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); } - } - else + + if(!object) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); // We need to clear media hover flag if (LLViewerMediaFocus::getInstance()->getMouseOverFlag()) { LLViewerMediaFocus::getInstance()->setMouseOverFlag(false); } - } return TRUE; @@ -739,7 +665,46 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) { LLViewerObject* obj = mPick.getObject(); U8 click_action = final_click_action(obj); - if (click_action != CLICK_ACTION_NONE) + + // let media have first pass at click + if (handleMediaMouseUp() || LLViewerMediaFocus::getInstance()->getFocus()) + { + mBlockClickToWalk = true; + } + stopCameraSteering(); + mMouseButtonDown = false; + + if (click_action == CLICK_ACTION_NONE // not doing 1-click action + && gSavedSettings.getBOOL("ClickToWalk") // click to walk enabled + && !gAgent.getFlying() // don't auto-navigate while flying until that works + && gAgentAvatarp + && !gAgentAvatarp->isSitting() + && !mBlockClickToWalk // another behavior hasn't cancelled click to walk + && !mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick + && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land + || mPick.mObjectID.notNull())) // or on an object + { + // handle special cases of steering picks + LLViewerObject* avatar_object = mPick.getObject(); + + // get pointer to avatar + while (avatar_object && !avatar_object->isAvatar()) + { + avatar_object = (LLViewerObject*)avatar_object->getParent(); + } + + if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf()) + { + const F64 SELF_CLICK_WALK_DISTANCE = 3.0; + // pretend we picked some point a bit in front of avatar + mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE; + } + gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + walkToClickedLocation(); + + return TRUE; + } + else { switch(click_action) { @@ -751,7 +716,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) // the world. Keep the cursor an arrow, assuming that // after the user moves off the UI, they won't be on the // same object anymore. - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); // Make sure the hover-picked object is ignored. gHoverView->resetLastHoverObject(); break; @@ -759,20 +724,30 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) break; } } - mGrabMouseButtonDown = FALSE; + if (hasMouseCapture()) + { + setMouseCapture(FALSE); + } + LLToolMgr::getInstance()->clearTransientTool(); gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on + + mBlockClickToWalk = false; return LLTool::handleMouseUp(x, y, mask); } -BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) +void LLToolPie::stopClickToWalk() { - mPieMouseButtonDown = FALSE; - LLToolMgr::getInstance()->clearTransientTool(); - return LLTool::handleRightMouseUp(x, y, mask); + mPick.mPosGlobal = gAgent.getPositionGlobal(); + handle_go_to(); + /* Singu TODO: llhudeffectblob + if(mAutoPilotDestination) + { + mAutoPilotDestination->markDead(); + } + */ } - BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) { if (gDebugClicks) @@ -785,7 +760,7 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())) { - handle_go_to(); + walkToClickedLocation(); return TRUE; } } @@ -812,6 +787,11 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) return FALSE; } +void LLToolPie::handleSelect() +{ + // tool is reselected when app gets focus, etc. + mBlockClickToWalk = true; +} void LLToolPie::handleDeselect() { @@ -820,20 +800,23 @@ void LLToolPie::handleDeselect() setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly } // remove temporary selection for pie menu + LLSelectMgr::getInstance()->setHoverObject(NULL); LLSelectMgr::getInstance()->validateSelection(); } LLTool* LLToolPie::getOverrideTool(MASK mask) { - if (mask == MASK_CONTROL) + if (gSavedSettings.getBOOL("EnableGrab")) { - return LLToolGrab::getInstance(); + if (mask == MASK_CONTROL) + { + return LLToolGrab::getInstance(); + } + else if (mask == (MASK_CONTROL | MASK_SHIFT)) + { + return LLToolGrab::getInstance(); + } } - else if (mask == (MASK_CONTROL | MASK_SHIFT)) - { - return LLToolGrab::getInstance(); - } - return LLTool::getOverrideTool(mask); } @@ -847,9 +830,20 @@ void LLToolPie::stopEditing() void LLToolPie::onMouseCaptureLost() { - mMouseOutsideSlop = FALSE; + stopCameraSteering(); + mMouseButtonDown = false; + handleMediaMouseUp(); } +void LLToolPie::stopCameraSteering() +{ + mMouseOutsideSlop = false; +} + +bool LLToolPie::inCameraSteerMode() +{ + return mMouseButtonDown && mMouseOutsideSlop && gSavedSettings.getBOOL("ClickToWalk"); +} // true if x,y outside small box around start_x,start_y BOOL LLToolPie::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) @@ -888,7 +882,7 @@ static void handle_click_action_play() } } -static bool handle_media_click(const LLPickInfo& pick) +bool LLToolPie::handleMediaClick(const LLPickInfo& pick) { //FIXME: how do we handle object in different parcel than us? LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); @@ -906,23 +900,22 @@ static bool handle_media_click(const LLPickInfo& pick) return false; } - + // Does this face have media? + const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); + if(!tep) + return false; // HACK: This is directly referencing an impl name. BAD! // This can be removed when we have a truly generic media browser that only // builds an impl based on the type of url it is passed. - - // is media playing on this face? - const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); - viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(tep->getID()); - if (tep - && media_impl.notNull() - && media_impl->hasMedia() - && gSavedSettings.getBOOL("MediaOnAPrimUI")) + if (media_impl.isNull() || !media_impl->hasMedia()) + return false; + + if (gSavedSettings.getBOOL("MediaOnAPrimUI")) { LLObjectSelectionHandle selection = LLViewerMediaFocus::getInstance()->getSelection(); - if (! selection->contains(pick.getObject(), pick.mObjectFace)) + if (!selection->contains(pick.getObject(), pick.mObjectFace)) { LLViewerMediaFocus::getInstance()->setFocusFace(TRUE, pick.getObject(), pick.mObjectFace, media_impl); } @@ -941,7 +934,7 @@ static bool handle_media_click(const LLPickInfo& pick) return false; } -static bool handle_media_hover(const LLPickInfo& pick) +bool LLToolPie::handleMediaHover(const LLPickInfo& pick) { //FIXME: how do we handle object in different parcel than us? LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); @@ -959,7 +952,6 @@ static bool handle_media_hover(const LLPickInfo& pick) return false; } - // HACK: This is directly referencing an impl name. BAD! // This can be removed when we have a truly generic media browser that only // builds an impl based on the type of url it is passed. @@ -992,6 +984,26 @@ static bool handle_media_hover(const LLPickInfo& pick) return false; } +bool LLToolPie::handleMediaMouseUp() +{ + bool result = false; + if(mMediaMouseCaptureID.notNull()) + { + // Face media needs to know the mouse went up. + viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mMediaMouseCaptureID); + if(media_impl) + { + // This will send a mouseUp event to the plugin using the last known mouse coordinate (from a mouseDown or mouseMove), which is what we want. + media_impl->onMouseCaptureLost(); + } + + mMediaMouseCaptureID.setNull(); + + result = true; + } + + return result; +} static void handle_click_action_open_media(LLPointer objectp) { @@ -1017,14 +1029,6 @@ static void handle_click_action_open_media(LLPointer objectp) std::string media_type = std::string ( parcel->getMediaType() ); LLStringUtil::trim(media_url); - // Get the scheme, see if that is handled as well. - LLURI uri(media_url); - std::string media_scheme = uri.scheme() != "" ? uri.scheme() : "http"; - - // HACK: This is directly referencing an impl name. BAD! - // This can be removed when we have a truly generic media browser that only - // builds an impl based on the type of url it is passed. - LLWeb::loadURL(media_url); } @@ -1054,3 +1058,328 @@ static ECursorType cursor_from_parcel_media(U8 click_action) return UI_CURSOR_TOOLPLAY; } } + + +// True if we handled the event. +BOOL LLToolPie::handleRightClickPick() +{ + S32 x = mPick.mMousePt.mX; + S32 y = mPick.mMousePt.mY; + MASK mask = mPick.mKeyMask; + + if (mPick.mPickType != LLPickInfo::PICK_LAND) + { + LLViewerParcelMgr::getInstance()->deselectLand(); + } + + // didn't click in any UI object, so must have clicked in the world + LLViewerObject *object = mPick.getObject(); + LLViewerObject *parent = NULL; + if(object) + parent = object->getRootEdit(); + + // Can't ignore children here. + LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); + + // Spawn pie menu + if (mPick.mPickType == LLPickInfo::PICK_LAND) + { + LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal ); + gMenuHolder->setParcelSelection(selection); + gPieLand->show(x, y, true); + + showVisualContextMenuEffect(); + + } + else if (mPick.mObjectID == gAgent.getID() ) + { + if(!gPieSelf) + { + //either at very early startup stage or at late quitting stage, + //this event is ignored. + return TRUE ; + } + + gPieSelf->show(x, y, true); + } + else if (object) + { + gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); + + bool is_other_attachment = (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner()); + if (object->isAvatar() + || is_other_attachment) + { + // Find the attachment's avatar + while( object && object->isAttachment()) + { + object = (LLViewerObject*)object->getParent(); + llassert(object); + } + + if (!object) + { + return TRUE; // unexpected, but escape + } + + // Object is an avatar, so check for mute by id. + LLVOAvatar* avatar = (LLVOAvatar*)object; + std::string name = avatar->getFullname(); + std::string mute_msg; + if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) + { + mute_msg = LLTrans::getString("UnmuteAvatar"); + } + else + { + mute_msg = LLTrans::getString("MuteAvatar"); + } + gMenuHolder->childSetText("Avatar Mute", mute_msg); + +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l + // Don't show the pie menu on empty selection when fartouch restricted [see LLToolSelect::handleObjectSelection()] + if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || + (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) + { +// [/RLVa:KB] + /*if (is_other_attachment) + { + gPieAttachmentOther->show(x, y, true); + } + else*/ + { + gPieAvatar->show(x, y, true); + } +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l + } + else + { + make_ui_sound("UISndInvalidOp"); + } +// [/RLVa:KB] + } + else if (object->isAttachment()) + { + gPieAttachment->show(x, y, true); + } + else + { + // BUG: What about chatting child objects? + std::string name; + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if (node) + { + name = node->mName; + } + std::string mute_msg; + if (LLMuteList::getInstance()->isMuted(object->getID(), name)) + { + mute_msg = LLTrans::getString("UnmuteObject"); + } + else + { + mute_msg = LLTrans::getString("MuteObject2"); + } + +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.el) | Modified: RLVa-1.1.0l + // Don't show the pie menu on empty selection when fartouch/interaction restricted + // (not entirely accurate in case of Tools / Select Only XXX [see LLToolSelect::handleObjectSelection()] + if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || + (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) + { +// [/RLVa:KB] + gMenuHolder->childSetText("Object Mute", mute_msg); + gPieObject->show(x, y, true); + + showVisualContextMenuEffect(); +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.el) | Modified: RLVa-1.1.0l + } + else + { + make_ui_sound("UISndInvalidOp"); + } +// [/RLVa:KB] + } + } + + LLTool::handleRightMouseDown(x, y, mask); + // We handled the event. + return TRUE; +} + +void LLToolPie::showVisualContextMenuEffect() +{ + // + if (gSavedSettings.getBOOL("DisablePointAtAndBeam")) return; + // + // VEFFECT: ShowPie + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); + effectp->setPositionGlobal(mPick.mPosGlobal); + effectp->setColor(LLColor4U(gAgent.getEffectColor())); + effectp->setDuration(0.25f); +} + +typedef enum e_near_far +{ + NEAR_INTERSECTION, + FAR_INTERSECTION +} ENearFar; + +bool intersect_ray_with_sphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius, e_near_far near_far, LLVector3& intersection_pt) +{ + // do ray/sphere intersection by solving quadratic equation + LLVector3 sphere_to_ray_start_vec = ray_pt - sphere_center; + F32 B = 2.f * ray_dir * sphere_to_ray_start_vec; + F32 C = sphere_to_ray_start_vec.lengthSquared() - (sphere_radius * sphere_radius); + + F32 discriminant = B*B - 4.f*C; + if (discriminant >= 0.f) + { // intersection detected, now find closest one + F32 t0 = (-B - sqrtf(discriminant)) / 2.f; + + if (t0 > 0.f && near_far == NEAR_INTERSECTION) + { + intersection_pt = ray_pt + ray_dir * t0; + } + else + { + F32 t1 = (-B + sqrtf(discriminant)) / 2.f; + intersection_pt = ray_pt + ray_dir * t1; + } + return true; + } + else + { // no intersection + return false; + } +} + +void LLToolPie::startCameraSteering() +{ + mMouseOutsideSlop = true; + mBlockClickToWalk = true; + + if (gAgentCamera.getFocusOnAvatar()) + { + mSteerPick = mPick; + + // handle special cases of steering picks + LLViewerObject* avatar_object = mSteerPick.getObject(); + + // get pointer to avatar + while (avatar_object && !avatar_object->isAvatar()) + { + avatar_object = (LLViewerObject*)avatar_object->getParent(); + } + + // if clicking on own avatar... + if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf()) + { + // ...project pick point a few meters in front of avatar + mSteerPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * 3.0; + } + + if (!mSteerPick.isValid()) + { + mSteerPick.mPosGlobal = gAgent.getPosGlobalFromAgent( + LLViewerCamera::instance().getOrigin() + gViewerWindow->mouseDirectionGlobal(mSteerPick.mMousePt.mX, mSteerPick.mMousePt.mY) * 100.f); + } + + setMouseCapture(TRUE); + + mMouseSteerX = mMouseDownX; + mMouseSteerY = mMouseDownY; + const LLVector3 camera_to_rotation_center = gAgent.getFrameAgent().getOrigin() - LLViewerCamera::instance().getOrigin(); + const LLVector3 rotation_center_to_pick = gAgent.getPosAgentFromGlobal(mSteerPick.mPosGlobal) - gAgent.getFrameAgent().getOrigin(); + + mClockwise = camera_to_rotation_center * rotation_center_to_pick < 0.f; + /* Singu TODO: llhudeffectblob + if (mMouseSteerGrabPoint) { mMouseSteerGrabPoint->markDead(); } + mMouseSteerGrabPoint = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE); + mMouseSteerGrabPoint->setPositionGlobal(mSteerPick.mPosGlobal); + mMouseSteerGrabPoint->setColor(LLColor4U(170, 210, 190)); + mMouseSteerGrabPoint->setPixelSize(5); + mMouseSteerGrabPoint->setDuration(2.f); + */ + } +} + +void LLToolPie::steerCameraWithMouse(S32 x, S32 y) +{ + const LLViewerCamera& camera = LLViewerCamera::instance(); + const LLCoordFrame& rotation_frame = gAgent.getFrameAgent(); + const LLVector3 pick_pos = gAgent.getPosAgentFromGlobal(mSteerPick.mPosGlobal); + const LLVector3 pick_rotation_center = rotation_frame.getOrigin() + parallel_component(pick_pos - rotation_frame.getOrigin(), rotation_frame.getUpAxis()); + const F32 MIN_ROTATION_RADIUS_FRACTION = 0.2f; + const F32 min_rotation_radius = MIN_ROTATION_RADIUS_FRACTION * dist_vec(pick_rotation_center, camera.getOrigin());; + const F32 pick_distance_from_rotation_center = llclamp(dist_vec(pick_pos, pick_rotation_center), min_rotation_radius, F32_MAX); + const LLVector3 camera_to_rotation_center = pick_rotation_center - camera.getOrigin(); + const LLVector3 adjusted_camera_pos = LLViewerCamera::instance().getOrigin() + projected_vec(camera_to_rotation_center, rotation_frame.getUpAxis()); + const F32 camera_distance_from_rotation_center = dist_vec(adjusted_camera_pos, pick_rotation_center); + + LLVector3 mouse_ray = orthogonal_component(gViewerWindow->mouseDirectionGlobal(x, y), rotation_frame.getUpAxis()); + mouse_ray.normalize(); + + LLVector3 old_mouse_ray = orthogonal_component(gViewerWindow->mouseDirectionGlobal(mMouseSteerX, mMouseSteerY), rotation_frame.getUpAxis()); + old_mouse_ray.normalize(); + + F32 yaw_angle; + F32 old_yaw_angle; + LLVector3 mouse_on_sphere; + LLVector3 old_mouse_on_sphere; + + if (intersect_ray_with_sphere( + adjusted_camera_pos, + mouse_ray, + pick_rotation_center, + pick_distance_from_rotation_center, + FAR_INTERSECTION, + mouse_on_sphere)) + { + LLVector3 mouse_sphere_offset = mouse_on_sphere - pick_rotation_center; + yaw_angle = atan2f(mouse_sphere_offset * rotation_frame.getLeftAxis(), mouse_sphere_offset * rotation_frame.getAtAxis()); + } + else + { + yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center); + if (mouse_ray * rotation_frame.getLeftAxis() < 0.f) + { + yaw_angle *= -1.f; + } + } + + if (intersect_ray_with_sphere( + adjusted_camera_pos, + old_mouse_ray, + pick_rotation_center, + pick_distance_from_rotation_center, + FAR_INTERSECTION, + old_mouse_on_sphere)) + { + LLVector3 mouse_sphere_offset = old_mouse_on_sphere - pick_rotation_center; + old_yaw_angle = atan2f(mouse_sphere_offset * rotation_frame.getLeftAxis(), mouse_sphere_offset * rotation_frame.getAtAxis()); + } + else + { + old_yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center); + + if (mouse_ray * rotation_frame.getLeftAxis() < 0.f) + { + old_yaw_angle *= -1.f; + } + } + + const F32 delta_angle = yaw_angle - old_yaw_angle; + + if (mClockwise) + { + gAgent.yaw(delta_angle); + } + else + { + gAgent.yaw(-delta_angle); + } + + mMouseSteerX = x; + mMouseSteerY = y; +} diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index a8fe44ab3..f811c53c2 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -3,10 +3,9 @@ * @brief LLToolPie class header file * * $LicenseInfo:firstyear=2001&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2001-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -42,9 +41,11 @@ class LLObjectSelection; class LLToolPie : public LLTool, public LLSingleton { + LOG_CLASS(LLToolPie); public: LLToolPie( ); + // Virtual functions inherited from LLMouseHandler virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -58,36 +59,61 @@ public: virtual void stopEditing(); virtual void onMouseCaptureLost(); + virtual void handleSelect(); virtual void handleDeselect(); virtual LLTool* getOverrideTool(MASK mask); LLPickInfo& getPick() { return mPick; } +// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Added: RLVa-1.2.0a + LLPickInfo& getHoverPick() { return mHoverPick; } +// [/RLVa:KB] U8 getClickAction() { return mClickAction; } LLViewerObject* getClickActionObject() { return mClickActionObject; } LLObjectSelection* getLeftClickSelection() { return (LLObjectSelection*)mLeftClickSelection; } void resetSelection(); + void walkToClickedLocation(); + void blockClickToWalk() { mBlockClickToWalk = true; } + void stopClickToWalk(); - static void leftMouseCallback(const LLPickInfo& pick_info); - static void rightMouseCallback(const LLPickInfo& pick_info); - static void selectionPropertiesReceived(); private: - BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); - BOOL pickAndShowMenu(BOOL edit_menu); - BOOL useClickAction(BOOL always_show, MASK mask, LLViewerObject* object, - LLViewerObject* parent); + BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y); + BOOL handleLeftClickPick(); + BOOL handleRightClickPick(); + BOOL useClickAction (MASK mask, LLViewerObject* object,LLViewerObject* parent); + + void showVisualContextMenuEffect(); + ECursorType cursorFromObject(LLViewerObject* object); + + bool handleMediaClick(const LLPickInfo& info); + bool handleMediaHover(const LLPickInfo& info); + bool handleMediaMouseUp(); + + void steerCameraWithMouse(S32 x, S32 y); + void startCameraSteering(); + void stopCameraSteering(); + bool inCameraSteerMode(); private: - BOOL mPieMouseButtonDown; - BOOL mGrabMouseButtonDown; - BOOL mMouseOutsideSlop; // for this drag, has mouse moved outside slop region + bool mMouseButtonDown; + bool mMouseOutsideSlop; // for this drag, has mouse moved outside slop region + S32 mMouseDownX; + S32 mMouseDownY; + S32 mMouseSteerX; + S32 mMouseSteerY; + bool mClockwise; + bool mBlockClickToWalk; + LLUUID mMediaMouseCaptureID; LLPickInfo mPick; + LLPickInfo mHoverPick; + LLPickInfo mSteerPick; LLPointer mClickActionObject; U8 mClickAction; LLSafeHandle mLeftClickSelection; + const LLCachedControl mClickActionBuyEnabled; + const LLCachedControl mClickActionPayEnabled; }; - #endif diff --git a/indra/newview/llviewergesture.h b/indra/newview/llviewergesture.h index f5c4e578d..de7288ca0 100644 --- a/indra/newview/llviewergesture.h +++ b/indra/newview/llviewergesture.h @@ -33,7 +33,6 @@ #ifndef LL_LLVIEWERGESTURE_H #define LL_LLVIEWERGESTURE_H -#include "llanimationstates.h" #include "lluuid.h" #include "llstring.h" #include "lldarray.h" diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 0063c9073..eb3e35997 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -63,11 +63,140 @@ #include "llfloatercustomize.h" // #include "llappviewer.h" // System Folders +// // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} void no_op() {} -// + +///---------------------------------------------------------------------------- +/// Helper class to store special inventory item names and their localized values. +///---------------------------------------------------------------------------- +class LLLocalizedInventoryItemsDictionary : public LLSingleton +{ +public: + std::map mInventoryItemsDict; + + LLLocalizedInventoryItemsDictionary() + { + mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape"); + mInventoryItemsDict["New Skin"] = LLTrans::getString("New Skin"); + mInventoryItemsDict["New Hair"] = LLTrans::getString("New Hair"); + mInventoryItemsDict["New Eyes"] = LLTrans::getString("New Eyes"); + mInventoryItemsDict["New Shirt"] = LLTrans::getString("New Shirt"); + mInventoryItemsDict["New Pants"] = LLTrans::getString("New Pants"); + mInventoryItemsDict["New Shoes"] = LLTrans::getString("New Shoes"); + mInventoryItemsDict["New Socks"] = LLTrans::getString("New Socks"); + mInventoryItemsDict["New Jacket"] = LLTrans::getString("New Jacket"); + mInventoryItemsDict["New Gloves"] = LLTrans::getString("New Gloves"); + mInventoryItemsDict["New Undershirt"] = LLTrans::getString("New Undershirt"); + mInventoryItemsDict["New Underpants"] = LLTrans::getString("New Underpants"); + mInventoryItemsDict["New Skirt"] = LLTrans::getString("New Skirt"); + mInventoryItemsDict["New Alpha"] = LLTrans::getString("New Alpha"); + mInventoryItemsDict["New Tattoo"] = LLTrans::getString("New Tattoo"); + mInventoryItemsDict["New Physics"] = LLTrans::getString("New Physics"); + mInventoryItemsDict["Invalid Wearable"] = LLTrans::getString("Invalid Wearable"); + + mInventoryItemsDict["New Gesture"] = LLTrans::getString("New Gesture"); + mInventoryItemsDict["New Script"] = LLTrans::getString("New Script"); + mInventoryItemsDict["New Folder"] = LLTrans::getString("New Folder"); + mInventoryItemsDict["New Note"] = LLTrans::getString("New Note"); + mInventoryItemsDict["Contents"] = LLTrans::getString("Contents"); + + mInventoryItemsDict["Gesture"] = LLTrans::getString("Gesture"); + mInventoryItemsDict["Male Gestures"] = LLTrans::getString("Male Gestures"); + mInventoryItemsDict["Female Gestures"] = LLTrans::getString("Female Gestures"); + mInventoryItemsDict["Other Gestures"] = LLTrans::getString("Other Gestures"); + mInventoryItemsDict["Speech Gestures"] = LLTrans::getString("Speech Gestures"); + mInventoryItemsDict["Common Gestures"] = LLTrans::getString("Common Gestures"); + + //predefined gestures + + //male + mInventoryItemsDict["Male - Excuse me"] = LLTrans::getString("Male - Excuse me"); + mInventoryItemsDict["Male - Get lost"] = LLTrans::getString("Male - Get lost"); // double space after Male. EXT-8319 + mInventoryItemsDict["Male - Blow kiss"] = LLTrans::getString("Male - Blow kiss"); + mInventoryItemsDict["Male - Boo"] = LLTrans::getString("Male - Boo"); + mInventoryItemsDict["Male - Bored"] = LLTrans::getString("Male - Bored"); + mInventoryItemsDict["Male - Hey"] = LLTrans::getString("Male - Hey"); + mInventoryItemsDict["Male - Laugh"] = LLTrans::getString("Male - Laugh"); + mInventoryItemsDict["Male - Repulsed"] = LLTrans::getString("Male - Repulsed"); + mInventoryItemsDict["Male - Shrug"] = LLTrans::getString("Male - Shrug"); + mInventoryItemsDict["Male - Stick tougue out"] = LLTrans::getString("Male - Stick tougue out"); + mInventoryItemsDict["Male - Wow"] = LLTrans::getString("Male - Wow"); + + //female + mInventoryItemsDict["Female - Chuckle"] = LLTrans::getString("Female - Chuckle"); + mInventoryItemsDict["Female - Cry"] = LLTrans::getString("Female - Cry"); + mInventoryItemsDict["Female - Embarrassed"] = LLTrans::getString("Female - Embarrassed"); + mInventoryItemsDict["Female - Excuse me"] = LLTrans::getString("Female - Excuse me"); + mInventoryItemsDict["Female - Get lost"] = LLTrans::getString("Female - Get lost"); // double space after Female. EXT-8319 + mInventoryItemsDict["Female - Blow kiss"] = LLTrans::getString("Female - Blow kiss"); + mInventoryItemsDict["Female - Boo"] = LLTrans::getString("Female - Boo"); + mInventoryItemsDict["Female - Bored"] = LLTrans::getString("Female - Bored"); + mInventoryItemsDict["Female - Hey"] = LLTrans::getString("Female - Hey"); + mInventoryItemsDict["Female - Hey baby"] = LLTrans::getString("Female - Hey baby"); + mInventoryItemsDict["Female - Laugh"] = LLTrans::getString("Female - Laugh"); + mInventoryItemsDict["Female - Looking good"] = LLTrans::getString("Female - Looking good"); + mInventoryItemsDict["Female - Over here"] = LLTrans::getString("Female - Over here"); + mInventoryItemsDict["Female - Please"] = LLTrans::getString("Female - Please"); + mInventoryItemsDict["Female - Repulsed"] = LLTrans::getString("Female - Repulsed"); + mInventoryItemsDict["Female - Shrug"] = LLTrans::getString("Female - Shrug"); + mInventoryItemsDict["Female - Stick tougue out"]= LLTrans::getString("Female - Stick tougue out"); + mInventoryItemsDict["Female - Wow"] = LLTrans::getString("Female - Wow"); + + //common + mInventoryItemsDict["/bow"] = LLTrans::getString("/bow"); + mInventoryItemsDict["/clap"] = LLTrans::getString("/clap"); + mInventoryItemsDict["/count"] = LLTrans::getString("/count"); + mInventoryItemsDict["/extinguish"] = LLTrans::getString("/extinguish"); + mInventoryItemsDict["/kmb"] = LLTrans::getString("/kmb"); + mInventoryItemsDict["/muscle"] = LLTrans::getString("/muscle"); + mInventoryItemsDict["/no"] = LLTrans::getString("/no"); + mInventoryItemsDict["/no!"] = LLTrans::getString("/no!"); + mInventoryItemsDict["/paper"] = LLTrans::getString("/paper"); + mInventoryItemsDict["/pointme"] = LLTrans::getString("/pointme"); + mInventoryItemsDict["/pointyou"] = LLTrans::getString("/pointyou"); + mInventoryItemsDict["/rock"] = LLTrans::getString("/rock"); + mInventoryItemsDict["/scissor"] = LLTrans::getString("/scissor"); + mInventoryItemsDict["/smoke"] = LLTrans::getString("/smoke"); + mInventoryItemsDict["/stretch"] = LLTrans::getString("/stretch"); + mInventoryItemsDict["/whistle"] = LLTrans::getString("/whistle"); + mInventoryItemsDict["/yes"] = LLTrans::getString("/yes"); + mInventoryItemsDict["/yes!"] = LLTrans::getString("/yes!"); + mInventoryItemsDict["afk"] = LLTrans::getString("afk"); + mInventoryItemsDict["dance1"] = LLTrans::getString("dance1"); + mInventoryItemsDict["dance2"] = LLTrans::getString("dance2"); + mInventoryItemsDict["dance3"] = LLTrans::getString("dance3"); + mInventoryItemsDict["dance4"] = LLTrans::getString("dance4"); + mInventoryItemsDict["dance5"] = LLTrans::getString("dance5"); + mInventoryItemsDict["dance6"] = LLTrans::getString("dance6"); + mInventoryItemsDict["dance7"] = LLTrans::getString("dance7"); + mInventoryItemsDict["dance8"] = LLTrans::getString("dance8"); + } + + /** + * Finds passed name in dictionary and replaces it with found localized value. + * + * @param object_name - string to be localized. + * @return true if passed name was found and localized, false otherwise. + */ + bool localizeInventoryObjectName(std::string& object_name) + { + LL_DEBUGS("InventoryLocalize") << "Searching for localization: " << object_name << LL_ENDL; + + std::map::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name); + + bool found = dictionary_iter != mInventoryItemsDict.end(); + if(found) + { + object_name = dictionary_iter->second; + LL_DEBUGS("InventoryLocalize") << "Found, new name is: " << object_name << LL_ENDL; + } + return found; + } +}; + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -165,13 +294,10 @@ void LLViewerInventoryItem::cloneViewerItem(LLPointer& ne void LLViewerInventoryItem::removeFromServer() { // this check is ghetto - if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) - { - return; - } + if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return; // - llinfos << "Removing inventory item " << mUUID << " from server." - << llendl; + lldebugs << "Removing inventory item " << mUUID << " from server." + << llendl; LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); gInventory.accountForUpdate(up); @@ -189,22 +315,14 @@ void LLViewerInventoryItem::removeFromServer() void LLViewerInventoryItem::updateServer(BOOL is_new) const { // - //if(gAgent.getID() != mPermissions.getOwner()) - //{ - // // *FIX: deal with this better. - // llwarns << "LLViewerInventoryItem::updateServer() - for unowned item" - // << llendl; - if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) - { + if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return; // - return; - } if(!mIsComplete) { // *FIX: deal with this better. llwarns << "LLViewerInventoryItem::updateServer() - for incomplete item" << llendl; - LLNotificationsUtil::add("IncompleteInventoryItem"); + LLNotificationsUtil::add("IncompleteInventoryItem"); return; } if(gAgent.getID() != mPermissions.getOwner()) @@ -286,6 +404,9 @@ void LLViewerInventoryItem::fetchFromServer(void) const BOOL LLViewerInventoryItem::unpackMessage(LLSD item) { BOOL rv = LLInventoryItem::fromLLSD(item); + + LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); + mIsComplete = TRUE; return rv; } @@ -294,6 +415,9 @@ BOOL LLViewerInventoryItem::unpackMessage(LLSD item) BOOL LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) { BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num); + + LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); + mIsComplete = TRUE; return rv; } @@ -429,7 +553,7 @@ void LLViewerInventoryCategory::copyViewerCategory(const LLViewerInventoryCatego { copyCategory(other); mOwnerID = other->mOwnerID; - mVersion = other->mVersion; + setVersion(other->getVersion()); mDescendentCount = other->mDescendentCount; mDescendentsRequested = other->mDescendentsRequested; } @@ -505,7 +629,7 @@ bool LLViewerInventoryCategory::fetch() // if((mUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return false; // - if((VERSION_UNKNOWN == mVersion) && + if((VERSION_UNKNOWN == getVersion()) && (!mDescendentsRequested.getStarted() || mDescendentsRequested.hasExpired())) //Expired check prevents multiple downloads. { @@ -720,6 +844,12 @@ void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type) setPreferredType(new_folder_type); gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id); } + +void LLViewerInventoryCategory::localizeName() +{ + LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); +} + ///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- @@ -858,6 +988,25 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, U32 next_owner_perm, LLPointer cb) { + //check if name is equal to one of special inventory items names + //EXT-5839 + std::string server_name = name; + + { + std::map::const_iterator dictionary_iter; + + for (dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.begin(); + dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end(); + dictionary_iter++) + { + const std::string& localized_name = dictionary_iter->second; + if(localized_name == name) + { + server_name = dictionary_iter->first; + } + } + } + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_CreateInventoryItem); msg->nextBlock(_PREHASH_AgentData); @@ -871,7 +1020,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); msg->addU8Fast(_PREHASH_WearableType, (U8)wtype); - msg->addStringFast(_PREHASH_Name, name); + msg->addStringFast(_PREHASH_Name, server_name); msg->addStringFast(_PREHASH_Description, desc); gAgent.sendReliableMessage(); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 7c9e0652f..18c57f2a3 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -3,10 +3,9 @@ * @brief Declaration of the inventory bits that only used on the viewer. * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -211,7 +210,7 @@ public: // Returns true if a fetch was issued. bool fetch(); - // used to help make cacheing more robust - for example, if + // used to help make caching more robust - for example, if // someone is getting 4 packets but logs out after 3. the viewer // may never know the cache is wrong. enum { DESCENDENT_COUNT_UNKNOWN = -1 }; @@ -219,7 +218,7 @@ public: void setDescendentCount(S32 descendents) { mDescendentCount = descendents; } // file handling on the viewer. These are not meant for anything - // other than cacheing. + // other than caching. bool exportFileLocal(LLFILE* fp) const; bool importFileLocal(LLFILE* fp); void determineFolderType(); @@ -227,6 +226,7 @@ public: private: friend class LLInventoryModel; + void localizeName(); // intended to be called from the LLInventoryModel protected: LLUUID mOwnerID; @@ -327,6 +327,7 @@ extern LLInventoryCallbackManager gInventoryCallbacks; #define NOT_WEARABLE (LLWearableType::EType)0 +// *TODO: Find a home for these void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fdaf69036..b18c4b49c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3,10 +3,9 @@ * @brief Builds menus out of items. * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * * Second Life Viewer Source Code + * Copyright (c) 2002-2009, Linden Research, Inc. + * * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -34,43 +33,19 @@ #include "llviewermenu.h" -// system library includes -#include -#include -#include - // linden library includes -#include "llaudioengine.h" -#include "indra_constants.h" -#include "llassetstorage.h" - +#include "llanimationstates.h" // For ANIM_AGENT_AWAY +#include "llavatarnamecache.h" // IDEVO +#include "llinventorypanel.h" #include "llnotifications.h" #include "llnotificationsutil.h" -#include "llchat.h" #include "llfeaturemanager.h" -#include "llfocusmgr.h" -#include "llfontgl.h" -#include "llinstantmessage.h" -#include "llpermissionsflags.h" -#include "llrect.h" #include "llsecondlifeurls.h" -#include "lltransactiontypes.h" -#include "llui.h" -#include "llview.h" -#include "llxfermanager.h" -#include "message.h" -#include "raytrace.h" -#include "llsdserialize.h" -#include "llsdutil.h" // -#include "lllocalinventory.h" #include "llfloaterexploreanimations.h" #include "llfloaterexploresounds.h" #include "llfloaterblacklist.h" // -#include "lltimer.h" -#include "llvfile.h" -#include "llvolumemgr.h" #include "statemachine/aifilepicker.h" // newview includes @@ -81,25 +56,12 @@ #include "jcfloaterareasearch.h" #include "llagentpilot.h" -#include "llbox.h" -#include "llcallingcard.h" -#include "llclipboard.h" #include "llcompilequeue.h" #include "llconsole.h" -#include "llcontrol.h" -#include "llviewercontrol.h" #include "lldebugview.h" -#include "lldir.h" -#include "lldrawable.h" -#include "lldrawpoolalpha.h" -#include "lldrawpooltree.h" #include "llenvmanager.h" -#include "llface.h" #include "llfirstuse.h" -#include "llfloater.h" - #include "llfloaterabout.h" -#include "llfloaterbuycurrency.h" #include "llfloateractivespeakers.h" #include "llfloateranimpreview.h" #include "llfloateravatarinfo.h" @@ -112,7 +74,6 @@ #include "llfloaterbuycontents.h" #include "llfloaterbuycurrency.h" #include "llfloaterbuyland.h" -#include "llfloatercamera.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloaterdaycycle.h" @@ -123,13 +84,10 @@ #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" -#include "llfloatergroupinfo.h" #include "llfloatergroupinvite.h" #include "llfloatergroups.h" - #include "llfloaterhtmlcurrency.h" #include "llfloatermediabrowser.h" // gViewerHtmlHelp -#include "llfloaterhtmlsimple.h" #include "llfloaterhud.h" #include "llfloaterinspect.h" #include "llfloaterinventory.h" @@ -137,13 +95,11 @@ #include "llfloaterland.h" #include "llfloaterlandholdings.h" #include "llfloatermap.h" - #include "llfloatermute.h" #include "llfloateropenobject.h" #include "llfloateroutbox.h" #include "llfloaterpathfindingcharacters.h" #include "llfloaterpathfindinglinksets.h" -#include "llfloaterpermissionsmgr.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" @@ -156,7 +112,6 @@ #include "llfloaterenvsettings.h" #include "llfloaterstats.h" -#include "llfloaterteleport.h" #include "llfloaterteleporthistory.h" #include "llfloatertest.h" #include "llfloatertools.h" @@ -165,92 +120,55 @@ #include "llfloaterworldmap.h" #include "llfloatermemleak.h" #include "llframestats.h" -#include "llframestatview.h" -#include "llfasttimerview.h" #include "llgivemoney.h" #include "llgroupmgr.h" #include "llhoverview.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" -#include "llimage.h" -#include "llimagebmp.h" -#include "llimagej2c.h" -#include "llimagetga.h" +#include "llimview.h" +#include "llinventorybridge.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" -#include "llinventorypanel.h" -#include "llinventorybridge.h" -#include "llkeyboard.h" #include "llmakeoutfitdialog.h" -#include "llmenucommands.h" -#include "llmenugl.h" #include "llmimetypes.h" -#include "llmorphview.h" +#include "llmenucommands.h" #include "llmenuoptionpathfindingrebakenavmesh.h" #include "llmoveview.h" #include "llmutelist.h" #include "llnotify.h" #include "llpanellogin.h" -#include "llpanelobject.h" - #include "llparcel.h" - -#include "llpolymesh.h" -#include "llprimitive.h" -#include "llresmgr.h" #include "llselectmgr.h" -#include "llsky.h" #include "llstatusbar.h" -#include "llstatview.h" -#include "llstring.h" -#include "llsurfacepatch.h" -#include "llimview.h" #include "lltextureview.h" -#include "lltool.h" #include "lltoolbar.h" #include "lltoolcomp.h" -#include "lltoolfocus.h" -#include "lltoolgrab.h" #include "lltoolmgr.h" #include "lltoolpie.h" -#include "lltoolplacer.h" #include "lltoolselectland.h" #include "lluictrlfactory.h" -#include "lluploaddialog.h" #include "lluserauth.h" -#include "lluuid.h" #include "llvelocitybar.h" #include "llviewercamera.h" #include "llviewergenericmessage.h" -#include "llviewergesture.h" #include "llviewertexturelist.h" // gTextureList -#include "llviewerinventory.h" #include "llviewermenufile.h" // init_menu_file() #include "llviewermessage.h" #include "llviewernetwork.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" -#include "llviewerparceloverlay.h" -#include "llviewerregion.h" #include "llviewerstats.h" -#include "llviewerwindow.h" #include "llvoavatarself.h" -#include "llvolume.h" -#include "llweb.h" #include "llworld.h" #include "llworldmap.h" -#include "object_flags.h" #include "pipeline.h" -#include "llappviewer.h" -#include "roles_constants.h" #include "llviewerjoystick.h" +#include "llwaterparammanager.h" #include "llwlanimator.h" #include "llwlparammanager.h" -#include "llwaterparammanager.h" +#include "llfloatercamera.h" #include "llfloaternotificationsconsole.h" -#include "lltexlayer.h" - // #include "llfloatermessagelog.h" #include "shfloatermediaticker.h" @@ -259,16 +177,16 @@ #include "scriptcounter.h" #include "llfloaterdisplayname.h" -#include "llavatarnamecache.h" #include "floaterao.h" #include "slfloatermediafilter.h" #include "llviewerobjectbackup.h" #include "llagentui.h" +#include "lltoolgrab.h" #include "llpathfindingmanager.h" +#include #include "lltexturecache.h" #include "llvovolume.h" -#include #include "hippogridmanager.h" @@ -303,13 +221,13 @@ void handle_test_load_url(void*); // // Evil hackish imported globals -// + //extern BOOL gHideSelectedObjects; //extern BOOL gAllowSelectAvatar; +//extern BOOL gDebugAvatarRotation; extern BOOL gDebugClicks; extern BOOL gDebugWindowProc; extern BOOL gDebugTextEditorTips; -extern BOOL gDebugAvatarRotation; extern BOOL gShowOverlayTitle; extern BOOL gOcclusionCull; // @@ -347,7 +265,6 @@ LLPieMenu* gDetachPieMenu = NULL; LLPieMenu* gDetachScreenPieMenu = NULL; LLPieMenu* gDetachBodyPartPieMenus[8]; -LLMenuItemCallGL* gFakeAway = NULL; LLMenuItemCallGL* gAFKMenu = NULL; LLMenuItemCallGL* gBusyMenu = NULL; @@ -355,7 +272,6 @@ typedef LLMemberListener view_listener_t; // // Local prototypes -// // File Menu void handle_compress_image(void*); @@ -373,8 +289,6 @@ void handle_region_dump_settings(void*); void handle_region_dump_temp_asset_data(void*); void handle_region_clear_temp_asset_data(void*); - - // Object pie menu BOOL sitting_on_selection(); @@ -390,8 +304,6 @@ bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelect void handle_buy_object(LLSaleInfo sale_info); void handle_buy_contents(LLSaleInfo sale_info); -bool for_sale_selection(LLSelectNode* nodep); - // Land pie menu void near_sit_down_point(BOOL success, void *); @@ -404,8 +316,7 @@ void handle_talk_to(void *userdata); void handle_agent_stop_moving(void*); void print_packets_lost(void*); void drop_packet(void*); -void velocity_interpolate( void* data ); -void toggle_wind_audio(void); +void velocity_interpolate( void* ); void handle_rebake_textures(void*); BOOL check_admin_override(void*); void handle_admin_override_toggle(void*); @@ -418,6 +329,7 @@ void toggle_show_xui_names(void *); BOOL check_show_xui_names(void *); // Debug UI + void handle_web_search_demo(void*); void handle_web_browser_test(void*); void handle_buy_currency_test(void*); @@ -493,7 +405,6 @@ BOOL handle_check_pose(void* userdata) { void handle_force_ground_sit(void*); -void handle_phantom_avatar(void*); void handle_hide_typing_notification(void*); void handle_close_all_notifications(void*); void handle_open_message_log(void*); @@ -502,16 +413,11 @@ void handle_sounds_explorer(void*); void handle_blacklist(void*); // -BOOL is_inventory_visible( void* user_data ); void handle_reset_view(); -void disabled_duplicate(void*); void handle_duplicate_in_place(void*); -void handle_repeat_duplicate(void*); -void handle_export(void*); -// void handle_deed_object_to_group(void*); -// BOOL enable_deed_object_to_group(void*); + void handle_object_owner_self(void*); void handle_object_owner_permissive(void*); void handle_object_lock(void*); @@ -526,7 +432,6 @@ void handle_force_parcel_owner_to_me(void*); void handle_force_parcel_to_content(void*); void handle_claim_public_land(void*); -void handle_god_request_havok(void *); void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry void reload_personal_settings_overrides(void *); void reload_vertex_shader(void *); @@ -540,13 +445,6 @@ void force_error_infinite_loop(void *); void force_error_software_exception(void *); void force_error_driver_crash(void *); -void handle_stopall(void*); -//void handle_hinge(void*); -//void handle_ptop(void*); -//void handle_lptop(void*); -//void handle_wheel(void*); -//void handle_dehinge(void*); -BOOL enable_dehinge(void*); void handle_force_delete(void*); void print_object_info(void*); void print_agent_nvpairs(void*); @@ -585,7 +483,6 @@ void handle_test_male(void *); void handle_test_female(void *); void handle_toggle_pg(void*); void handle_dump_attachments(void *); -void handle_show_overlay_title(void*); void handle_dump_avatar_local_textures(void*); void handle_meshes_and_morphs(void*); void handle_mesh_save_llm(void* data); @@ -607,11 +504,9 @@ BOOL enable_selection_you_own_all(void*); BOOL enable_selection_you_own_one(void*); BOOL enable_save_into_inventory(void*); BOOL enable_save_into_task_inventory(void*); -BOOL enable_not_thirdperson(void*); -// BOOL enable_export_selected(void *); -BOOL enable_have_card(void*); -BOOL enable_detach(void*); -BOOL enable_region_owner(void*); + +BOOL enable_detach(const LLSD& = LLSD()); +BOOL is_god_customer_service(void*); void menu_toggle_attached_lights(void* user_data); void menu_toggle_attached_particles(void* user_data); @@ -673,6 +568,7 @@ void pre_init_menus() LLMenuItemGL::sHighlightForeground = gColors.getColor( "MenuItemHighlightFgColor" ); } + void initialize_menus(); //----------------------------------------------------------------------------- @@ -691,13 +587,13 @@ void set_underclothes_menu_options() { if (gMenuHolder && gAgent.isTeen()) { - gMenuHolder->getChild("Self Underpants", TRUE)->setVisible(FALSE); - gMenuHolder->getChild("Self Undershirt", TRUE)->setVisible(FALSE); + gMenuHolder->getChild("Self Underpants")->setVisible(FALSE); + gMenuHolder->getChild("Self Undershirt")->setVisible(FALSE); } if (gMenuBarView && gAgent.isTeen()) { - gMenuBarView->getChild("Menu Underpants", TRUE)->setVisible(FALSE); - gMenuBarView->getChild("Menu Undershirt", TRUE)->setVisible(FALSE); + gMenuBarView->getChild("Menu Underpants")->setVisible(FALSE); + gMenuBarView->getChild("Menu Undershirt")->setVisible(FALSE); } } @@ -817,7 +713,7 @@ void init_menus() menu->addSeparator(); menu->addChild(new LLMenuItemCallGL( "Fake Away Status", &handle_fake_away_status, NULL)); menu->addChild(new LLMenuItemCallGL( "Force Ground Sit", &handle_force_ground_sit, NULL)); - menu->addChild(new LLMenuItemCallGL( "Phantom Avatar", &handle_phantom_avatar, NULL, NULL, 'P', MASK_CONTROL | MASK_ALT)); + menu->addSeparator(); menu->addChild(new LLMenuItemCallGL( "Animation Override...", &handle_edit_ao, NULL)); @@ -836,8 +732,6 @@ void init_menus() menu->addChild(new LLMenuItemCheckGL( "Streaming Audio Display", &handle_ticker_toggle, &handle_ticker_enabled, &handle_singleton_check, NULL )); - - // // Add in the pose stand ------------------------------------------- /*LLMenuGL* sub = new LLMenuGL("Pose Stand..."); @@ -851,7 +745,7 @@ void init_menus() sub->addChild(new LLMenuItemCallGL( "Legs Half Arms Out", &handle_pose_stand_lhao, NULL)); sub->addChild(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL)); // ------------------------------------------------------*/ - + menu->addChild(new LLMenuItemCheckGL("Pose Stand",&handle_toggle_pose, NULL, &handle_check_pose, NULL)); //these should always be last in a sub menu @@ -880,7 +774,7 @@ void init_menus() show_debug_menus(); gLoginMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_login.xml", gMenuHolder); - + menu = new LLMenuGL(CLIENT_MENU_NAME); menu->setCanTearOff(FALSE); menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle, NULL, NULL)); @@ -895,7 +789,6 @@ void init_menus() /*gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop, gViewerWindow->getRootView()->getRect().getWidth() - menuBarRect.mLeft, menuBarRect.mBottom));*/ - gLoginMenuBarView->setBackgroundColor( color ); gMenuHolder->addChild(gLoginMenuBarView); @@ -1351,7 +1244,6 @@ void init_debug_xui_menu(LLMenuGL* menu) // menu->addChild(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); - //menu->addChild(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency)); menu->createJumpKeys(); } @@ -1545,7 +1437,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) (void*)LLPipeline::RENDER_DEBUG_WIND_VECTORS)); sub_menu->addChild(new LLMenuItemCheckGL("Complexity", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY)); ; + (void*)LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY)); sub_menu = new LLMenuGL("Render Tests"); sub_menu->setCanTearOff(TRUE); @@ -1650,7 +1542,7 @@ void init_debug_avatar_menu(LLMenuGL* menu) // HACK for easy testing of avatar geometry sub_menu->addChild(new LLMenuItemCallGL( "Toggle Character Geometry", - &handle_god_request_avatar_geometry, &enable_god_customer_service, NULL)); + &handle_god_request_avatar_geometry, &is_god_customer_service, NULL)); sub_menu->addChild(new LLMenuItemCallGL("Test Male", handle_test_male)); @@ -1697,14 +1589,10 @@ void init_debug_avatar_menu(LLMenuGL* menu) menu->addChild(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); menu->addChild(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); menu->addChild(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); -// -//#ifndef LL_RELEASE_FOR_DOWNLOAD -// +#ifndef LL_RELEASE_FOR_DOWNLOAD menu->addChild(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT)); menu->addChild(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT )); -// -//#endif -// +#endif gMeshesAndMorphsMenu = new LLMenuGL("Meshes and Morphs"); menu->addChild(gMeshesAndMorphsMenu); @@ -1771,7 +1659,7 @@ void init_server_menu(LLMenuGL* menu) menu->addChild(sub); sub->addChild(new LLMenuItemCallGL( "Take Copy", - &force_take_copy, &enable_god_customer_service, NULL, + &force_take_copy, &is_god_customer_service, NULL, 'O', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); #ifdef _CORY_TESTING sub->addChild(new LLMenuItemCallGL( "Export Copy", @@ -1784,17 +1672,17 @@ void init_server_menu(LLMenuGL* menu) //sub->addChild(new LLMenuItemCallGL( "Force Ownership/Permissive", // &handle_object_owner_self_and_permissive, NULL, NULL, 'K', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); sub->addChild(new LLMenuItemCallGL( "Force Owner To Me", - &handle_object_owner_self, &enable_god_customer_service)); + &handle_object_owner_self, &is_god_customer_service)); sub->addChild(new LLMenuItemCallGL( "Force Owner Permissive", - &handle_object_owner_permissive, &enable_god_customer_service)); + &handle_object_owner_permissive, &is_god_customer_service)); //sub->addChild(new LLMenuItemCallGL( "Force Totally Permissive", // &handle_object_permissive)); sub->addChild(new LLMenuItemCallGL( "Delete", - &handle_force_delete, &enable_god_customer_service, NULL, KEY_DELETE, MASK_SHIFT | MASK_ALT | MASK_CONTROL)); + &handle_force_delete, &is_god_customer_service, NULL, KEY_DELETE, MASK_SHIFT | MASK_ALT | MASK_CONTROL)); sub->addChild(new LLMenuItemCallGL( "Lock", - &handle_object_lock, &enable_god_customer_service, NULL, 'L', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); + &handle_object_lock, &is_god_customer_service, NULL, 'L', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); sub->addChild(new LLMenuItemCallGL( "Get Asset IDs", - &handle_object_asset_ids, &enable_god_customer_service, NULL, 'I', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); + &handle_object_asset_ids, &is_god_customer_service, NULL, 'I', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); sub->createJumpKeys(); } { @@ -1803,14 +1691,14 @@ void init_server_menu(LLMenuGL* menu) sub->addChild(new LLMenuItemCallGL("Owner To Me", &handle_force_parcel_owner_to_me, - &enable_god_customer_service, NULL)); + &is_god_customer_service, NULL)); sub->addChild(new LLMenuItemCallGL("Set to Linden Content", &handle_force_parcel_to_content, - &enable_god_customer_service, NULL, + &is_god_customer_service, NULL, 'C', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); sub->addSeparator(); sub->addChild(new LLMenuItemCallGL("Claim Public Land", - &handle_claim_public_land, &enable_god_customer_service)); + &handle_claim_public_land, &is_god_customer_service)); sub->createJumpKeys(); } @@ -1819,7 +1707,7 @@ void init_server_menu(LLMenuGL* menu) menu->addChild(sub); sub->addChild(new LLMenuItemCallGL("Dump Temp Asset Data", &handle_region_dump_temp_asset_data, - &enable_god_customer_service, NULL)); + &is_god_customer_service, NULL)); sub->createJumpKeys(); } menu->addChild(new LLMenuItemCallGL( "God Tools...", @@ -1834,14 +1722,8 @@ void init_server_menu(LLMenuGL* menu) menu->addSeparator(); menu->addChild(new LLMenuItemCallGL("Save Region State", - &LLPanelRegionTools::onSaveState, &enable_god_customer_service, NULL)); + &LLPanelRegionTools::onSaveState, &is_god_customer_service, NULL)); -// menu->addChild(new LLMenuItemCallGL("Force Join Group", handle_force_join_group)); -// -// menu->addSeparator(); -// -// menu->addChild(new LLMenuItemCallGL( "OverlayTitle", -// &handle_show_overlay_title, &enable_god_customer_service, NULL)); menu->createJumpKeys(); } @@ -1912,97 +1794,76 @@ class LLObjectTouch : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (!object) return true; - - LLPickInfo pick = LLToolPie::getInstance()->getPick(); - -// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l | OK - // NOTE: fallback code since we really shouldn't be getting an active selection if we can't touch this - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object, pick.mObjectOffset)) ) - { - RLV_ASSERT(false); - return true; - } -// [/RLVa:KB] - - 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, object->mLocalID); - msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero ); - msg->nextBlock("SurfaceInfo"); - msg->addVector3("UVCoord", LLVector3(pick.mUVCoords)); - msg->addVector3("STCoord", LLVector3(pick.mSTCoords)); - msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace); - msg->addVector3("Position", pick.mIntersection); - msg->addVector3("Normal", pick.mNormal); - msg->addVector3("Binormal", pick.mBinormal); - msg->sendMessage( object->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, object->mLocalID); - msg->nextBlock("SurfaceInfo"); - msg->addVector3("UVCoord", LLVector3(pick.mUVCoords)); - msg->addVector3("STCoord", LLVector3(pick.mSTCoords)); - msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace); - msg->addVector3("Position", pick.mIntersection); - msg->addVector3("Normal", pick.mNormal); - msg->addVector3("Binormal", pick.mBinormal); - msg->sendMessage(object->getRegion()->getHost()); - + handle_object_touch(); return true; } }; +void handle_object_touch() +{ + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (!object) return; + + LLPickInfo pick = LLToolPie::getInstance()->getPick(); + +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l + // NOTE: fallback code since we really shouldn't be getting an active selection if we can't touch this + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object, pick.mObjectOffset)) ) + { + RLV_ASSERT(false); + return; + } +// [/RLVa:KB] + + // *NOTE: Hope the packets arrive safely and in order or else + // there will be some problems. + // *TODO: Just fix this bad assumption. + send_ObjectGrab_message(object, pick, LLVector3::zero); + send_ObjectDeGrab_message(object, pick); +} + + +bool enable_object_touch(const LLSD& userdata) +{ + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + + bool new_value = obj && obj->flagHandleTouch(); +// [RLVa:KB] - Checked: 2010-11-12 (RLVa-1.2.1g) | Added: RLVa-1.2.1g + if ( (rlv_handler_t::isEnabled()) && (new_value) ) + { + // RELEASE-RLVa: [RLVa-1.2.1] Make sure this stays in sync with handle_object_touch() + new_value = gRlvHandler.canTouch(obj, LLToolPie::getInstance()->getPick().mObjectOffset); + } +// [/RLVa:KB] + + std::string touch_text; + + // Update label based on the node touch name if available. + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if (node && node->mValid && !node->mTouchName.empty()) + { + touch_text = node->mTouchName; + } + else + { + touch_text = userdata["data"].asString(); + } + + gMenuHolder->childSetText("Object Touch", touch_text); + gMenuHolder->childSetText("Attachment Object Touch", touch_text); + return new_value; +}; // One object must have touch sensor class LLObjectEnableTouch : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - bool new_value = obj && obj->flagHandleTouch(); -// [RLVa:KB] - Version: 1.23.4 | Checked: 2010-01-01 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l - if ( (new_value) && (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(obj, LLToolPie::getInstance()->getPick().mObjectOffset)) ) - { - new_value = false; - } -// [/RLVa:KB] - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - - // Update label based on the node touch name if available. - LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); - - std::string touch_text; - if (node && node->mValid && !node->mTouchName.empty()) - { - touch_text = node->mTouchName; - } - else - { - touch_text = userdata["data"].asString(); - } - - gMenuHolder->childSetText("Object Touch", touch_text); - gMenuHolder->childSetText("Attachment Object Touch", touch_text); - + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_object_touch(userdata)); return true; } }; - //void label_touch(std::string& label, void*) //{ // LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); @@ -2016,56 +1877,47 @@ class LLObjectEnableTouch : public view_listener_t // } //} -bool handle_object_open() +void handle_object_open() { - LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if(!obj) return true; - - LLFloaterOpenObject::show(); - return true; +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Added: RLVa-1.2.0e + if (enable_object_open()) + LLFloaterOpenObject::show(); +// [/RLVa:KB] +// LLFloaterOpenObject::show(); } class LLObjectOpen : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4b) | Modified: RLVa-1.1.4b - // TODO-RLVa: shouldn't we be checking for fartouch here as well? - const LLViewerObject* pObj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canEdit(pObj)) ) - { - return true; - } -// [/RLVa:KB] - - return handle_object_open(); + handle_object_open(); + return true; } }; +bool enable_object_open() +{ + // Look for contents in root object, which is all the LLFloaterOpenObject + // understands. + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (!obj) return false; + + LLViewerObject* root = obj->getRootEdit(); + if (!root) return false; + + return root->allowOpen(); +} + class LLObjectEnableOpen : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - // Look for contents in root object, which is all the LLFloaterOpenObject - // understands. - LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - bool new_value = (obj != NULL); - if (new_value) - { - LLViewerObject* root = obj->getRootEdit(); - if (!root) new_value = false; - else new_value = root->allowOpen(); - } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_object_open()); return true; } }; - - - - class LLViewJoystickFlycam : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -2079,8 +1931,8 @@ class LLViewCheckJoystickFlycam : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_val = LLViewerJoystick::getInstance()->getOverrideCamera(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_val); + bool new_value = LLViewerJoystick::getInstance()->getOverrideCamera(); + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } }; @@ -2136,73 +1988,99 @@ class LLObjectBuild : public view_listener_t } }; + +void handle_object_edit() +{ + LLViewerParcelMgr::getInstance()->deselectLand(); + +// Singu TODO: Find out if this RLVa patch is still needed, it has been removed from upstream. +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + if (rlv_handler_t::isEnabled()) + { + bool fRlvCanEdit = (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ)); + if (!fRlvCanEdit) + { + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsEditable f; + if ((hSel.notNull()) && ((hSel->getFirstRootNode(&f, TRUE)) != NULL)) + return; // Can't edit any object under @edit=n + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && + (SELECT_TYPE_WORLD == LLSelectMgr::getInstance()->getSelection()->getSelectType()) && + (dist_vec_squared(gAgent.getPositionAgent(), LLToolPie::getInstance()->getPick().mIntersection) > 1.5f * 1.5f) ) + { + // TODO-RLVa: this code is rather redundant since we'll never get an active selection to show a pie menu for + return; // Can't edit in-world objects farther than 1.5m away under @fartouch=n + } + } +// [/RLVa:KB] + + if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) + { + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + + if (selection->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement")) + { + // always freeze camera in space, even if camera doesn't move + // so, for example, follow cam scripts can't affect you when in build mode + gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + } + else + { + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + LLViewerObject* selected_objectp = selection->getFirstRootObject(); + if (selected_objectp) + { + // zoom in on object center instead of where we clicked, as we need to see the manipulator handles + gAgentCamera.setFocusGlobal(selected_objectp->getPositionGlobal(), selected_objectp->getID()); + gAgentCamera.cameraZoomIn(0.666f); + gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); + gViewerWindow->moveCursorToCenter(); + } + } + } + + gFloaterTools->open(); + + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); + + LLViewerJoystick::getInstance()->moveObjects(true); + LLViewerJoystick::getInstance()->setNeedsReset(true); + + // Could be first use + LLFirstUse::useBuild(); + return; +} + class LLObjectEdit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerParcelMgr::getInstance()->deselectLand(); - -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f - if (rlv_handler_t::isEnabled()) - { - bool fRlvCanEdit = (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ)); - if (!fRlvCanEdit) - { - LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsEditable f; - if ((hSel.notNull()) && ((hSel->getFirstRootNode(&f, TRUE)) != NULL)) - return true; // Can't edit any object under @edit=n - } - else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && - (SELECT_TYPE_WORLD == LLSelectMgr::getInstance()->getSelection()->getSelectType()) && - (dist_vec_squared(gAgent.getPositionAgent(), LLToolPie::getInstance()->getPick().mIntersection) > 1.5f * 1.5f) ) - { - // TODO-RLVa: this code is rather redundant since we'll never get an active selection to show a pie menu for - return true; // Can't edit in-world objects farther than 1.5m away under @fartouch=n - } - } -// [/RLVa:KB] - - if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) - { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if (selection->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement")) - { - // always freeze camera in space, even if camera doesn't move - // so, for example, follow cam scripts can't affect you when in build mode - gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - } - else - { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - LLViewerObject* selected_objectp = selection->getFirstRootObject(); - if (selected_objectp) - { - // zoom in on object center instead of where we clicked, as we need to see the manipulator handles - gAgentCamera.setFocusGlobal(selected_objectp->getPositionGlobal(), selected_objectp->getID()); - gAgentCamera.cameraZoomIn(0.666f); - gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); - gViewerWindow->moveCursorToCenter(); - } - } - } - - gFloaterTools->open(); /* Flawfinder: ignore */ - - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); - - LLViewerJoystick::getInstance()->moveObjects(true); - LLViewerJoystick::getInstance()->setNeedsReset(true); - - // Could be first use - LLFirstUse::useBuild(); + handle_object_edit(); return true; } }; +// [SL:KB] - Patch: Inventory-AttachmentEdit - Checked: 2010-08-25 (Catznip-2.2.0a) | Added: Catznip-2.1.2a +void handle_attachment_edit(const LLUUID& idItem) +{ + const LLInventoryItem* pItem = gInventory.getItem(idItem); + if ( (!isAgentAvatarValid()) || (!pItem) ) + return; + + LLViewerObject* pAttachObj = gAgentAvatarp->getWornAttachment(pItem->getLinkedUUID()); + if (!pAttachObj) + return; + + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->selectObjectAndFamily(pAttachObj); + + handle_object_edit(); +} +// [/SL:KB] + class LLObjectInspect : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -2215,8 +2093,8 @@ class LLObjectInspect : public view_listener_t // Derenderizer. Originally by Phox. class LLObjectDerender : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) - { + bool handleEvent(LLPointer event, const LLSD& userdata) + { LLViewerObject* slct = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if(!slct)return true; @@ -2224,18 +2102,17 @@ class LLObjectDerender : public view_listener_t LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); LLUUID root_key; //delivers null in linked parts if used as getFirstRootNode() - LLSelectNode* node = selection->getFirstRootNode(NULL,TRUE); - + LLSelectNode* node = selection->getFirstRootNode(NULL,TRUE); + /*this works for derendering entire object if child is selected - - LLSelectNode* node = selection->getFirstNode(); + + LLSelectNode* node = selection->getFirstNode(); //Delivers node even when linked parts, but only first node - + LLViewerObject* obj = node->getObject(); LLViewerObject* parent = (LLViewerObject*)obj->getParent();*/ - - - if(node) + + if(node) { root_key = node->getObject()->getID(); llinfos << "Derender node has key " << root_key << llendl; @@ -2244,21 +2121,23 @@ class LLObjectDerender : public view_listener_t { llinfos << "Derender node is null " << llendl; } - + LLViewerRegion* cur_region = gAgent.getRegion(); std::string entry_name; - if(slct->isAvatar()){ + if (slct->isAvatar()) + { LLNameValue* firstname = slct->getNVPair("FirstName"); LLNameValue* lastname = slct->getNVPair("LastName"); entry_name = llformat("Derendered: (AV) %s %s",firstname->getString(),lastname->getString()); } - else{ - if(root_key.isNull()) + else + { + if (root_key.isNull()) { return true; } id = root_key; - if(!node->mName.empty()) + if (!node->mName.empty()) { if(cur_region) entry_name = llformat("Derendered: %s in region %s",node->mName.c_str(),cur_region->getName().c_str()); @@ -2268,25 +2147,21 @@ class LLObjectDerender : public view_listener_t else { if(cur_region) - entry_name = llformat("Derendered: (unkown object) in region %s",cur_region->getName().c_str()); + entry_name = llformat("Derendered: (unknown object) in region %s",cur_region->getName().c_str()); else - entry_name = "Derendered: (unkown object)"; + entry_name = "Derendered: (unknown object)"; } } - - - - LLSD indata; - indata["entry_type"] = 6; //AT_TEXTURE - indata["entry_name"] = entry_name; - indata["entry_agent"] = gAgent.getID(); - - // ...don't kill the avatar - if (!(id == gAgentID)) + if (id != gAgentID) { + LLSD indata; + indata["entry_type"] = 6; //AT_TEXTURE + indata["entry_name"] = entry_name; + indata["entry_agent"] = gAgentID; + LLFloaterBlacklist::addEntry(id,indata); LLSelectMgr::getInstance()->deselectAll(); LLViewerObject *objectp = gObjectList.findObject(id); @@ -2364,7 +2239,7 @@ class LLAvatarReloadTextures : public view_listener_t } } } - else + else { texture_list.addTexture(avatar->getTEImage((ETextureIndex)i)); } @@ -2489,42 +2364,82 @@ BOOL enable_object_build(void*) return can_build; } +bool enable_object_edit() +{ + // *HACK: The new "prelude" Help Islands have a build sandbox area, + // so users need the Edit and Create pie menu options when they are + // there. Eventually this needs to be replaced with code that only + // lets you edit objects if you have permission to do so (edit perms, + // group edit, god). See also lltoolbar.cpp. JC + bool enable = false; + if (gAgent.inPrelude()) + { + enable = LLViewerParcelMgr::getInstance()->allowAgentBuild() + || LLSelectMgr::getInstance()->getSelection()->isAttachment(); + } + else if (LLSelectMgr::getInstance()->selectGetAllValidAndObjectsFound()) + { +// enable = true; +// [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c + bool fRlvCanEdit = (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ)); + if (!fRlvCanEdit) + { + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsEditable f; + fRlvCanEdit = (hSel.notNull()) && ((hSel->getFirstRootNode(&f, TRUE)) == NULL); + } + enable = fRlvCanEdit; +// [/RLVa:KB] + } + + return enable; +} + class LLEnableEdit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - // *HACK: The new "prelude" Help Islands have a build sandbox area, - // so users need the Edit and Create pie menu options when they are - // there. Eventually this needs to be replaced with code that only - // lets you edit objects if you have permission to do so (edit perms, - // group edit, god). See also lltoolbar.cpp. JC - bool enable = true; - if (gAgent.inPrelude()) - { - enable = LLViewerParcelMgr::getInstance()->allowAgentBuild() - || LLSelectMgr::getInstance()->getSelection()->isAttachment(); - } -// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) - // TODO-RLV: include fartouch here? - if ( (rlv_handler_t::isEnabled()) && (enable) ) - { - // We have no way of knowing whether we're being called for "Create" or for "Edit", but we can - // make an educated guess based on the currently active selection which puts us halfway there. - BOOL fActiveSelection = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) ) - enable = false; // Edit and rez restricted, disable them both - else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (fActiveSelection) ) - enable = false; // Edit restricted and there's an active selection => disable Edit and Create - else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && (!fActiveSelection) ) - enable = false; // Rez restricted and there's no active selection => disable Create - } -// [/RLVa:KB] - gMenuHolder->findControl(userdata["control"].asString())->setValue(enable); + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_object_edit()); return true; } }; + +bool enable_object_select_in_pathfinding_linksets() +{ + return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets(); +} + +class LLObjectEnablePFLinksetsSelected : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + return enable_object_select_in_pathfinding_linksets(); + } +}; + +class LLObjectPFCharactersSelected : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects(); + return true; + } +}; + +bool enable_object_select_in_pathfinding_characters() +{ + return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters(); +} + +class LLObjectEnablePFCharactersSelected : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + return enable_object_select_in_pathfinding_characters(); + } +}; + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -2541,13 +2456,13 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t bool new_value = false; if (isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; // if (attachment->getNumObjects() > 0) -// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a | OK +// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a if ( (attachment->getNumObjects() > 0) && ((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(attachment))) ) // [/RLVa:KB] { @@ -2577,9 +2492,6 @@ BOOL enable_has_attachments(void*) return FALSE; } -//--------------------------------------------------------------------------- -// Avatar pie menu -//--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Avatar pie menu //--------------------------------------------------------------------------- @@ -2593,28 +2505,36 @@ BOOL enable_has_attachments(void*) // } //} +bool enable_object_mute() +{ + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (!object) return false; + + LLVOAvatar* avatar = find_avatar_from_object(object); + if (avatar) + { + // It's an avatar + bool is_linden = + LLMuteList::getInstance()->isLinden(avatar->getID()); + bool is_self = avatar->isSelf(); +// return !is_linden && !is_self; +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + return !is_linden && !is_self && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); +// [/RLVa:KB] + } + else + { + // Just a regular object + return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) && + !LLMuteList::getInstance()->isMuted(object->getID()); + } +} + class LLObjectEnableMute : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - bool new_value = (object != NULL); - if (new_value) - { - LLVOAvatar* avatar = find_avatar_from_object(object); - if (avatar) - { - // It's an avatar - LLNameValue *lastname = avatar->getNVPair("LastName"); - BOOL is_linden = lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden"); - BOOL is_self = avatar->isSelf(); - new_value = !is_linden && !is_self; -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | OK - new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); -// [/RLVa:KB] - } - } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_object_mute()); return true; } }; @@ -2632,11 +2552,9 @@ class LLObjectMute : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) { -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e | OK +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.0.0e if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return true; // Fallback code [see LLObjectEnableMute::handleEvent()] - } + return true; // [/RLVa:KB] id = avatar->getID(); @@ -2840,7 +2758,7 @@ class LLKillEmAll : public view_listener_t */ LLSelectMgr::getInstance()->selectionUpdateTemporary(1);//set temp to TRUE LLVector3 pos = objpos->getPosition();//get the x and the y - pos.mV[VZ] = 340282346638528859811704183484516925440.0f;//create the z + pos.mV[VZ] = FLT_MAX;//create the z objpos->setPositionParent(pos);//set the x y z LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION);//send the data } @@ -2870,20 +2788,20 @@ class LLObjectMeasure : public view_listener_t startMeasurePoint = position; startpoint_set = true; - chat.mText = llformat("Start point set"); - LLFloaterChat::addChat(chat); + chat.mText = LLTrans::getString("StartPointSet"); } else { - chat.mText = llformat("End point set"); + chat.mText = LLTrans::getString("EndPointSet"); LLFloaterChat::addChat(chat); - F32 fdist = dist_vec(startMeasurePoint, position); + LLStringUtil::format_map_t args; + args["[DIST]"] = boost::lexical_cast(dist_vec(startMeasurePoint, position)); - chat.mText = llformat("Distance: %fm", fdist); - LLFloaterChat::addChat(chat); + chat.mText = LLTrans::getString("MeasuredDistance", args); startpoint_set = false; } + LLFloaterChat::addChat(chat); return true; } }; @@ -2897,41 +2815,6 @@ class LLObjectPFLinksetsSelected : public view_listener_t } }; -bool enable_object_select_in_pathfinding_linksets() -{ - return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets(); -} - -class LLObjectEnablePFLinksetsSelected : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - return enable_object_select_in_pathfinding_linksets(); - } -}; - -class LLObjectPFCharactersSelected : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects(); - return true; - } -}; - -bool enable_object_select_in_pathfinding_characters() -{ - return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters(); -} - -class LLObjectEnablePFCharactersSelected : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - return enable_object_select_in_pathfinding_characters(); - } -}; - class LLAvatarAnims : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -2949,15 +2832,6 @@ class LLAvatarAnims : public view_listener_t bool handle_go_to() { -// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a -/* - if ( (rlv_handler_t::isEnabled()) && (gAgent.forwardGrabbed()) && (gRlvHandler.hasLockedAttachment(RLV_LOCK_REMOVE)) ) - { - return true; - } -*/ -// [/RLVa:KB] - // try simulator autopilot std::vector strings; std::string val; @@ -2995,6 +2869,19 @@ class LLGoToObject : public view_listener_t } }; +class LLAvatarReportAbuse : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); + if(avatar) + { + LLFloaterReporter::showFromObject(avatar->getID()); + } + return true; + } +}; + //--------------------------------------------------------------------------- // Object backup //--------------------------------------------------------------------------- @@ -3003,8 +2890,7 @@ class LLObjectEnableExport : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - bool new_value = (object != NULL); + bool new_value = !!LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (new_value) { struct ff : public LLSelectedNodeFunctor @@ -3038,11 +2924,7 @@ class LLObjectExport : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (object) - { - LLObjectBackup::getInstance()->exportObject(); - } + LLObjectBackup::getInstance()->exportObject(); return true; } }; @@ -3084,11 +2966,11 @@ bool callback_freeze(const LLSD& notification, const LLSD& response) if (0 == option || 1 == option) { - U32 flags = 0x0; + U32 flags = KICK_FLAGS_FREEZE; if (1 == option) { // unfreeze - flags |= 0x1; + flags |= KICK_FLAGS_UNFREEZE; } LLMessageSystem* msg = gMessageSystem; @@ -3109,6 +2991,58 @@ bool callback_freeze(const LLSD& notification, const LLSD& response) return false; } + +void handle_avatar_freeze(const LLSD& avatar_id) +{ + // Use avatar_id if available, otherwise default to right-click avatar + LLVOAvatar* avatar = NULL; + if (avatar_id.asUUID().notNull()) + { + avatar = find_avatar_from_object(avatar_id.asUUID()); + } + else + { + avatar = find_avatar_from_object( + LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); + } + + if( avatar ) + { + std::string fullname = avatar->getFullname(); + LLSD payload; + payload["avatar_id"] = avatar->getID(); + + if (!fullname.empty()) + { + LLSD args; +// args["AVATAR_NAME"] = fullname; +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e + args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); +// [/RLVa:KB] + LLNotificationsUtil::add("FreezeAvatarFullname", + args, + payload, + callback_freeze); + } + else + { + LLNotificationsUtil::add("FreezeAvatar", + LLSD(), + payload, + callback_freeze); + } + } +} + +class LLAvatarFreeze : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + handle_avatar_freeze(LLUUID::null); + return true; + } +}; + class LLScriptCount : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -3164,61 +3098,11 @@ class LLObjectEnableScriptDelete : public view_listener_t } }; -class LLAvatarFreeze : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if( avatar ) - { - std::string fullname = avatar->getFullname(); - LLSD payload; - payload["avatar_id"] = avatar->getID(); - - if (!fullname.empty()) - { - LLSD args; -// args["AVATAR_NAME"] = fullname; -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e | OK - args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); -// [/RLVa:KB] - LLNotificationsUtil::add("FreezeAvatarFullname", - args, - payload, - callback_freeze); - } - else - { - LLNotificationsUtil::add("FreezeAvatar", - LLSD(), - payload, - callback_freeze); - } - } - return true; - } -}; - class LLAvatarVisibleDebug : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - //bool new_value = gAgent.isGodlike(); -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - // TODO-RLVa: can you actually use this to cheat anything? - bool new_value = gAgent.isGodlike() && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); -// [/RLVa:KB] - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - -class LLAvatarEnableDebug : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - //bool new_value = gAgent.isGodlike(); - //gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + gMenuHolder->findControl(userdata["control"].asString())->setValue(gAgent.isGodlike()); return true; } }; @@ -3227,19 +3111,9 @@ class LLAvatarDebug : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - //LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if (isAgentAvatarValid()) { gAgentAvatarp->dumpLocalTextures(); - // hell no don't tell them about that - /* - llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl; - std::vector strings; - strings.push_back(avatar->getID().asString()); - LLUUID invoice; - send_generic_message("dumptempassetdata", strings, invoice); - */ - // LLFloaterAvatarTextures::show( gAgentAvatarp->getID() ); } return true; @@ -3300,11 +3174,20 @@ bool callback_eject(const LLSD& notification, const LLSD& response) return false; } -class LLAvatarEject : public view_listener_t +void handle_avatar_eject(const LLSD& avatar_id) { - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); + // Use avatar_id if available, otherwise default to right-click avatar + LLVOAvatar* avatar = NULL; + if (avatar_id.asUUID().notNull()) + { + avatar = find_avatar_from_object(avatar_id.asUUID()); + } + else + { + avatar = find_avatar_from_object( + LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); + } + if( avatar ) { LLSD payload; @@ -3321,7 +3204,7 @@ class LLAvatarEject : public view_listener_t { LLSD args; // args["AVATAR_NAME"] = fullname; -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e | OK +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); // [/RLVa:KB] LLNotificationsUtil::add("EjectAvatarFullname", @@ -3344,7 +3227,7 @@ class LLAvatarEject : public view_listener_t { LLSD args; // args["AVATAR_NAME"] = fullname; -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e | OK +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); // [/RLVa:KB] LLNotificationsUtil::add("EjectAvatarFullnameNoBan", @@ -3361,6 +3244,13 @@ class LLAvatarEject : public view_listener_t } } } +} + +class LLAvatarEject : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + handle_avatar_eject(LLUUID::null); return true; } }; @@ -3393,32 +3283,45 @@ class LLAvatarClientUUID : public view_listener_t } }; +bool enable_freeze_eject(const LLSD& avatar_id) +{ + // Use avatar_id if available, otherwise default to right-click avatar + LLVOAvatar* avatar = NULL; + if (avatar_id.asUUID().notNull()) + { + avatar = find_avatar_from_object(avatar_id.asUUID()); + } + else + { + avatar = find_avatar_from_object( + LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); + } + if (!avatar) return false; + + // Gods can always freeze + if (gAgent.isGodlike()) return true; + + // Estate owners / managers can freeze + // Parcel owners can also freeze + const LLVector3& pos = avatar->getPositionRegion(); + const LLVector3d& pos_global = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); + LLViewerRegion* region = avatar->getRegion(); + if (!region) return false; + + bool new_value = region->isOwnedSelf(pos); + if (!new_value || region->isOwnedGroup(pos)) + { + new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN); + } + return new_value; +} + class LLAvatarEnableFreezeEject : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - bool new_value = (avatar != NULL); - - if (new_value) - { - const LLVector3& pos = avatar->getPositionRegion(); - const LLVector3d& pos_global = avatar->getPositionGlobal(); - LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); - LLViewerRegion* region = avatar->getRegion(); - new_value = (region != NULL); - - if (new_value) - { - new_value = region->isOwnedSelf(pos); - if (!new_value || region->isOwnedGroup(pos)) - { - new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN); - } - } - } - - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_freeze_eject(LLUUID::null)); return true; } }; @@ -3476,7 +3379,6 @@ class LLAvatarGiveCard : public view_listener_t }; - void login_done(S32 which, void *user) { llinfos << "Login done " << which << llendl; @@ -3528,7 +3430,7 @@ void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm bool enable_buy_object() { // In order to buy, there must only be 1 purchaseable object in - // the selection manger. + // the selection manager. if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return false; LLViewerObject* obj = NULL; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); @@ -3589,10 +3491,10 @@ void handle_buy_object(LLSaleInfo sale_info) } S32 price = sale_info.getSalePrice(); - + if (price > 0 && price > gStatusBar->getBalance()) { - LLFloaterBuyCurrency::buyCurrency("This object costs", price); + LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs"), price); return; } @@ -3644,11 +3546,7 @@ void handle_show_notifications_console(void *) void handle_dump_group_info(void *) { - llinfos << "group " << gAgent.getGroupName() << llendl; - llinfos << "ID " << gAgent.getGroupID() << llendl; - llinfos << "powers " << gAgent.mGroupPowers << llendl; - llinfos << "title " << gAgent.getGroupTitle() << llendl; - //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl; + gAgent.dumpGroupInfo(); } void handle_dump_capabilities_info(void *) @@ -3682,20 +3580,11 @@ class LLSelfSitOrStand : public view_listener_t { if (gAgentAvatarp && gAgentAvatarp->isSitting()) { -// [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK - if (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) - return true; -// [/RLVa:KB] - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + gAgent.standUp(); } else { -// [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK - if (gRlvHandler.hasBehaviour(RLV_BHVR_SIT)) - return true; -// [/RLVa:KB] - - gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + gAgent.sitDown(); // Might be first sit LLFirstUse::useSit(); @@ -3704,13 +3593,26 @@ class LLSelfSitOrStand : public view_listener_t } }; +bool enable_standup_self() +{ +// [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-1.0.0g + return isAgentAvatarValid() && gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); +// [/RLVa:KB] +// return isAgentAvatarValid() && gAgentAvatarp->isSitting(); +} + +bool enable_sitdown_self() +{ +// [RLVa:KB] - Checked: 2010-08-28 (RLVa-1.2.1a) | Added: RLVa-1.2.1a + return isAgentAvatarValid() && !gAgentAvatarp->isSitting() /*&& !gAgent.getFlying()*/ && !gRlvHandler.hasBehaviour(RLV_BHVR_SIT); +// [/RLVa:KB] +// return isAgentAvatarValid() && !gAgentAvatarp->isSitting() && !gAgent.getFlying(); +} + class LLSelfEnableSitOrStand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gAgentAvatarp && !gAgent.getFlying(); -// gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - std::string label; std::string sit_text; std::string stand_text; @@ -3721,27 +3623,18 @@ class LLSelfEnableSitOrStand : public view_listener_t sit_text = param.substr(0, offset); stand_text = param.substr(offset+1); } - - if (gAgentAvatarp && gAgentAvatarp->isSitting()) - { -// [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK - new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)); -// [/RLVa:KB] + + bool new_value = true; + if (enable_standup_self()) label = stand_text; - } - else - { -// [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK - new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SIT)); -// [/RLVa:KB] + else if (enable_sitdown_self()) label = sit_text; - } - -// [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK + else + new_value = false; + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); -// [/RLVa:KB] - gMenuHolder->childSetText("Self Sit", label); - gMenuHolder->childSetText("Self Sit Attachment", label); + gMenuHolder->childSetText("Stand Up", label); + gMenuHolder->childSetText("Stand Up Self", label); return true; } @@ -3781,7 +3674,7 @@ void set_god_level(U8 god_level) LLFloaterDirectory::requestClassifieds(); // God mode changes region visibility - LLWorldMap::getInstance()->reset(); + LLWorldMap::getInstance()->reloadItems(true); // inventory in items may change in god mode gObjectList.dirtyAllObjectInventory(); @@ -3804,7 +3697,6 @@ void set_god_level(U8 god_level) LLNotificationsUtil::add("LeavingGodMode", args); } - // changing god-level can affect which menus we see show_debug_menus(); } @@ -3880,54 +3772,26 @@ void handle_area_search(void*) void handle_fake_away_status(void*) { - if (!gSavedSettings.controlExists("FakeAway")) gSavedSettings.declareBOOL("FakeAway", FALSE, "", NO_PERSIST); - - if (gSavedSettings.getBOOL("FakeAway") == TRUE) - { - gSavedSettings.declareBOOL("FakeAway", FALSE, "", NO_PERSIST); - gSavedSettings.setBOOL("FakeAway", FALSE); - gAgent.sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP); - } - else - { - gSavedSettings.declareBOOL("FakeAway", TRUE, "", NO_PERSIST); - gSavedSettings.setBOOL("FakeAway", TRUE); - gAgent.sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START); - } + bool fake_away = gSavedSettings.getBOOL("FakeAway"); + gAgent.sendAnimationRequest(ANIM_AGENT_AWAY, fake_away ? ANIM_REQUEST_STOP : ANIM_REQUEST_START); + gSavedSettings.setBOOL("FakeAway", !fake_away); } void handle_force_ground_sit(void*) { - if (gAgentAvatarp) + if (isAgentAvatarValid()) { - if(!gAgentAvatarp->isSitting()) + if (!gAgentAvatarp->isSitting()) { gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } - else + else { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); } } } -void handle_phantom_avatar(void*) -{ - BOOL ph = LLAgent::getPhantom(); - - if (ph) - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - else - gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); - - LLAgent::togglePhantom(); - ph = LLAgent::getPhantom(); - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - chat.mText = llformat("%s%s","Phantom ",(ph ? "On" : "Off")); - LLFloaterChat::addChat(chat); -} - // /* @@ -3972,31 +3836,14 @@ BOOL is_agent_friend(const LLUUID& agent_id) BOOL is_agent_mappable(const LLUUID& agent_id) { - return (is_agent_friend(agent_id) && - LLAvatarTracker::instance().getBuddyInfo(agent_id)->isOnline() && - LLAvatarTracker::instance().getBuddyInfo(agent_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) + const LLRelationship* buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id); + + return (buddy_info && + buddy_info->isOnline() && + buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) ); } -// Enable a menu item when you have someone's card. -/* -BOOL enable_have_card(void *userdata) -{ - LLUUID* avatar_id = (LLUUID *)userdata; - if (gAgent.isGodlike()) - { - return TRUE; - } - else if(avatar_id) - { - return is_agent_friend(*avatar_id); - } - else - { - return FALSE; - } -} -*/ // Enable a menu item when you don't have someone's card. class LLAvatarEnableAddFriend : public view_listener_t @@ -4004,12 +3851,10 @@ class LLAvatarEnableAddFriend : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); - bool new_value = avatar && !is_agent_friend(avatar->getID()); - -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | OK - new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// bool new_value = avatar && !is_agent_friend(avatar->getID()); +// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f + bool new_value = avatar && !is_agent_friend(avatar->getID()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); // [/RLVa:KB] - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4020,16 +3865,17 @@ void request_friendship(const LLUUID& dest_id) LLViewerObject* dest = gObjectList.findObject(dest_id); if(dest && dest->isAvatar()) { - std::string fullname; + std::string full_name; LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) { - fullname = std::string(nvfirst->getString()) + " " + nvlast->getString(); + full_name = LLCacheName::buildFullName( + nvfirst->getString(), nvlast->getString()); } - if (!fullname.empty()) + if (!full_name.empty()) { - LLPanelFriends::requestFriendshipDialog(dest_id, fullname); + LLPanelFriends::requestFriendshipDialog(dest_id, full_name); } else { @@ -4062,49 +3908,67 @@ class LLEditEnableChangeDisplayname : public view_listener_t } }; -// only works on pie menu -bool handle_sit_or_stand() +bool is_object_sittable() { - LLPickInfo pick = LLToolPie::getInstance()->getPick(); - LLViewerObject *object = pick.getObject();; - // - //if (!object || pick.mPickType == LLPickInfo::PICK_FLORA) - if (!object) - // +// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Added: RLVa-1.1.0j + // RELEASE-RLVa: [SL-2.2.0] Make sure we're examining the same object that handle_sit_or_stand() will request a sit for + if (rlv_handler_t::isEnabled()) { - return true; - } - -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Modified: RLVa-1.1.0j | OK - // Block if we can't sit on the selected object (also handles sitting and prevented from standing up) - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canSit(object, pick.mObjectOffset)) ) - { - return true; + const LLPickInfo& pick = LLToolPie::getInstance()->getPick(); + if ( (pick.mObjectID.notNull()) && (!gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset)) ) + return false; } // [/RLVa:KB] + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + + if (object && object->getPCode() == LL_PCODE_VOLUME) + { + return true; + } + else + { + return false; + } +} + + +// only works on pie menu +void handle_object_sit_or_stand() +{ + LLPickInfo pick = LLToolPie::getInstance()->getPick(); + LLViewerObject *object = pick.getObject();; + if (!object || pick.mPickType == LLPickInfo::PICK_FLORA) + { + return; + } + if (sitting_on_selection()) { - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - return true; + gAgent.standUp(); + return; } // get object selection offset - if (object && object->getPCode() == LL_PCODE_VOLUME) +// if (object && object->getPCode() == LL_PCODE_VOLUME) +// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.2.0c + if ( (object && object->getPCode() == LL_PCODE_VOLUME) && + ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, pick.mObjectOffset))) ) +// [/RLVa:KB] { -// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.1.3b) | Added: RLVa-1.2.1c | OK - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (gAgentAvatarp) ) +// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) ) { if (gAgentAvatarp->isSitting()) { - if (gRlvHandler.canStand()) - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - return true; + gAgent.standUp(); + return; } gRlvHandler.setSitSource(gAgent.getPositionGlobal()); } // [/RLVa:KB] + gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -4115,14 +3979,14 @@ bool handle_sit_or_stand() object->getRegion()->sendReliableMessage(); } - return true; } class LLObjectSitOrStand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - return handle_sit_or_stand(); + handle_object_sit_or_stand(); + return true; } }; @@ -4130,6 +3994,7 @@ void near_sit_down_point(BOOL success, void *) { if (success) { + if (!gSavedSettings.getBOOL("LiruContinueFlyingOnUnsit")) gAgent.setFlying(FALSE); gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); @@ -4142,20 +4007,18 @@ class LLLandSit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f | OK +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f if ( (rlv_handler_t::isEnabled()) && ((!gRlvHandler.canStand()) || (gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) - { return true; - } // [/RLVa:KB] - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + gAgent.standUp(); LLViewerParcelMgr::getInstance()->deselectLand(); LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal; LLQuaternion target_rot; - if (gAgentAvatarp) + if (isAgentAvatarValid()) { target_rot = gAgentAvatarp->getRotation(); } @@ -4259,32 +4122,6 @@ void velocity_interpolate( void* data ) } } - -void toggle_wind_audio(void) -{ - if (gAudiop) - { - gAudiop->enableWind(!(gAudiop->isWindEnabled())); - } -} - - -// Callback for enablement -BOOL is_inventory_visible( void* user_data ) -{ - LLInventoryView* iv = reinterpret_cast(user_data); - if( iv ) - { - return iv->getVisible(); - } - return FALSE; -} - -void handle_show_newest_map(void*) -{ - LLFloaterWorldMap::show(NULL, FALSE); -} - //------------------------------------------------------------------- // Help menu functions //------------------------------------------------------------------- @@ -4292,7 +4129,7 @@ void handle_show_newest_map(void*) // // Major mode switching // -void reset_view_final( BOOL proceed); +void reset_view_final( BOOL proceed ); void handle_reset_view() { @@ -4317,7 +4154,7 @@ class LLViewResetView : public view_listener_t }; // Note: extra parameters allow this function to be called from dialog. -void reset_view_final( BOOL proceed) +void reset_view_final( BOOL proceed ) { if( !proceed ) { @@ -4415,15 +4252,6 @@ class LLEditEnableDuplicate : public view_listener_t } }; - -void disabled_duplicate(void*) -{ - if (LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) - { - LLNotificationsUtil::add("CopyFailed"); - } -} - void handle_duplicate_in_place(void*) { llinfos << "handle_duplicate_in_place" << llendl; @@ -4432,11 +4260,6 @@ void handle_duplicate_in_place(void*) LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE); } -void handle_repeat_duplicate(void*) -{ - LLSelectMgr::getInstance()->repeatDuplicate(); -} - /* dead code 30-apr-2008 void handle_deed_object_to_group(void*) { @@ -4588,38 +4411,6 @@ void handle_claim_public_land(void*) gAgent.sendReliableMessage(); } -void handle_god_request_havok(void *) -{ - if (gAgent.isGodlike()) - { - LLSelectMgr::getInstance()->sendGodlikeRequest("havok", "infoverbose"); - } -} - -//void handle_god_request_foo(void *) -//{ -// if (gAgent.isGodlike()) -// { -// LLSelectMgr::getInstance()->sendGodlikeRequest(GOD_WANTS_FOO); -// } -//} - -//void handle_god_request_terrain_save(void *) -//{ -// if (gAgent.isGodlike()) -// { -// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "save"); -// } -//} - -//void handle_god_request_terrain_load(void *) -//{ -// if (gAgent.isGodlike()) -// { -// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "load"); -// } -//} - BOOL enable_dump_archetype_xm(void*) { return gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); @@ -4642,17 +4433,10 @@ void handle_god_request_avatar_geometry(void *) { if (gAgent.isGodlike()) { - LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", NULL); + LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", ""); } } - -void handle_show_overlay_title(void*) -{ - gShowOverlayTitle = !gShowOverlayTitle; - gSavedSettings.setBOOL("ShowOverlayTitle", gShowOverlayTitle); -} - static bool get_derezzable_objects( EDeRezDestination dest, std::string& error, @@ -4725,12 +4509,9 @@ static bool get_derezzable_objects( break; default: - // - //if((node->mPermissions->allowTransferTo(gAgent.getID()) - // && object->permCopy()) - // || gAgent.isGodlike()) - if(1) - // + if((node->mPermissions->allowTransferTo(gAgent.getID()) + && object->permCopy()) + || gAgent.isGodlike()) { can_derez_current = TRUE; } @@ -4835,12 +4616,12 @@ static void derez_objects( // if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) { - // + // // VEFFECT: DerezObject LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(object->getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - // + // } // } @@ -4880,6 +4661,7 @@ class LLToolsTakeCopy : public view_listener_t void handle_take_copy() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; + // [RLVa:KB] - Checked: 2010-03-07 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand()) ) { @@ -4900,10 +4682,12 @@ class LLObjectReturn : public view_listener_t { public: LLObjectReturn() : mFirstRegion(NULL) {} + +private: bool handleEvent(LLPointer event, const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; -// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b | OK +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.4.0a) | Modified: RLVa-1.0.0b if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) return true; // [/RLVa:KB] @@ -4989,13 +4773,13 @@ void handle_take() // we want to use the folder this was derezzed from if it's // available. Otherwise, derez to the normal place. // if(LLSelectMgr::getInstance()->getSelection()->isEmpty()) -// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b | OK +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b if ( (LLSelectMgr::getInstance()->getSelection()->isEmpty()) || ((rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn())) ) // [/RLVa:KB] { return; } - + BOOL you_own_everything = TRUE; BOOL locked_but_takeable_object = FALSE; LLUUID category_id; @@ -5067,6 +4851,9 @@ void handle_take() LLNotification::Params params("ConfirmObjectTakeLock"); params.payload(payload) + // MAINT-290 + // Reason: Showing the confirmation dialog resets object selection, thus there is nothing to derez. + // Fix: pass selection to the confirm_take, so that selection doesn't "die" after confirmation dialog is opened .functor(boost::bind(&confirm_take, _1, _2, LLSelectMgr::instance().getSelection())); if(locked_but_takeable_object || @@ -5075,7 +4862,6 @@ void handle_take() if(locked_but_takeable_object && you_own_everything) { params.name("ConfirmObjectTakeLock"); - } else if(!locked_but_takeable_object && !you_own_everything) { @@ -5110,7 +4896,7 @@ bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelect BOOL enable_take() { // if (sitting_on_selection()) -// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b | OK +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b if ( (sitting_on_selection()) || ((rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn())) ) // [/RLVa:KB] { @@ -5150,33 +4936,38 @@ BOOL enable_take() return FALSE; } + +void handle_buy_or_take() +{ + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + return; + } + + if (is_selection_buy_not_take()) + { + S32 total_price = selection_price(); + + if (total_price <= gStatusBar->getBalance() || total_price == 0) + { + handle_buy(); + } + else + { + LLFloaterBuyCurrency::buyCurrency( LLTrans::getString( "BuyingCosts" ), total_price ); + } + } + else + { + handle_take(); + } +} + class LLToolsBuyOrTake : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) - { - return true; - } - - if (is_selection_buy_not_take()) - { - S32 total_price = selection_price(); - - if (total_price <= gStatusBar->getBalance() || total_price == 0) - { - handle_buy(); - } - else - { - LLFloaterBuyCurrency::buyCurrency( - "Buying this costs", total_price); - } - } - else - { - handle_take(); - } + handle_buy_or_take(); return true; } }; @@ -5304,11 +5095,6 @@ void show_buy_currency(const char* extra) LLNotificationsUtil::add("PromptGoToCurrencyPage", args, LLSD(), callback_show_buy_currency); } -void handle_buy_currency(void*) -{ -// LLFloaterBuyCurrency::buyCurrency(); -} - void handle_buy() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; @@ -5380,10 +5166,7 @@ class LLToolsSaveToInventory : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - // - //if(enable_save_into_inventory(NULL)) - if(1) - // + if(enable_save_into_inventory(NULL)) { derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null); } @@ -5447,7 +5230,6 @@ class LLToolsEnablePathfindingRebakeRegion : public view_listener_t LLMenuOptionPathfindingRebakeNavmesh *rebakeInstance = LLMenuOptionPathfindingRebakeNavmesh::getInstance(); returnValue = (rebakeInstance->canRebakeRegion() && (rebakeInstance->getMode() == LLMenuOptionPathfindingRebakeNavmesh::kRebakeNavMesh_Available)); - } gMenuHolder->findControl(userdata["control"].asString())->setValue(returnValue); return returnValue; @@ -5657,7 +5439,6 @@ class LLToolsReleaseKeys : public view_listener_t // [/RLVa:KB] gAgent.forceReleaseControls(); - return true; } }; @@ -5666,46 +5447,15 @@ class LLToolsEnableReleaseKeys : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a | OK - gMenuHolder->findControl(userdata["control"].asString())->setValue( - gAgent.anyControlGrabbed() && ((!rlv_handler_t::isEnabled()) || (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE))) ); +// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a + gMenuHolder->findControl(userdata["control"].asString())->setValue(gAgent.anyControlGrabbed() && + ( (!rlv_handler_t::isEnabled()) || (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )); // [/RLVa:KB] - //gMenuHolder->findControl(userdata["control"].asString())->setValue( gAgent.anyControlGrabbed() ); +// gMenuHolder->findControl(userdata["control"].asString())->setValue(gAgent.anyControlGrabbed()); return true; } }; -//void handle_hinge(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(1); -//} - -//void handle_ptop(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(2); -//} - -//void handle_lptop(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(3); -//} - -//void handle_wheel(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(4); -//} - -//void handle_dehinge(void*) -//{ -// LLSelectMgr::getInstance()->sendDehinge(); -//} - -//BOOL enable_dehinge(void*) -//{ -// LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject(); -// return obj && !obj->isAttachment(); -//} - class LLEditEnableCut : public view_listener_t { @@ -6098,7 +5848,7 @@ void show_debug_menus() if ( gMenuBarView ) { BOOL debug = gSavedSettings.getBOOL("UseDebugMenus"); - + if(debug) { LLFirstUse::useDebugMenus(); @@ -6116,7 +5866,7 @@ void show_debug_menus() //gMenuBarView->setItemVisible(std::string(AVI_TOOLS), visible); gMenuBarView->needsArrange(); // clean-up positioning - }; + } } void toggle_debug_menus(void*) @@ -6164,6 +5914,7 @@ void toggle_debug_menus(void*) // gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects..."); // } +// BOOL menu_check_build_tool( void* user_data ) { @@ -6260,18 +6011,7 @@ class LLWorldFakeAway : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (!gSavedSettings.controlExists("FakeAway")) gSavedSettings.declareBOOL("FakeAway", FALSE, "", NO_PERSIST); - - if (gSavedSettings.getBOOL("FakeAway") == TRUE) - { - gSavedSettings.setBOOL("FakeAway", FALSE); - gAgent.sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP); - } - else - { - gSavedSettings.setBOOL("FakeAway", TRUE); - gAgent.sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START); - } + handle_fake_away_status(NULL); return true; } }; @@ -6319,16 +6059,13 @@ class LLWorldSetBusy : public view_listener_t } }; - class LLWorldCreateLandmark : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Added: RLVa-1.0.0a | OK +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.4.5) | Added: RLVa-1.0.0 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - { return true; - } // [/RLVa:KB] LLViewerRegion* agent_region = gAgent.getRegion(); @@ -6370,43 +6107,49 @@ class LLToolsLookAtSelection : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - const F32 PADDING_FACTOR = 2.f; - BOOL zoom = (userdata.asString() == "zoom"); - if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) - { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - - LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); - F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); - F32 distance = selection_bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view); - - LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - selection_bbox.getCenterAgent(); - obj_to_cam.normVec(); - - LLUUID object_id; - if (LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) - { - object_id = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()->mID; - } - if (zoom) - { - // Make sure we are not increasing the distance between the camera and object - LLVector3d orig_distance = gAgentCamera.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal(); - distance = llmin(distance, (F32) orig_distance.length()); - - gAgentCamera.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), - LLSelectMgr::getInstance()->getSelectionCenterGlobal(), - object_id ); - } - else - { - gAgentCamera.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id ); - } - } + handle_look_at_selection(userdata); return true; } }; +void handle_look_at_selection(const LLSD& param) +{ + const F32 PADDING_FACTOR = 2.f; + BOOL zoom = (param.asString() == "zoom"); + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + + LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); + F32 distance = selection_bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view); + + LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - selection_bbox.getCenterAgent(); + obj_to_cam.normVec(); + + LLUUID object_id; + if (LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) + { + object_id = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()->mID; + } + if (zoom) + { + // Make sure we are not increasing the distance between the camera and object + LLVector3d orig_distance = gAgentCamera.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal(); + distance = llmin(distance, (F32) orig_distance.length()); + + gAgentCamera.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), + LLSelectMgr::getInstance()->getSelectionCenterGlobal(), + object_id ); + + } + else + { + gAgentCamera.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id ); + } + } +} + void callback_invite_to_group(LLUUID group_id, void *user_data) { std::vector agent_ids; @@ -6435,15 +6178,11 @@ class LLAvatarInviteToGroup : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | OK - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return true; - } -// [/RLVa:KB] - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if(avatar) +// if(avatar) +// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Added: RLVa-1.2.0d + if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [/RLVa:KB] { invite_to_group(avatar->getID()); } @@ -6455,15 +6194,11 @@ class LLAvatarAddFriend : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | OK - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return true; // Fallback code [see LLAvatarEnableAddFriend::handleEvent()] - } -// [/RLVa:KB] - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if(avatar && !is_agent_friend(avatar->getID())) +// if(avatar && !is_agent_friend(avatar->getID())) +// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f + if ( (avatar && !is_agent_friend(avatar->getID())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [/RLVa:KB] { request_friendship(avatar->getID()); } @@ -6471,7 +6206,7 @@ class LLAvatarAddFriend : public view_listener_t } }; -bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle handle) +bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection) { S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) @@ -6479,7 +6214,7 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec gAgent.clearBusy(); } - LLViewerObject* objectp = handle->getPrimaryObject(); + LLViewerObject* objectp = selection->getPrimaryObject(); // Show avatar's name if paying attachment if (objectp && objectp->isAttachment()) @@ -6494,7 +6229,7 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec { if (objectp->isAvatar()) { - const BOOL is_group = FALSE; + const bool is_group = false; LLFloaterPay::payDirectly(&give_money, objectp->getID(), is_group); @@ -6507,7 +6242,7 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec return false; } -bool handle_give_money_dialog() +void handle_give_money_dialog() { LLNotification::Params params("BusyModePay"); params.functor(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection())); @@ -6521,63 +6256,93 @@ bool handle_give_money_dialog() { LLNotifications::instance().forceResponse(params, 1); } - return true; } class LLPayObject : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - return handle_give_money_dialog(); - } -}; - -class LLEnablePayObject : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); - bool new_value = (avatar != NULL); - if (!new_value) - { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if( object ) - { - LLViewerObject *parent = (LLViewerObject *)object->getParent(); - if((object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) - { - new_value = true; - } - } - } - -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - // Don't enable "Pay..." on the avatar pie menu under @shownames=n - new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (avatar == NULL); -// [/RLVa:KB] - - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + handle_give_money_dialog(); return true; } }; +bool enable_pay_avatar() +{ + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + LLVOAvatar* avatar = find_avatar_from_object(obj); +// return (avatar != NULL); +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + return (avatar != NULL) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [/RLVa:KB] +} + +bool enable_pay_object() +{ + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if( object ) + { + LLViewerObject *parent = (LLViewerObject *)object->getParent(); + if((object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) + { + return true; + } + } + return false; +} + +bool enable_object_stand_up() +{ + // 'Object Stand Up' menu item is enabled when agent is sitting on selection +// return sitting_on_selection(); +// [RLVa:KB] - Checked: 2010-07-24 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + return sitting_on_selection() && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStand()) ); +// [/RLVa:KB] +} + +bool enable_object_sit(/*LLUICtrl* ctrl*/) +{ + // 'Object Sit' menu item is enabled when agent is not sitting on selection + bool sitting_on_sel = sitting_on_selection(); + /* + if (!sitting_on_sel) + { + std::string item_name = ctrl->getName(); + + // init default labels + init_default_item_label(item_name); + + // Update label + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if (node && node->mValid && !node->mSitName.empty()) + { + gMenuHolder->childSetText(item_name, node->mSitName); + } + else + { + gMenuHolder->childSetText(item_name, get_default_item_label(item_name)); + } + } + */ + +// [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-1.2.0c + // RELEASE-RLVA: [SL-2.2.0] Make this match what happens in handle_object_sit_or_stand() + if (rlv_handler_t::isEnabled()) + { + const LLPickInfo& pick = LLToolPie::getInstance()->getPick(); + if (pick.mObjectID.notNull()) + sitting_on_sel = !gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset); + } +// [/RLVa:KB] + + return !sitting_on_sel && is_object_sittable(); +} + class LLObjectEnableSitOrStand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = false; - LLViewerObject* dest_object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - - if(dest_object) - { - if(dest_object->getPCode() == LL_PCODE_VOLUME) - { - new_value = true; - } - } -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j -// gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); -// [/RLVa:KB] + bool new_value; // Update label std::string label; @@ -6590,12 +6355,11 @@ class LLObjectEnableSitOrStand : public view_listener_t sit_text = param.substr(0, offset); stand_text = param.substr(offset+1); } + if (sitting_on_selection()) { label = stand_text; -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - new_value &= !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); -// [/RLVa:KB] + new_value = enable_object_stand_up(); } else { @@ -6608,27 +6372,24 @@ class LLObjectEnableSitOrStand : public view_listener_t { label = sit_text; } -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - if ( (rlv_handler_t::isEnabled()) && (new_value) ) - { - // RELEASE-RLVa: [2009-12-22] make sure we examine the same object that handle_sit_or_stand() will request a sit for - const LLPickInfo& pick = LLToolPie::getInstance()->getPick(); - if (pick.mObjectID.notNull()) - { - new_value = gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset); - } - } -// [/RLVa:KB] + new_value = enable_object_sit(); } gMenuHolder->childSetText("Object Sit", label); -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); -// [/RLVa:KB] return true; } }; +class LLEnablePayObject : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_pay_avatar() || enable_pay_object()); + return true; + } +}; + void edit_ui(void*) { LLFloater::setEditModeEnabled(!LLFloater::getEditModeEnabled()); @@ -6644,6 +6405,7 @@ void dump_inventory(void*) gInventory.dumpInventory(); } + void handle_dump_followcam(void*) { LLFollowCamMgr::dump(); @@ -6762,7 +6524,6 @@ class LLShowFloater : public view_listener_t { LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); } - LLViewerParcelMgr::getInstance()->startBuyLand(); } else if (floater_name == "about region") @@ -6948,6 +6709,7 @@ class LLFloaterVisible : public view_listener_t } }; + bool callback_show_url(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); @@ -7049,7 +6811,7 @@ class LLShowAgentProfile : public view_listener_t if ( (avatar) && ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (gAgent.getID() == agent_id)) ) // [/RLVa:KB] { - LLFloaterAvatarInfo::show( avatar->getID() ); + LLFloaterAvatarInfo::show(avatar->getID()); } return true; } @@ -7063,6 +6825,7 @@ class LLShowAgentGroups : public view_listener_t return true; } }; + class LLLandEdit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -7121,7 +6884,6 @@ BOOL enable_buy_land(void*) } - class LLObjectAttachToAvatar : public view_listener_t { public: @@ -7140,7 +6902,7 @@ private: if (index > 0) attachment_point = get_if_there(gAgentAvatarp->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL); -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f | OK +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f // RELEASE-RLVa: [SL-2.2.0] If 'index != 0' then the object will be "add attached" [see LLSelectMgr::sendAttach()] if ( (rlv_handler_t::isEnabled()) && ( ((!index) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY))) || // Can't wear on default @@ -7296,7 +7058,7 @@ class LLAttachmentDrop : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0e) | Modified: RLVa-1.0.5 | OK +// [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0e) | Modified: RLVa-1.0.5 if (rlv_handler_t::isEnabled()) { if (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) @@ -7337,7 +7099,7 @@ void handle_detach_from_avatar(void* user_data) { uuid_vec_t ids_to_remove; const LLViewerJointAttachment *attachment = (LLViewerJointAttachment*)user_data; - + // if (attachment->getNumObjects() > 0) // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a if ( (attachment->getNumObjects() > 0) && ((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(attachment))) ) @@ -7409,7 +7171,6 @@ void detach_label(std::string& label, void* user_data) } } - class LLAttachmentDetach : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -7446,7 +7207,7 @@ class LLAttachmentDetach : public view_listener_t return true; } -// [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0a) | Modified: RLVa-1.0.5 | OK +// [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0a) | Modified: RLVa-1.0.5 // NOTE: copy/paste of the code in enable_detach() if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) ) { @@ -7500,18 +7261,18 @@ class LLAttachmentEnableDrop : public view_listener_t // item is in your inventory LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - LLViewerJointAttachment* attachment_pt = NULL; + LLViewerJointAttachment* attachment = NULL; LLInventoryItem* item = NULL; - if ( object ) + if (object) { S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState()); - attachment_pt = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); + attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); - if ( attachment_pt ) + if (attachment) { - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment_pt->mAttachedObjects.begin(); - attachment_iter != attachment_pt->mAttachedObjects.end(); + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { // make sure item is in your inventory (it could be a delayed attach message being sent from the sim) @@ -7532,9 +7293,9 @@ class LLAttachmentEnableDrop : public view_listener_t } //now check to make sure that the item is actually in the inventory before we enable dropping it -// bool new_value = enable_detach(NULL) && can_build && item; -// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) - bool new_value = enable_detach(NULL) && can_build && item && (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)); +// bool new_value = enable_detach() && can_build && item; +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.0.0b) | Modified: RLVa-1.0.0b + bool new_value = enable_detach() && can_build && item && (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)); // [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); @@ -7542,11 +7303,14 @@ class LLAttachmentEnableDrop : public view_listener_t } }; -BOOL enable_detach(void*) +BOOL enable_detach(const LLSD&) { LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (!object) return FALSE; - if (!object->isAttachment()) return FALSE; + if (!object || + !object->isAttachment()) + { + return FALSE; + } // Find the avatar who owns this attachment LLViewerObject* avatar = object; @@ -7555,7 +7319,7 @@ BOOL enable_detach(void*) // ...if it's you, good to detach if (avatar->getID() == gAgent.getID()) { -// [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0a) | Modified: RLVa-1.0.5 | OK +// [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0a) | Modified: RLVa-1.0.5 // NOTE: this code is reused as-is in LLAttachmentDetach::handleEvent() and LLAttachmentDrop::handleEvent() // so any changes here should be reflected there as well @@ -7582,7 +7346,7 @@ class LLAttachmentEnableDetach : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = enable_detach(NULL); + bool new_value = enable_detach(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -7596,6 +7360,7 @@ BOOL object_selected_and_point_valid(void *user_data) { if (!isAgentAvatarValid()) return FALSE; + // RELEASE-RLVa: look at the caller graph for this function on every new release // -> 1.22.11 and 1.23.4 // - object_is_wearable() => dead code [user_data == NULL => default attach point => OK!] @@ -7612,7 +7377,6 @@ BOOL object_selected_and_point_valid(void *user_data) } // [/RLVa:KB] - //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::root_iterator iter = selection->root_begin(); iter != selection->root_end(); iter++) @@ -7640,6 +7404,8 @@ BOOL object_selected_and_point_valid(void *user_data) } +// [RLVa:KB] - Checked: 2010-03-16 (RLVa-1.2.0a) | Added: RLVa-1.2.0a +/* BOOL object_is_wearable() { if (!object_selected_and_point_valid(NULL)) @@ -7662,6 +7428,8 @@ BOOL object_is_wearable() } return FALSE; } +*/ +// [/RLVa:KB] // Also for seeing if object can be attached. See above. @@ -7747,7 +7515,7 @@ namespace }; } -void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, const std::string& nomodmsg) +void queue_actions(LLFloaterScriptQueue* q, const std::string& msg) { QueueObjects func(q); LLSelectMgr *mgr = LLSelectMgr::getInstance(); @@ -7757,10 +7525,12 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons { if ( !func.scripted ) { + std::string noscriptmsg = std::string("Cannot") + msg + "SelectObjectsNoScripts"; LLNotifications::instance().add(noscriptmsg); } else if ( !func.modifiable ) { + std::string nomodmsg = std::string("Cannot") + msg + "SelectObjectsNoPermission"; LLNotifications::instance().add(nomodmsg); } else @@ -7777,43 +7547,11 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons } } -void handle_compile_queue(std::string to_lang) -{ - LLFloaterCompileQueue* queue; - if (to_lang == "mono") - { - queue = LLFloaterCompileQueue::create(TRUE); - } - else - { - queue = LLFloaterCompileQueue::create(FALSE); - } - queue_actions(queue, "CannotRecompileSelectObjectsNoScripts", "CannotRecompileSelectObjectsNoPermission"); -} - -void handle_reset_selection(void) -{ - LLFloaterResetQueue* queue = LLFloaterResetQueue::create(); - queue_actions(queue, "CannotResetSelectObjectsNoScripts", "CannotResetSelectObjectsNoPermission"); -} - -void handle_set_run_selection(void) -{ - LLFloaterRunQueue* queue = LLFloaterRunQueue::create(); - queue_actions(queue, "CannotSetRunningSelectObjectsNoScripts", "CannotSerRunningSelectObjectsNoPermission"); -} - -void handle_set_not_run_selection(void) -{ - LLFloaterNotRunQueue* queue = LLFloaterNotRunQueue::create(); - queue_actions(queue, "CannotSetRunningNotSelectObjectsNoScripts", "CannotSerRunningNotSelectObjectsNoPermission"); -} - class LLToolsSelectedScriptAction : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a | OK +// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a // We'll allow resetting the scripts of objects on a non-attachable attach point since they wouldn't be able to circumvent anything if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) ) { @@ -7825,25 +7563,40 @@ class LLToolsSelectedScriptAction : public view_listener_t // [/RLVa:KB] std::string action = userdata.asString(); + LLFloaterScriptQueue* queue = NULL; + std::string msg; if (action == "compile mono") { - handle_compile_queue("mono"); + queue = LLFloaterCompileQueue::create(true); + msg = "Recompile"; } if (action == "compile lsl") { - handle_compile_queue("lsl"); + queue = LLFloaterCompileQueue::create(false); + msg = "Recompile"; } else if (action == "reset") { - handle_reset_selection(); + queue = LLFloaterResetQueue::create(); + msg = "Reset"; } else if (action == "start") { - handle_set_run_selection(); + queue = LLFloaterRunQueue::create(); + msg = "SetRunning"; } else if (action == "stop") { - handle_set_not_run_selection(); + queue = LLFloaterNotRunQueue::create(); + msg = "SetRunningNot"; + } + if (queue) + { + queue_actions(queue, msg); + } + else + { + llwarns << "Failed to generate LLFloaterScriptQueue with action: " << action << llendl; } return true; } @@ -7925,7 +7678,7 @@ void handle_dump_image_list(void*) void handle_test_male(void*) { -// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a | OK +// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a // TODO-RLVa: [RLVa-1.2.1] Is there any reason to still block this? if ( (rlv_handler_t::isEnabled()) && ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY))) ) @@ -7940,7 +7693,7 @@ void handle_test_male(void*) void handle_test_female(void*) { -// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a | OK +// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a // TODO-RLVa: [RLVa-1.2.1] Is there any reason to still block this? if ( (rlv_handler_t::isEnabled()) && ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY))) ) @@ -7959,20 +7712,15 @@ void handle_toggle_pg(void*) LLFloaterWorldMap::reloadIcons(NULL); - llinfos << "PG status set to " << (S32)gAgent.isTeen() << llendl; + llinfos << "PG status set to " << gAgent.isTeen() << llendl; } void handle_dump_attachments(void*) { - LLVOAvatar* avatar = gAgentAvatarp; - if( !avatar ) - { - llinfos << "NO AVATAR" << llendl; - return; - } + if(!isAgentAvatarValid()) return; - for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); - iter != avatar->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; @@ -8031,7 +7779,7 @@ void menu_toggle_control( void* user_data ) } -// these are used in the gl menus to set control values. +// these are used in the gl menus to set control values, generically. class LLToggleControl : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -8111,7 +7859,7 @@ BOOL enable_more_than_one_selected(void* ) static bool is_editable_selected() { -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a | OK +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a // RELEASE-RLVa: [SL-2.2.0] Check that this still isn't called by anything but script actions in the Build menu if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) ) { @@ -8346,28 +8094,6 @@ class LLToolsEnableSaveToObjectInventory : public view_listener_t } }; -BOOL enable_not_thirdperson(void*) -{ - return !gAgentCamera.cameraThirdPerson(); -} - - -// BOOL enable_export_selected(void *) -// { -// if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) -// { -// return FALSE; -// } -// if (!gExporterRequestID.isNull()) -// { -// return FALSE; -// } -// if (!LLUploadDialog::modalUploadIsFinished()) -// { -// return FALSE; -// } -// return TRUE; -// } class LLViewEnableMouselook : public view_listener_t { @@ -8423,21 +8149,15 @@ class LLWorldEnableTeleportHome : public view_listener_t LLViewerRegion* regionp = gAgent.getRegion(); bool agent_on_prelude = (regionp && regionp->isPrelude()); bool enable_teleport_home = gAgent.isGodlike() || !agent_on_prelude; -// [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - enable_teleport_home &= !gRlvHandler.hasBehaviour(RLV_BHVR_TPLM); +// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f + enable_teleport_home &= + (!rlv_handler_t::isEnabled()) || ((!gRlvHandler.hasBehaviour(RLV_BHVR_TPLM)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC))); // [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_teleport_home); return true; } }; -BOOL enable_region_owner(void*) -{ - if(gAgent.getRegion() && gAgent.getRegion()->getOwner() == gAgent.getID()) - return TRUE; - return enable_god_customer_service(NULL); -} - BOOL enable_god_full(void*) { return gAgent.getGodLevel() >= GOD_FULL; @@ -8448,26 +8168,20 @@ BOOL enable_god_liaison(void*) return gAgent.getGodLevel() >= GOD_LIAISON; } -BOOL enable_god_customer_service(void*) +BOOL is_god_customer_service(void*) { return gAgent.getGodLevel() >= GOD_CUSTOMER_SERVICE; } BOOL enable_god_basic(void*) { -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - // RELEASE-RLVa: check that this function isn't used for anything other than to enable/disable showing the "God Tools..." floater - return (gAgent.getGodLevel() > GOD_NOT) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); -// [/RLVa:KB] - //return gAgent.getGodLevel() > GOD_NOT; + return gAgent.getGodLevel() > GOD_NOT; } + void toggle_show_xui_names(void *) { - BOOL showXUINames = gSavedSettings.getBOOL("ShowXUINames"); - - showXUINames = !showXUINames; - gSavedSettings.setBOOL("ShowXUINames", showXUINames); + gSavedSettings.setBOOL("ShowXUINames", !gSavedSettings.getBOOL("ShowXUINames")); } BOOL check_show_xui_names(void *) @@ -8590,10 +8304,23 @@ void slow_mo_animations(void*) void handle_dump_avatar_local_textures(void*) { - if( isAgentAvatarValid() ) + if (!isAgentAvatarValid()) return; + gAgentAvatarp->dumpLocalTextures(); +} + +void handle_debug_avatar_textures(void*) +{ + if (LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) { - gAgentAvatarp->dumpLocalTextures(); + LLFloaterAvatarTextures::show(objectp->getID()); } + // + else + { + // default to own avatar + LLFloaterAvatarTextures::show(gAgent.getID()); + } + // } void init_meshes_and_morphs_menu() @@ -8992,22 +8719,6 @@ static void handle_morph_load_obj_continued(void* data, AIFilePicker* filepicker morph_data->setMorphFromMesh(&mesh); } -void handle_debug_avatar_textures(void*) -{ - LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (objectp) - { - LLFloaterAvatarTextures::show(objectp->getID()); - } - // -} - // Returns a pointer to the avatar give the UUID of the avatar OR of an attachment the avatar is wearing. // Returns NULL on failure. LLVOAvatar* find_avatar_from_object( LLViewerObject* object ) @@ -9022,8 +8733,7 @@ LLVOAvatar* find_avatar_from_object( LLViewerObject* object ) } while( object && !object->isAvatar() ); } - else - if( !object->isAvatar() ) + else if( !object->isAvatar() ) { object = NULL; } @@ -9043,7 +8753,7 @@ LLVOAvatar* find_avatar_from_object( const LLUUID& object_id ) void handle_disconnect_viewer(void *) { - LLAppViewer::instance()->forceDisconnect("Testing viewer disconnect"); + LLAppViewer::instance()->forceDisconnect(LLTrans::getString("TestingDisconnect")); } void force_error_breakpoint(void *) @@ -9111,20 +8821,29 @@ void handle_test_load_url(void*) // LLViewerMenuHolderGL // -LLViewerMenuHolderGL::LLViewerMenuHolderGL() : LLMenuHolderGL() -{ -} +LLViewerMenuHolderGL::LLViewerMenuHolderGL() +: LLMenuHolderGL() +{} BOOL LLViewerMenuHolderGL::hideMenus() { - BOOL handled = LLMenuHolderGL::hideMenus(); + BOOL handled = FALSE; + + if (LLMenuHolderGL::hideMenus()) + { + LLToolPie::instance().blockClickToWalk(); + handled = TRUE; + } // drop pie menu selection mParcelSelection = NULL; mObjectSelection = NULL; - gMenuBarView->clearHoverItem(); - gMenuBarView->resetMenuTrigger(); + if (gMenuBarView) + { + gMenuBarView->clearHoverItem(); + gMenuBarView->resetMenuTrigger(); + } return handled; } @@ -9210,25 +8929,7 @@ void handle_buy_currency_test(void*) LLStringUtil::format_map_t replace; replace["[AGENT_ID]"] = gAgent.getID().asString(); replace["[SESSION_ID]"] = gAgent.getSecureSessionID().asString(); - - // *TODO: Replace with call to LLUI::getLanguage() after windows-setup - // branch merges in. JC - std::string language = "en-us"; - language = gSavedSettings.getString("Language"); - if (language.empty() || language == "default") - { - language = gSavedSettings.getString("InstallLanguage"); - } - if (language.empty() || language == "default") - { - language = gSavedSettings.getString("SystemLanguage"); - } - if (language.empty() || language == "default") - { - language = "en-us"; - } - - replace["[LANGUAGE]"] = language; + replace["[LANGUAGE]"] = LLUI::getLanguage(); LLStringUtil::format(url, replace); llinfos << "buy currency url " << url << llendl; @@ -9341,7 +9042,7 @@ class LLViewShowHUDAttachments : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.1a) | Modified: RLVa-1.0.0c | OK +// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.1a) | Modified: RLVa-1.0.0c if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedHUD()) && (LLPipeline::sShowHUDAttachments) ) return true; // [/RLVa:KB] @@ -9369,13 +9070,15 @@ class LLEditEnableTakeOff : public view_listener_t std::string control_name = userdata["control"].asString(); std::string clothing = userdata["data"].asString(); LLWearableType::EType type = LLWearableType::typeNameToType(clothing); - if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT) -// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.1.3b) | Modified: RLVa-1.1.3b | OK - if ( !(rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(type)) ) +// if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT) +// [RLVa:KB] - Checked: 2010-03-20 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a + // NOTE: see below - enable if there is at least one wearable on this type that can be removed + if ( (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT) && + ((!rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(type))) ) // [/RLVa:KB] - - new_value = LLAgentWearables::selfHasWearable(type); - + { + new_value = LLAgentWearables::selfHasWearable(type); + } gMenuHolder->findControl(control_name)->setValue(new_value); return false; } @@ -9412,6 +9115,7 @@ class LLEditTakeOff : public view_listener_t return true; // No wearable found that can be removed } // [/RLVa:KB] + LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index); LLAppearanceMgr::instance().removeItemFromAvatar(item_id); } @@ -9463,7 +9167,7 @@ class LLWorldEnvSettings : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { -// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a) | Modified: RLVa-1.0.0g | OK +// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a) | Modified: RLVa-1.0.0g if (gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) return true; // [/RLVa:KB] @@ -9474,18 +9178,18 @@ class LLWorldEnvSettings : public view_listener_t { // if not there or is hidden, show it if( !LLFloaterEnvSettings::isOpen() || - !LLFloaterEnvSettings::instance()->getVisible()) { - LLFloaterEnvSettings::show(); - - // otherwise, close it button acts like a toggle - } - else + !LLFloaterEnvSettings::instance()->getVisible()) { + LLFloaterEnvSettings::show(); + } + else + { + // otherwise, close it button acts like a toggle LLFloaterEnvSettings::instance()->close(); } return true; } - + if (tod == "sunrise") { LLEnvManagerNew::instance().setUseSkyPreset("Sunrise", gSavedSettings.getBOOL("PhoenixInterpolateSky")); @@ -9513,7 +9217,7 @@ class LLWorldEnvSettings : public view_listener_t /// Water Menu callbacks class LLWorldWaterSettings : public view_listener_t -{ +{ bool handleEvent(LLPointer event, const LLSD& userdata) { // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) @@ -9590,19 +9294,6 @@ void initialize_menus() F32 mVal; bool mMult; }; - - class LLAvatarReportAbuse : public view_listener_t - { - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if(avatar) - { - LLFloaterReporter::showFromObject(avatar->getID()); - } - return true; - } - }; // File menu init_menu_file(); @@ -9710,7 +9401,6 @@ void initialize_menus() addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); - addMenu(new LLScriptDelete(), "Tools.ScriptDelete"); // addMenu(new LLToolsEnableAdminDelete(), "Tools.EnableAdminDelete"); addMenu(new LLToolsAdminDelete(), "Tools.AdminDelete"); @@ -9754,7 +9444,6 @@ void initialize_menus() addMenu(new LLAvatarDebug(), "Avatar.Debug"); addMenu(new LLAvatarVisibleDebug(), "Avatar.VisibleDebug"); - addMenu(new LLAvatarEnableDebug(), "Avatar.EnableDebug"); addMenu(new LLAvatarInviteToGroup(), "Avatar.InviteToGroup"); addMenu(new LLAvatarGiveCard(), "Avatar.GiveCard"); addMenu(new LLAvatarEject(), "Avatar.Eject"); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 9d4d43629..265f77fd3 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -83,14 +83,13 @@ void confirm_replace_attachment(S32 option, void* user_data); void handle_detach_from_avatar(void* user_data); void attach_label(std::string& label, void* user_data); void detach_label(std::string& label, void* user_data); -BOOL object_selected_and_point_valid(void* user_data); -BOOL object_attached(void* user_data); void handle_detach(void*); +// [SL:KB] - Patch: Inventory-AttachmentEdit - Checked: 2010-08-25 (Catznip-2.2.0a) | Added: Catznip-2.1.2a +void handle_attachment_edit(const LLUUID& idItem); +// [/SL:KB] BOOL enable_god_full(void* user_data); BOOL enable_god_liaison(void* user_data); -BOOL enable_god_customer_service(void* user_data); BOOL enable_god_basic(void* user_data); -void handle_show_newest_map(void*); void set_underclothes_menu_options(); void exchange_callingcard(const LLUUID& dest_id); @@ -98,6 +97,9 @@ void exchange_callingcard(const LLUUID& dest_id); void handle_gestures(void*); void handle_sit_down(void*); void handle_object_build(void*); +void handle_object_touch(); +bool enable_object_open(); +void handle_object_open(); bool visible_take_object(); bool enable_object_take_copy(); @@ -108,9 +110,18 @@ bool enable_object_delete(); void handle_buy(); void handle_take(); void handle_take_copy(); +void handle_look_at_selection(const LLSD& param); void handle_object_return(); void handle_object_delete(); +// Takes avatar UUID, or if no UUID passed, uses last selected object +void handle_avatar_freeze(const LLSD& avatar_id); + +// Takes avatar UUID, or if no UUID passed, uses last selected object +void handle_avatar_eject(const LLSD& avatar_id); + +bool enable_freeze_eject(const LLSD& avatar_id); + // Can anyone take a free copy of the object? // *TODO: Move to separate file bool anyone_copy_selection(LLSelectNode* nodep); @@ -123,9 +134,9 @@ void handle_save_snapshot(void *); void handle_toggle_flycam(); void handle_fake_away_status(void*); -bool handle_sit_or_stand(); -bool handle_give_money_dialog(); -bool handle_object_open(); +void handle_object_sit_or_stand(); +void handle_give_money_dialog(); +bool enable_pay_object(); bool enable_buy_object(); bool handle_go_to(); @@ -158,19 +169,12 @@ extern LLViewerMenuHolderGL* gMenuHolder; extern LLMenuBarGL* gLoginMenuBarView; // Pie menus -extern LLPieMenu *gPieSelf; -extern LLPieMenu *gPieAvatar; -extern LLPieMenu *gPieObject; -extern LLPieMenu *gPieAttachment; -extern LLPieMenu *gPieLand; -extern LLPieMenu* gPieRate; - -// Pie menus -extern LLPieMenu *gPieSelfSimple; -extern LLPieMenu *gPieAvatarSimple; -extern LLPieMenu *gPieObjectSimple; -extern LLPieMenu *gPieAttachmentSimple; -extern LLPieMenu *gPieLandSimple; +extern LLPieMenu *gPieSelf; +extern LLPieMenu *gPieAvatar; +extern LLPieMenu *gPieObject; +extern LLPieMenu *gPieAttachment; +extern LLPieMenu *gPieLand; +extern LLPieMenu *gPieRate; // Needed to build menus when attachment site list available extern LLMenuGL* gAttachSubMenu; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 146d90d8f..b20689daf 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3,10 +3,9 @@ * @brief Dumping ground for viewer-side message system callbacks. * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -34,80 +33,53 @@ #include "llviewermessage.h" #include -#include - -#include "llimagejpeg.h" -#include "llagentui.h" #include "llanimationstates.h" #include "llaudioengine.h" #include "llavatarnamecache.h" -#include "indra_constants.h" #include "../lscript/lscript_byteformat.h" //Need LSCRIPTRunTimePermissionBits and SCRIPT_PERMISSION_* - -#include "llfloaterbump.h" -#include "llassetstorage.h" -#include "llcachename.h" -#include "llchat.h" -#include "lldbstrings.h" #include "lleconomy.h" #include "llfocusmgr.h" #include "llfollowcamparams.h" -#include "llinstantmessage.h" -#include "llquantize.h" -#include "llregionflags.h" +#include "llinventorydefines.h" #include "llregionhandle.h" #include "llsdserialize.h" -#include "llstring.h" #include "llteleportflags.h" -#include "lltracker.h" #include "lltransactionflags.h" #include "llvfile.h" #include "llvfs.h" #include "llxfermanager.h" #include "mean_collision_data.h" -#include "message.h" -#include "sound_ids.h" -#include "lleventtimer.h" -#include "llmd5.h" #include "llagent.h" #include "llagentcamera.h" #include "llcallingcard.h" -#include "llconsole.h" -#include "llvieweraudio.h" -#include "llviewercontrol.h" -#include "lldrawpool.h" #include "llfirstuse.h" #include "llfloateranimpreview.h" +#include "llfloaterbump.h" #include "llfloaterbuycurrency.h" #include "llfloaterbuyland.h" #include "llfloaterchat.h" #include "llfloatergroupinfo.h" #include "llfloaterimagepreview.h" -#include "llfloaterinventory.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" #include "llfloaterlandholdings.h" -#include "llurldispatcher.h" #include "llfloatermute.h" #include "llfloaterpostcard.h" #include "llfloaterpreference.h" #include "llfloaterteleporthistory.h" -#include "llfollowcam.h" -#include "llgroupnotify.h" -#include "llhudeffect.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llimpanel.h" -#include "llinventorydefines.h" +#include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventorypanel.h" -#include "llmenugl.h" #include "llmutelist.h" #include "llnotify.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpanelgrouplandmoney.h" +#include "llpanelmaininventory.h" #include "llselectmgr.h" #include "llstartup.h" #include "llsky.h" @@ -115,48 +87,33 @@ #include "llstatusbar.h" #include "llimview.h" #include "llfloateractivespeakers.h" -#include "lltexturestats.h" -#include "lltool.h" -#include "lltoolbar.h" -#include "lltoolmgr.h" #include "lltrans.h" -#include "llfoldertype.h" -#include "llui.h" // for make_ui_sound -#include "lluploaddialog.h" -#include "llviewercamera.h" -#include "llviewerdisplay.h" #include "llviewerfoldertype.h" #include "llviewergenericmessage.h" #include "llviewermenu.h" #include "llviewerinventory.h" #include "llviewerjoystick.h" -#include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" -#include "llviewerpartsource.h" #include "llviewerstats.h" #include "llviewertexteditor.h" #include "llviewerthrottle.h" #include "llviewerwindow.h" #include "llvlmanager.h" #include "llvoavatar.h" -#include "llweb.h" #include "llworld.h" #include "pipeline.h" -#include "llappviewer.h" #include "llfloaterworldmap.h" #include "llviewerdisplay.h" #include "llkeythrottle.h" +#include "llagentui.h" #include "llviewerregion.h" -// -#include "llviewernetwork.h" -// -// [RLVa:KB] +// [RLVa:KB] - Checked: 2010-03-09 (RLVa-1.2.0a) +#include "llfloateravatarinfo.h" // Checked: 2009-07-08 (RLVa-1.0.0e) #include "rlvhandler.h" #include "rlvinventory.h" #include "rlvui.h" -#include "rlvcommon.h" // [/RLVa:KB] #if SHY_MOD //Command handler @@ -169,9 +126,6 @@ #include "sgversion.h" #include "m7wlinterface.h" -#include "llwlparammanager.h" -#include "llwaterparammanager.h" - #include "llgiveinventory.h" #include @@ -190,10 +144,6 @@ static const boost::regex NEWLINES("\\n{1}"); extern AIHTTPTimeoutPolicy authHandler_timeout; -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) -#include "llfloateravatarinfo.h" -// [/RLVa:KB] - // // Constants // @@ -314,9 +264,6 @@ static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("Offer void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group, S32 trx_type, const std::string& desc) { - // - //if(!region) return; - // if(0 == amount || !region) return; amount = abs(amount); LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL; @@ -1115,7 +1062,9 @@ public: // If we now try to remove the inventory item, it will cause a nested // notifyObservers() call, which won't work. // So defer moving the item to trash until viewer gets idle (in a moment). - LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeItem, &gInventory, mObjectID)); + // Use removeObject() rather than removeItem() because at this level, + // the object could be either an item or a folder. + LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeObject, &gInventory, mObjectID)); gInventory.removeObserver(this); delete this; } @@ -1272,12 +1221,14 @@ void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name) return; } + + //////////////////////////////////////////////////////////////////////////////// + // Highlight item //Not sure about this check. Could make it easy to miss incoming items. //don't dick with highlight while the user is working //if(inventory_has_focus && !user_is_away) // break; LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID() << LL_ENDL; - //highlight item LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); view->getPanel()->setSelection(item->getUUID(), TAKE_FOCUS_NO); @@ -1381,7 +1332,7 @@ LLSD LLOfferInfo::asLLSD() } bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response) - { +{ LLChat chat; std::string log_message; S32 button = LLNotificationsUtil::getSelectedOption(notification, response); @@ -1415,8 +1366,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); LLInventoryObserver* opener = NULL; - LLViewerInventoryCategory* catp = NULL; - catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID); + LLViewerInventoryCategory* catp = gInventory.getCategory(mObjectID); LLViewerInventoryItem* itemp = NULL; if(!catp) { @@ -1921,6 +1871,36 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } } +static std::string clean_name_from_task_im(const std::string& msg, + BOOL from_group) +{ + boost::smatch match; + static const boost::regex returned_exp( + "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); + if (boost::regex_match(msg, match, returned_exp)) + { + // match objects are 1-based for groups + std::string final = match[1].str(); + std::string name = match[2].str(); + // Don't try to clean up group names + if (!from_group) + { + if (LLAvatarNameCache::useDisplayNames()) + { + // ...just convert to username + final += LLCacheName::buildUsername(name); + } + else + { + // ...strip out legacy "Resident" name + final += LLCacheName::cleanFullName(name); + } + } + final += match[3].str(); + return final; + } + return msg; +} void notification_display_name_callback(const LLUUID& id, const LLAvatarName& av_name, @@ -1931,6 +1911,25 @@ void notification_display_name_callback(const LLUUID& id, substitutions["NAME"] = av_name.mDisplayName; LLNotificationsUtil::add(name, substitutions, payload); } + +// Callback for name resolution of a god/estate message +void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message) +{ + std::string name; + LLAvatarNameCache::getPNSName(av_name, name); + LLSD args; + args["NAME"] = name; + args["MESSAGE"] = message; + LLNotificationsUtil::add("GodMessage", args); + + // Treat like a system message and put in chat history. + chat.mText = name + ": " + message; + + // Claim to be from a local agent so it doesn't go into console. + LLFloaterChat::addChat(chat, false, true); + +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2006,6 +2005,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { name = LLTrans::getString("Unnamed"); } + + // Preserve the unaltered name for use in group notice mute checking. + std::string original_name = name; + // IDEVO convert new-style "Resident" names for display name = clean_name_from_im(name, dialog); @@ -2019,6 +2022,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) || dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id); BOOL is_linden = LLMuteList::getInstance()->isLinden(name); BOOL is_owned_by_me = FALSE; + BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; + BOOL accept_im_from_only_friend = gSavedSettings.getBOOL("VoiceCallsFriendsOnly"); LLUUID computed_session_id = LLIMMgr::computeSessionID(dialog,from_id); @@ -2290,10 +2295,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // do nothing -- don't distract newbies in // Prelude with global IMs } -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.1.3a) | Modified: RLVa-1.2.0b - else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) ) +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a + else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) && + (!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) ) { - // TODO-RLVa: [RLVa-1.2.1] Should we send our version string if the other party is muted? RlvUtil::sendBusyMessage(from_id, RlvStrings::getVersion(), session_id); // We won't receive a typing stop message, so do that manually (see comment at the end of LLFloaterIMPanel::sendMsg) LLPointer im_info = new LLIMInfo(gMessageSystem); @@ -2360,41 +2365,24 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else if (to_id.isNull()) { -// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) - // Filter region messages that weren't sent by a Linden - if ( (rlv_handler_t::isEnabled()) && (LLMuteList::getInstance()) && - (!LLMuteList::getInstance()->isLinden(name)) && (from_id != gAgent.getID()) ) - { - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - RlvUtil::filterLocation(message); - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - name = RlvStrings::getAnonym(name); - RlvUtil::filterNames(message); - } - } -// [/RLVa:KB] - - // Message to everyone from GOD - args["NAME"] = name; - args["MESSAGE"] = message; - LLNotificationsUtil::add("GodMessage", args); - - // Treat like a system message and put in chat history. - // Claim to be from a local agent so it doesn't go into - // console. - chat.mText = name + separator_string + message.substr(message_offset); - BOOL local_agent = TRUE; - LLFloaterChat::addChat(chat, FALSE, local_agent); + // Message to everyone from GOD, look up the fullname since + // server always slams name to legacy names + LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message)); } else { // standard message, not from system + bool mute_im = is_muted; + if(accept_im_from_only_friend&&!is_friend) + { + mute_im = true; + } + // [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c // Don't block offline IMs, or IMs from Lindens if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!is_linden) && (!gRlvHandler.canReceiveIM(from_id)) ) { - if (!is_muted) + if (!mute_im) RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id); message = message.substr(0, message_offset) + RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); } @@ -2407,11 +2395,25 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) args["[LONG_TIMESTAMP]"] = formatted_time(timestamp); saved = LLTrans::getString("Saved_message", args); } - buffer = separator_string + saved + message.substr(message_offset); + buffer = separator_string + saved + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; - if (!is_muted || is_linden) +/* + bool mute_im = is_muted; + if (accept_im_from_only_friend && !is_friend) + { + if (!gIMMgr->isNonFriendSessionNotified(session_id)) + { + std::string message = LLTrans::getString("IM_unblock_only_groups_friends"); + gIMMgr->addMessage(session_id, from_id, name, message); + gIMMgr->addNotifiedNonFriendSessionID(session_id); + } + + mute_im = true; + } +*/ + if (!mute_im || is_linden) { gIMMgr->addMessage( session_id, @@ -2458,9 +2460,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_MESSAGEBOX: { // This is a block, modeless dialog. - // *TODO: Translate + //*TODO: Translate args["MESSAGE"] = message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } break; case IM_GROUP_NOTICE: @@ -2493,6 +2495,26 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) break; } + // The group notice packet does not have an AgentID. Obtain one from the name cache. + // If last name is "Resident" strip it out so the cache name lookup works. + U32 index = original_name.find(" Resident"); + if (index != std::string::npos) + { + original_name = original_name.substr(0, index); + } + std::string legacy_name = gCacheName->buildLegacyName(original_name); + LLUUID agent_id; + gCacheName->getUUID(legacy_name, agent_id); + + if (agent_id.isNull()) + { + LL_WARNS("Messaging") << "buildLegacyName returned null while processing " << original_name << LL_ENDL; + } + else if (LLMuteList::getInstance()->isMuted(agent_id)) + { + break; + } + notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0]; U8 has_inventory = notice_bin_bucket->header.has_inventory; U8 asset_type = notice_bin_bucket->header.asset_type; @@ -2565,27 +2587,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) break; case IM_GROUP_INVITATION: { - // Read the binary bucket for more information. - struct invite_bucket_t - { - S32 membership_fee; - LLUUID role_id; - }* invite_bucket; - - // Make sure the binary bucket is the correct size. - if (binary_bucket_size != sizeof(invite_bucket_t)) - { - LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL; - break; - } - - invite_bucket = (struct invite_bucket_t*) &binary_bucket[0]; - S32 membership_fee = ntohl(invite_bucket->membership_fee); - // NaCl - Antispam - if(antispam || gSavedSettings.getBOOL("AntiSpamGroupInvites") || (membership_fee > 0 && gSavedSettings.getBOOL("AntiSpamGroupFeeInvites"))) + if (antispam || gSavedSettings.getBOOL("AntiSpamGroupInvites")) return; // NaCl End + //if (!is_linden && (is_busy || is_muted)) if ((is_busy || is_muted)) { @@ -2595,6 +2601,26 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) else { LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL; + // Read the binary bucket for more information. + struct invite_bucket_t + { + S32 membership_fee; + LLUUID role_id; + }* invite_bucket; + + // Make sure the binary bucket is the correct size. + if (binary_bucket_size != sizeof(invite_bucket_t)) + { + LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL; + break; + } + + invite_bucket = (struct invite_bucket_t*) &binary_bucket[0]; + S32 membership_fee = ntohl(invite_bucket->membership_fee); + // NaCl - Antispam + if (membership_fee > 0 && gSavedSettings.getBOOL("AntiSpamGroupFeeInvites")) + return; + // NaCl End LLSD payload; payload["transaction_id"] = session_id; @@ -2696,23 +2722,23 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_ACCEPTED: { +// args["NAME"] = name; // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b - bool fRlvObfuscate = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - (RlvUtil::isNearbyAgent(from_id)) && (!LLFloaterAvatarInfo::getInstance(from_id)); - args["NAME"] = (!fRlvObfuscate) ? name : RlvStrings::getAnonym(name); + bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && + (!LLFloaterAvatarInfo::getInstance(from_id)); + args["NAME"] = (!fRlvFilterName) ? name : RlvStrings::getAnonym(name); // [/RLVa:KB] - //args["NAME"] = name; LLNotificationsUtil::add("InventoryAccepted", args); break; } case IM_INVENTORY_DECLINED: { +// args["NAME"] = name; // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b - bool fRlvObfuscate = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - (RlvUtil::isNearbyAgent(from_id)) && (!LLFloaterAvatarInfo::getInstance(from_id)); - args["NAME"] = (!fRlvObfuscate) ? name : RlvStrings::getAnonym(name); + bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && + (!LLFloaterAvatarInfo::getInstance(from_id)); + args["NAME"] = (!fRlvFilterName) ? name : RlvStrings::getAnonym(name); // [/RLVa:KB] - //args["NAME"] = name; LLNotificationsUtil::add("InventoryDeclined", args); break; } @@ -2780,11 +2806,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); } buffer = separator_string + saved + message.substr(message_offset); - BOOL is_this_agent = FALSE; - if(from_id == gAgentID) - { - is_this_agent = TRUE; - } gIMMgr->addMessage( session_id, from_id, @@ -2809,7 +2830,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) prepend_msg = std::string("IM: "); } chat.mText = prepend_msg + name + separator_string + saved + message.substr(message_offset); - LLFloaterChat::addChat(chat, TRUE, is_this_agent); + LLFloaterChat::addChat(chat, TRUE, from_id == gAgentID); } break; @@ -2848,6 +2869,22 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id ^ gAgent.getSessionID(); } + chat.mSourceType = CHAT_SOURCE_OBJECT; + + // To conclude that the source type of message is CHAT_SOURCE_SYSTEM it's not + // enough to check only from name (i.e. fromName = "Second Life"). For example + // source type of messages from objects called "Second Life" should not be CHAT_SOURCE_SYSTEM. + bool chat_from_system = (SYSTEM_FROM == name) && region_id.isNull() && position.isNull(); + if(chat_from_system) + { + // System's UUID is NULL (fixes EXT-4766) + chat.mFromID = LLUUID::null; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + } + + // IDEVO Some messages have embedded resident names + message = clean_name_from_task_im(message, from_group); + std::ostringstream link; link << "secondlife:///app/objectim/" << session_id << LLURI::mapToQueryString(query_string); @@ -2857,7 +2894,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because // IMs from objcts don't open IM sessions. - chat.mSourceType = CHAT_SOURCE_OBJECT; LLFloaterChat::addChat(chat, FALSE, FALSE); } break; @@ -3479,12 +3515,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // if (chat.mSourceType == CHAT_SOURCE_OBJECT // && chat.mChatType != CHAT_TYPE_DEBUG_MSG // && gSavedSettings.getBOOL("EffectScriptChatParticles") ) -// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-10 (RLVa-1.0.0g) - // Don't show swirly things for llOwnerSay() chat here because we handle those further down - // RELEASE-RLVa: if this code changes, remember to change the code down below as well - if ( (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mChatType != CHAT_TYPE_DEBUG_MSG) && - (gSavedSettings.getBOOL("EffectScriptChatParticles")) && - (CHAT_TYPE_OWNER != chat.mChatType) ) +// [RLVa:KB] - Checked: 2010-03-09 (RLVa-1.2.0b) | Modified: RLVa-1.0.0g + if ( ((chat.mSourceType == CHAT_SOURCE_OBJECT) && (chat.mChatType != CHAT_TYPE_DEBUG_MSG)) && + (gSavedSettings.getBOOL("EffectScriptChatParticles")) && + ((!rlv_handler_t::isEnabled()) || (CHAT_TYPE_OWNER != chat.mChatType)) ) // [/RLVa:KB] { LLPointer psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); @@ -3838,11 +3872,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if(SHCommandHandler::handleCommand(false,mesg,from_id,chatter)) return; #endif //shy_mod -// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-10 (RLVa-1.0.0g) +// [RLVa:KB] - Checked: 2010-03-09 (RLVa-1.2.0b) | Modified: RLVa-1.0.0g // Copy/paste from above - if ( chatter && (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mChatType != CHAT_TYPE_DEBUG_MSG) && - (gSavedSettings.getBOOL("EffectScriptChatParticles")) && - (CHAT_TYPE_OWNER != chat.mChatType) ) + if ( (rlv_handler_t::isEnabled()) && (chatter) && (chat.mSourceType == CHAT_SOURCE_OBJECT) && + (gSavedSettings.getBOOL("EffectScriptChatParticles")) ) { LLPointer psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); psc->setSourceObject(chatter); @@ -3854,8 +3887,8 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } // [/RLVa:KB] case CHAT_TYPE_DEBUG_MSG: - case CHAT_TYPE_DIRECT: // llRegionSayTo() case CHAT_TYPE_NORMAL: + case CHAT_TYPE_DIRECT: verb = ": "; break; case CHAT_TYPE_SHOUT: @@ -3906,8 +3939,8 @@ void process_teleport_start(LLMessageSystem *msg, void**) LL_DEBUGS("Messaging") << "Got TeleportStart with TeleportFlags=" << teleport_flags << ". gTeleportDisplay: " << gTeleportDisplay << ", gAgent.mTeleportState: " << gAgent.getTeleportState() << LL_ENDL; - //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) -// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b +// if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) +// [RLVa:KB] - Checked: 2010-04-07 (RLVa-1.2.0d) | Added: RLVa-0.2.0b if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) ) // [/RLVa:KB] { @@ -3946,8 +3979,8 @@ void process_teleport_progress(LLMessageSystem* msg, void**) } U32 teleport_flags = 0x0; msg->getU32("Info", "TeleportFlags", teleport_flags); - //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) -// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b +// if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) +// [RLVa:KB] - Checked: 2010-04-07 (RLVa-1.2.0d) | Added: RLVa-0.2.0b if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) ) // [/RLVa:KB] { @@ -4148,7 +4181,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) gAgent.setRegion(regionp); gObjectList.shiftObjects(shift_vector); - if (gAgentAvatarp) + if (isAgentAvatarValid()) { gAgentAvatarp->clearChatText(); gAgentCamera.slamLookAt(look_at); @@ -4464,8 +4497,6 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) return; } - if(gAgent.getPhantom()) return; //Don't want to do this while phantom - // We have already requested to log out. Don't send agent updates. if(LLAppViewer::instance()->logoutRequestSent()) { @@ -4554,6 +4585,8 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) head_rot_chg = dot(last_head_rot, head_rotation); + //static S32 msg_number = 0; // Used for diagnostic log messages + if (force_send || (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) || (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) || @@ -4562,19 +4595,20 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) control_flag_change != 0 || flag_change != 0) { - /* + /* Diagnotics to show why we send the AgentUpdate message. Also un-commment the msg_number code above and below this block + msg_number += 1; if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) { //LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL; - LL_INFOS("Messaging") << "head_rot_chg = " << head_rot_chg << LL_ENDL; + LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", head_rot_chg " << head_rot_chg << LL_ENDL; } if (cam_rot_chg.magVec() > ROTATION_THRESHOLD) { - LL_INFOS("Messaging") << "cam rot " << cam_rot_chg.magVec() << LL_ENDL; + LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam rot " << cam_rot_chg.magVec() << LL_ENDL; } if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) { - LL_INFOS("Messaging") << "cam center " << cam_center_chg.magVec() << LL_ENDL; + LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam center " << cam_center_chg.magVec() << LL_ENDL; } // if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD) // { @@ -4582,9 +4616,9 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) // } if (control_flag_change) { - LL_INFOS("Messaging") << "dcf = " << control_flag_change << LL_ENDL; + LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", dcf = " << control_flag_change << LL_ENDL; } - */ +*/ duplicate_count = 0; } @@ -4619,6 +4653,26 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) if (duplicate_count < DUP_MSGS && !gDisconnected) { + /* More diagnostics to count AgentUpdate messages + static S32 update_sec = 0; + static S32 update_count = 0; + static S32 max_update_count = 0; + S32 cur_sec = lltrunc( LLTimer::getTotalSeconds() ); + update_count += 1; + if (cur_sec != update_sec) + { + if (update_sec != 0) + { + update_sec = cur_sec; + //msg_number = 0; + max_update_count = llmax(max_update_count, update_count); + llinfos << "Sent " << update_count << " AgentUpdate messages per second, max is " << max_update_count << llendl; + } + update_sec = cur_sec; + update_count = 0; + } + */ + LLFastTimer t(FTM_AGENT_UPDATE_SEND); // Build the message msg->newMessageFast(_PREHASH_AgentUpdate); @@ -4836,8 +4890,7 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec); - //LL_DEBUGS("Messaging") << "time_synch() - " << sun_direction << ", " << sun_ang_velocity - // << ", " << phase << LL_ENDL; + LL_DEBUGS("Windlight Sync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; gSky.setSunPhase(phase); gSky.setSunTargetDirection(sun_direction, sun_ang_velocity); @@ -4916,7 +4969,7 @@ void process_sound_trigger(LLMessageSystem *msg, void **) if (object_id == owner_id && !gSavedSettings.getBOOL("EnableGestureSounds")) { // Don't mute own gestures, if they're not muted. - if(owner_id != gAgent.getID() || !gSavedSettings.getBOOL("EnableGestureSoundsSelf")) + if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableGestureSoundsSelf")) return; } @@ -5728,17 +5781,17 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) return; } - // Once the 'recent' container gets large enough, chop some - // off the beginning. - const U32 MAX_LOOKBACK = 30; - const S32 POP_FRONT_SIZE = 12; - if(recent.size() > MAX_LOOKBACK) - { - LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL; - recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE); - } - //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL; - recent.push_back(tid); + // Once the 'recent' container gets large enough, chop some + // off the beginning. + const U32 MAX_LOOKBACK = 30; + const S32 POP_FRONT_SIZE = 12; + if(recent.size() > MAX_LOOKBACK) + { + LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL; + recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE); + } + //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL; + recent.push_back(tid); if (msg->has("TransactionInfo")) { @@ -5961,14 +6014,14 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) bool handle_prompt_for_maturity_level_change_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - + if (0 == option) { // set the preference to the maturity of the region we're calling U8 preferredMaturity = static_cast(notification["payload"]["_region_access"].asInteger()); gSavedSettings.setU32("PreferredMaturity", static_cast(preferredMaturity)); } - + return false; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index fda306e0d..7b3d49d17 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -48,12 +48,10 @@ #include "llviewquery.h" #include "llxmltree.h" -//#include "llviewercamera.h" #include "llrender.h" #include "llvoiceclient.h" // for push-to-talk button handling - // // TODO: Many of these includes are unnecessary. Remove them. // @@ -67,7 +65,6 @@ #include "llrect.h" #include "llsky.h" #include "llstring.h" -#include "lltrans.h" #include "llui.h" #include "lluuid.h" #include "llview.h" @@ -137,8 +134,8 @@ #include "llpreviewtexture.h" #include "llprogressview.h" #include "llresmgr.h" -#include "llrootview.h" #include "llselectmgr.h" +#include "llrootview.h" #include "llrendersphere.h" #include "llstartup.h" #include "llstatusbar.h" @@ -164,6 +161,7 @@ #include "lltoolplacer.h" #include "lltoolselectland.h" #include "lltoolview.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llurldispatcher.h" // SLURL from other app instance #include "llvieweraudio.h" @@ -220,7 +218,6 @@ extern BOOL gDebugClicks; extern BOOL gDisplaySwapBuffers; extern BOOL gDepthDirty; extern BOOL gResizeScreenTexture; -extern S32 gJamesInt; LLViewerWindow *gViewerWindow = NULL; LLVelocityBar *gVelocityBar = NULL; @@ -292,14 +289,14 @@ private: line_list_t mLineList; LLColor4 mTextColor; -public: - LLDebugText(LLViewerWindow* window) : mWindow(window) {} - void addText(S32 x, S32 y, const std::string &text) { mLineList.push_back(Line(text, x, y)); } +public: + LLDebugText(LLViewerWindow* window) : mWindow(window) {} + void update() { std::string wind_vel_text; @@ -308,6 +305,14 @@ public: std::string rwind_vector_text; std::string audio_text; + static const std::string beacon_particle = LLTrans::getString("BeaconParticle"); + static const std::string beacon_physical = LLTrans::getString("BeaconPhysical"); + static const std::string beacon_scripted = LLTrans::getString("BeaconScripted"); + static const std::string beacon_scripted_touch = LLTrans::getString("BeaconScriptedTouch"); + static const std::string beacon_sound = LLTrans::getString("BeaconSound"); + static const std::string beacon_media = LLTrans::getString("BeaconMedia"); + static const std::string particle_hiding = LLTrans::getString("ParticleHiding"); + // Draw the statistics in a light gray // and in a thin font mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f ); @@ -330,18 +335,15 @@ public: addText(xpos, ypos, llformat("Texture: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc2; } - { F32 time = gFrameTimeSeconds; S32 hours = (S32)(time / (60*60)); S32 mins = (S32)((time - hours*(60*60)) / 60); S32 secs = (S32)((time - hours*(60*60) - mins*60)); addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc; } - } static const LLCachedControl analyze_target_texture("AnalyzeTargetTexture", false); if(analyze_target_texture) { - static LLViewerObject* lastObject = NULL; LLSelectNode* nodep = LLSelectMgr::instance().getPrimaryHoverNode(); LLObjectSelectionHandle handle = LLSelectMgr::instance().getHoverObjects(); if(nodep || handle.notNull()) @@ -387,6 +389,7 @@ public: ypos += y_inc; } #endif + if (gDisplayCameraPos) { std::string camera_view_text; @@ -581,7 +584,7 @@ public: ypos += y_inc; addText(xpos, ypos, llformat("%d Render Calls", gPipeline.mBatchCount)); - ypos += y_inc; + ypos += y_inc; addText(xpos, ypos, llformat("%d Matrix Ops", gPipeline.mMatrixOpCount)); ypos += y_inc; @@ -601,7 +604,7 @@ public: gPipeline.mMaxBatchSize = 0; gPipeline.mBatchCount = 0; } - ypos += y_inc; + ypos += y_inc; addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount)); @@ -692,7 +695,7 @@ public: } LLVertexBuffer::sBindCount = LLImageGL::sBindCount = - LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount = + LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount = gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0; } static const LLCachedControl debug_show_render_matrices("DebugShowRenderMatrices"); @@ -749,39 +752,44 @@ public: addText(xpos, ypos, llformat("Total Allocated(KB): %d", LLPrivateMemoryPoolManager::getInstance()->mTotalAllocatedSize / 1024)); ypos += y_inc; } + // only display these messages if we are actually rendering beacons at this moment static const LLCachedControl beacons_visible("BeaconsVisible",false); if (LLPipeline::getRenderBeacons(NULL) && beacons_visible) { + if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES)) + { + addText(xpos, ypos, particle_hiding); + ypos += y_inc; + } + if (LLPipeline::getRenderParticleBeacons(NULL)) { addText(xpos, ypos, "Viewing particle beacons (blue)"); ypos += y_inc; } - if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES)) + + if (LLPipeline::getRenderSoundBeacons(NULL)) { - addText(xpos, ypos, "Hiding particles"); - ypos += y_inc; - } - if (LLPipeline::getRenderPhysicalBeacons(NULL)) - { - addText(xpos, ypos, "Viewing physical object beacons (green)"); + addText(xpos, ypos, "Viewing sound beacons (blue/cyan/green/yellow/red)"); ypos += y_inc; } + if (LLPipeline::getRenderScriptedBeacons(NULL)) { - addText(xpos, ypos, "Viewing scripted object beacons (red)"); + addText(xpos, ypos, beacon_scripted); ypos += y_inc; } else if (LLPipeline::getRenderScriptedTouchBeacons(NULL)) { - addText(xpos, ypos, "Viewing scripted object with touch function beacons (red)"); + addText(xpos, ypos, beacon_scripted_touch); ypos += y_inc; } - if (LLPipeline::getRenderSoundBeacons(NULL)) + + if (LLPipeline::getRenderPhysicalBeacons(NULL)) { - addText(xpos, ypos, "Viewing sound beacons (blue/cyan/green/yellow/red)"); + addText(xpos, ypos, "Viewing physical object beacons (green)"); ypos += y_inc; } } @@ -838,9 +846,13 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK y = llround((F32)y / mDisplayScale.mV[VY]); if (down) + { buttonstatestr = "down"; + } else + { buttonstatestr = "up"; + } switch (clicktype) { @@ -875,7 +887,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; } - // Make sure we get a coresponding mouseup event, even if the mouse leaves the window + // Make sure we get a corresponding mouseup event, even if the mouse leaves the window if (down) { mWindow->captureMouse(); @@ -929,15 +941,15 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK if (down) { - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } + if (top_ctrl->pointInView(local_x, local_y)) + { + return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; + } + else + { + gFocusMgr.setTopCtrl(NULL); + } + } else handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); } @@ -958,38 +970,38 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK if (down) { - // Do not allow tool manager to handle mouseclicks if we have disconnected - if (gDisconnected) - { - return FALSE; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } + // Do not allow tool manager to handle mouseclicks if we have disconnected + if (gDisconnected) + { + return FALSE; + } + + if (LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) + { + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } } else { - mWindow->releaseMouse(); + mWindow->releaseMouse(); - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); if( !handled ) - { + { handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down); - } + } if( !handled ) - { + { if (tool) - { + { handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down); - } - } + } + } } return (!down); @@ -1006,7 +1018,7 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma // try handling as a double-click first, then a single-click if that // wasn't handled. BOOL down = TRUE; - return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) || + return handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_DOUBLELEFT, down) || handleMouseDown(window, pos, mask); } @@ -1020,16 +1032,17 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { //From Phoenix - gSavedSettings.setBOOL("zmm_rightmousedown",1); - if(gAgentCamera.cameraMouselook()&&gSavedSettings.getBOOL("zmm_isinml")==0) + // Singu TODO: Change these from debug settings to externs? + gSavedSettings.setBOOL("zmm_rightmousedown", true); + if (gAgentCamera.cameraMouselook() && !gSavedSettings.getBOOL("zmm_isinml")) { llinfos << "zmmisinml set to true" << llendl; - gSavedSettings.setBOOL("zmm_isinml",1); - F32 deffov=LLViewerCamera::getInstance()->getDefaultFOV(); - gSavedSettings.setF32("zmm_deffov",deffov); - LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("zmm_deffov")/gSavedSettings.getF32("zmm_mlfov")); + gSavedSettings.setBOOL("zmm_isinml", true); + F32 deffov = LLViewerCamera::getInstance()->getDefaultFOV(); + gSavedSettings.setF32("zmm_deffov", deffov); + LLViewerCamera::getInstance()->setDefaultFOV(deffov/gSavedSettings.getF32("zmm_mlfov")); } - + S32 x = pos.mX; S32 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); @@ -1042,7 +1055,6 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK if (handle) return handle; - // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() && LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance()) @@ -1059,14 +1071,14 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - gSavedSettings.setBOOL("zmm_rightmousedown",0); + gSavedSettings.setBOOL("zmm_rightmousedown", false); if(gSavedSettings.getBOOL("zmm_isinml")==1) { llinfos << "zmmisinml set to false" << llendl; gSavedSettings.setBOOL("zmm_isinml",0); LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("zmm_deffov")); - } - + } + BOOL down = FALSE; return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } @@ -1111,12 +1123,11 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask { gMouseIdleTimer.reset(); } + saveLastMouse(mouse_point); BOOL mouse_actually_moved = !gFocusMgr.getMouseCapture() && // mouse is not currenty captured ((prev_saved_mouse_point.mX != mCurrentMousePoint.mX) || (prev_saved_mouse_point.mY != mCurrentMousePoint.mY)); // mouse moved from last recorded position - - mWindow->showCursorFromMouseMove(); if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME @@ -1269,7 +1280,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) { if (activated) { - mActive = TRUE; + mActive = true; send_agent_resume(); gAgent.clearAFK(); if (mWindow->getFullscreen() && !mIgnoreActivate) @@ -1299,7 +1310,8 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) } else { - mActive = FALSE; + mActive = false; + if (gSavedSettings.getBOOL("AllowIdleAFK")) { gAgent.setAFK(); @@ -1485,9 +1497,8 @@ LLViewerWindow::LLViewerWindow( S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth) - : - mWindow(NULL), - mActive(TRUE), +: mWindow(NULL), + mActive(true), mWantFullscreen(fullscreen), mShowFullscreenProgress(FALSE), mWindowRectRaw(0, height, width, 0), @@ -1553,7 +1564,7 @@ LLViewerWindow::LLViewerWindow( LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings" << LL_ENDL; #endif - LLAppViewer::instance()->fastQuit(1); + LLAppViewer::instance()->fastQuit(1); } if (!LLAppViewer::instance()->restoreErrorTrap()) @@ -1562,15 +1573,15 @@ LLViewerWindow::LLViewerWindow( } LLCoordScreen scr; - mWindow->getSize(&scr); + mWindow->getSize(&scr); - if(fullscreen && ( scr.mX!=width || scr.mY!=height)) - { + if(fullscreen && ( scr.mX!=width || scr.mY!=height)) + { llwarns << "Fullscreen has forced us in to a different resolution now using "<setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM); - mRootView->addChild(gConsole); + getRootView()->addChild(gConsole); // Debug view over the console gDebugView = new LLDebugView("gDebugView", full_window); @@ -1896,7 +1907,7 @@ void LLViewerWindow::adjustRectanglesForFirstUse(const LLRect& window) adjust_rect_top_left("FloaterGestureRect2", window); adjust_rect_top_right("FloaterMiniMapRect", window); - + adjust_rect_top_right("FloaterLagMeter", window); adjust_rect_top_left("FloaterBuildOptionsRect", window); @@ -1929,7 +1940,7 @@ void LLViewerWindow::adjustRectanglesForFirstUse(const LLRect& window) r.getHeight()); gSavedSettings.setRect("FloaterInventoryRect", r); } - + // adjust_rect_top_left("FloaterHUDRect2", window); // slightly off center to be left of the avatar. @@ -1972,7 +1983,7 @@ void LLViewerWindow::initWorldUI() gHoverView = new LLHoverView(std::string("gHoverView"), full_window); gHoverView->setVisible(TRUE); mRootView->addChild(gHoverView); - + gIMMgr = LLIMMgr::getInstance(); // @@ -1985,7 +1996,7 @@ void LLViewerWindow::initWorldUI() gFloaterTools = new LLFloaterTools(); gFloaterTools->setVisible(FALSE); } - + if ( gHUDView == NULL ) { LLRect hud_rect = full_window; @@ -2001,7 +2012,7 @@ void LLViewerWindow::initWorldUI() LLPanel* panel_ssf_container = getRootView()->getChild("state_management_buttons_container"); panel_ssf_container->setVisible(TRUE); - + LLMenuOptionPathfindingRebakeNavmesh::getInstance()->initialize(); } @@ -2073,10 +2084,12 @@ void LLViewerWindow::shutdownViews() { gMorphView->setVisible(FALSE); } + llinfos << "Global views cleaned." << llendl ; // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open // will crump with LL_ERRS. LLModalDialog::shutdownModals(); + llinfos << "LLModalDialog shut down." << llendl; // Delete all child views. delete mRootView; @@ -2138,8 +2151,6 @@ void LLViewerWindow::shutdownGL() llinfos << "Cleaning up select manager" << llendl; LLSelectMgr::getInstance()->cleanup(); - - llinfos << "Stopping GL during shutdown" << llendl; if (!gNoRender) { @@ -2299,10 +2310,10 @@ void LLViewerWindow::reshape(S32 width, S32 height) // Hide normal UI when a logon fails void LLViewerWindow::setNormalControlsVisible( BOOL visible ) { - if ( gBottomPanel ) + if (gBottomPanel) { - gBottomPanel->setVisible( visible ); - gBottomPanel->setEnabled( visible ); + gBottomPanel->setVisible(visible); + gBottomPanel->setEnabled(visible); } if ( gMenuBarView ) @@ -2314,7 +2325,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT, LLViewerLogin::getInstance()->isInProductionGrid()); } - + if ( gStatusBar ) { gStatusBar->setVisible( visible ); @@ -2324,35 +2335,35 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) { - LLSD args; - LLColor4 new_bg_color; + LLSD args; + LLColor4 new_bg_color; - if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) - { - new_bg_color = gColors.getColor( "MenuBarGodBgColor" ); - } - else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid()) - { - new_bg_color = gColors.getColor( "MenuNonProductionGodBgColor" ); - } - else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid()) - { - new_bg_color = gColors.getColor( "MenuNonProductionBgColor" ); - } - else - { - new_bg_color = gColors.getColor( "MenuBarBgColor" ); - } + if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) + { + new_bg_color = gColors.getColor( "MenuBarGodBgColor" ); + } + else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid()) + { + new_bg_color = gColors.getColor( "MenuNonProductionGodBgColor" ); + } + else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid()) + { + new_bg_color = gColors.getColor( "MenuNonProductionBgColor" ); + } + else + { + new_bg_color = gColors.getColor( "MenuBarBgColor" ); + } - if(gMenuBarView) - { - gMenuBarView->setBackgroundColor( new_bg_color ); - } + if(gMenuBarView) + { + gMenuBarView->setBackgroundColor( new_bg_color ); + } - if(gStatusBar) - { - gStatusBar->setBackgroundColor( new_bg_color ); - } + if(gStatusBar) + { + gStatusBar->setBackgroundColor( new_bg_color ); + } } void LLViewerWindow::drawDebugText() @@ -2369,6 +2380,7 @@ void LLViewerWindow::drawDebugText() mDebugText->draw(); } gGL.popMatrix(); + gGL.flush(); if (LLGLSLShader::sNoFixedFunction) { @@ -2420,6 +2432,7 @@ void LLViewerWindow::draw() { gUIProgram.bind(); } + gGL.pushMatrix(); { @@ -2467,7 +2480,7 @@ void LLViewerWindow::draw() gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); - LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f); + LLUI::translate( (F32) screen_x, (F32) screen_y); if(gDebugGL)check_blend_funcs(); top_ctrl->draw(); if(gDebugGL)check_blend_funcs(); @@ -2543,7 +2556,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) && !gFocusMgr.getKeystrokesOnly()) { // We have keyboard focus, and it's not an accelerator - if (key < 0x80) { // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first. @@ -2585,9 +2597,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Debugging view for unified notifications: CTRL-SHIFT-5 // *FIXME: Having this special-cased right here (just so this can be invoked from the login screen) sucks. if ((MASK_SHIFT & mask) - && (!(MASK_ALT & mask)) - && (MASK_CONTROL & mask) - && ('5' == key)) + && (!(MASK_ALT & mask)) + && (MASK_CONTROL & mask) + && ('5' == key)) { LLFloaterNotificationConsole::showInstance(); return TRUE; @@ -2631,35 +2643,36 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // arrow keys move avatar while chatting hack if (gChatBar && gChatBar->inputEditorHasFocus()) { - if (gChatBar->getCurrentChat().empty() || gSavedSettings.getBOOL("ArrowKeysMoveAvatar")) + // If text field is empty, there's no point in trying to move + // cursor with arrow keys, so allow movement + if (gChatBar->getCurrentChat().empty() + || gSavedSettings.getBOOL("ArrowKeysMoveAvatar")) { - switch(key) + // Singu Note: We do this differently from LL to preserve the Ctrl- behavior in the chatbar + // let Control-Up and Control-Down through for chat line history, + //if (!(key == KEY_UP && mask == MASK_CONTROL) + // && !(key == KEY_DOWN && mask == MASK_CONTROL)) { - case KEY_LEFT: - case KEY_RIGHT: - case KEY_UP: - // let CTRL UP through for chat line history - if( MASK_CONTROL == mask ) + switch(key) { + case KEY_LEFT: + case KEY_RIGHT: + case KEY_UP: + case KEY_DOWN: + if (mask == MASK_CONTROL) + break; + case KEY_PAGE_UP: + case KEY_PAGE_DOWN: + case KEY_HOME: + // when chatbar is empty or ArrowKeysMoveAvatar set, + //pass arrow keys on to avatar... + return FALSE; + default: break; } - case KEY_DOWN: - // let CTRL DOWN through for chat line history - if( MASK_CONTROL == mask ) - { - break; - } - case KEY_PAGE_UP: - case KEY_PAGE_DOWN: - case KEY_HOME: - // when chatbar is empty or ArrowKeysMoveAvatar set, pass arrow keys on to avatar... - return FALSE; - default: - break; } } } - if (keyboard_focus->handleKey(key, mask, FALSE)) { return TRUE; @@ -2721,13 +2734,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } // give menus a chance to handle keys - if (gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) - { - return TRUE; - } - - // give menus a chance to handle keys - if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)) + if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) + ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) { return TRUE; } @@ -2991,7 +2999,7 @@ void LLViewerWindow::updateUI() if( !handled ) { - lldebugst(LLERR_USER_INPUT) << "hover not handled by top view or root" << llendl; + lldebugst(LLERR_USER_INPUT) << "hover not handled by top view or root" << llendl; } } @@ -3025,7 +3033,7 @@ void LLViewerWindow::updateUI() } - // Show a new tool tip (or update one that is alrady shown) + // Show a new tool tip (or update one that is already shown) BOOL tool_tip_handled = FALSE; std::string tool_tip_msg; static const LLCachedControl tool_tip_delay("ToolTipDelay",.7f); @@ -3038,8 +3046,8 @@ void LLViewerWindow::updateUI() tooltip_delay = drag_and_drop_tool_tip_delay; } if( handled && - gMouseIdleTimer.getElapsedTimeF32() > tooltip_delay && - !mWindow->isCursorHidden() ) + gMouseIdleTimer.getElapsedTimeF32() > tooltip_delay && + !mWindow->isCursorHidden() ) { LLRect screen_sticky_rect; LLMouseHandler *mh; @@ -3064,7 +3072,7 @@ void LLViewerWindow::updateUI() if (shouldShowToolTipFor(mh)) { tool_tip_handled = mh->handleToolTip(local_x, local_y, tool_tip_msg, &screen_sticky_rect ); - + if( tool_tip_handled && !tool_tip_msg.empty() ) { mToolTipStickyRect = screen_sticky_rect; @@ -3081,8 +3089,8 @@ void LLViewerWindow::updateUI() { mToolTip->setVisible( tooltip_vis ); } - } - + } + static const LLCachedControl freeze_time("FreezeTime",0); if (tool && tool != gToolNull && tool != LLToolCompInspect::getInstance() && tool != LLToolDragAndDrop::getInstance() && !freeze_time) { @@ -3090,8 +3098,8 @@ void LLViewerWindow::updateUI() // With the null, inspect, or drag and drop tool, don't muck // with visibility. - if (gFloaterTools->isMinimized() || - (tool != LLToolPie::getInstance() // not default tool + if (gFloaterTools->isMinimized() + || (tool != LLToolPie::getInstance() // not default tool && tool != LLToolCompGun::getInstance() // not coming out of mouselook && !mSuppressToolbox // not override in third person && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode @@ -3245,8 +3253,6 @@ void LLViewerWindow::updateUI() LLSelectMgr::getInstance()->deselectUnused(); } - - // per frame picking - for tooltips and changing cursor over interactive objects static S32 previous_x = -1; static S32 previous_y = -1; @@ -3270,17 +3276,15 @@ void LLViewerWindow::updateUI() previous_x = x; previous_y = y; - + return; } - /* static */ void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info) { gViewerWindow->mHoverPick = pick_info; } - void LLViewerWindow::updateMouseDelta() { @@ -3322,7 +3326,7 @@ void LLViewerWindow::updateMouseDelta() mCurrentMouseDelta.set(dx, dy); mouse_vel.setVec((F32) dx, (F32) dy); } - + mMouseVelocityStat.addValue(mouse_vel.magVec()); } @@ -3590,7 +3594,7 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback { return; } - + // push back pick info object BOOL in_build_mode = gFloaterTools && gFloaterTools->getVisible(); if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha) @@ -3767,7 +3771,6 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de found = this_object; } } - else // is a world object { if (this_object->lineSegmentIntersect(mouse_world_start, mouse_world_end, this_face, pick_transparent, @@ -3777,7 +3780,6 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de } } } - else // check ALL objects { found = gPipeline.lineSegmentIntersectInHUD(mouse_hud_start, mouse_hud_end, pick_transparent, @@ -4058,7 +4060,7 @@ void LLViewerWindow::saveImageNumbered(LLPointer image, int in pick_type = FFSAVE_ALL; // ??? // Get a base file location if needed. - if ( ! isSnapshotLocSet()) + if (!isSnapshotLocSet()) { std::string proposed_name( sSnapshotBaseName ); @@ -4209,7 +4211,7 @@ void LLViewerWindow::playSnapshotAnimAndSound() BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) { return rawSnapshot(raw, preview_width, preview_height, (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw(), show_ui, do_rebuild, type); - + // *TODO below code was broken in deferred pipeline /* if ((!raw) || preview_width < 10 || preview_height < 10) @@ -4241,14 +4243,14 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p S32 render_name = gSavedSettings.getS32("RenderName"); gSavedSettings.setS32("RenderName", 0); LLVOAvatar::updateFreezeCounter(1) ; //pause avatar updating for one frame - + S32 w = preview_width ; S32 h = preview_height ; LLVector2 display_scale = mDisplayScale ; mDisplayScale.setVec((F32)w / mWindowRectRaw.getWidth(), (F32)h / mWindowRectRaw.getHeight()) ; LLRect window_rect = mWindowRect; mWindowRectRaw.set(0, h, w, 0); - + gDisplaySwapBuffers = FALSE; gDepthDirty = TRUE; glClearColor(0.f, 0.f, 0.f, 0.f); @@ -4272,7 +4274,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p if(SNAPSHOT_TYPE_DEPTH == type) { glpixel_length = 4 ; - glformat = GL_DEPTH_COMPONENT ; + glformat = GL_DEPTH_COMPONENT ; gltype = GL_FLOAT ; } else @@ -4297,9 +4299,9 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p for(S32 x = 0 ; x < w ; x++) { S32 i = (w * y + x) << 2 ; - + F32 depth_float_i = *(F32*)(raw->getData() + i); - + F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float_i * depth_conversion_factor_2)); U8 depth_byte = F32_to_U8(linear_depth_float, camerap->getNear(), camerap->getFar()); *(raw->getData() + i + 0) = depth_byte; @@ -4307,13 +4309,13 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p *(raw->getData() + i + 2) = depth_byte; *(raw->getData() + i + 3) = 255; } - } + } } LLFontGL::setFontDisplay(TRUE) ; LLHUDText::setDisplayText(TRUE) ; mDisplayScale.setVec(display_scale) ; - mWindowRect = window_rect; + mWindowRect = window_rect; setup3DRender(); setupViewport(); gDisplaySwapBuffers = FALSE; @@ -4341,9 +4343,9 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p // objects on them. gPipeline.resetDrawOrders(); } - - gSavedSettings.setS32("RenderName", render_name); - + + gSavedSettings.setS32("RenderName", render_name); + return TRUE;*/ } @@ -4422,7 +4424,7 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI); } } - + S32 buffer_x_offset = 0; S32 buffer_y_offset = 0; F32 scale_factor = 1.0f; @@ -4462,7 +4464,6 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, } } - // ratio is the ratio snapshot/image', where image' is a rectangle with aspect snapshot_aspect that precisely contains image. // Thus image_width' / image_height' == aspect ==> snapshot_width / image_width' == snapshot_height / image_height'. // Since image' precisely contains image, one of them is equal (ie, image_height' = image_height) and the other is larger @@ -4502,7 +4503,6 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, // Done. break; } - // Center the buffer. buffer_x_offset = llfloor(((window_width - unscaled_image_buffer_x) * scale_factor) / 2.f); @@ -4667,7 +4667,7 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, // objects on them. gPipeline.resetDrawOrders(); } - + if (reset_deferred) { mWindowRectRaw = window_rect; @@ -4767,7 +4767,7 @@ void LLViewerWindow::drawMouselookInstructions() gGL.color4f( 0.9f, 0.9f, 0.9f, alpha ); gl_rect_2d( instructions_rect ); } - + font->renderUTF8( instructions, 0, instructions_rect.mLeft + INSTRUCTIONS_PAD, @@ -4844,7 +4844,6 @@ void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset) } - void LLViewerWindow::setShowProgress(const BOOL show) { if (mProgressView) @@ -4853,15 +4852,12 @@ void LLViewerWindow::setShowProgress(const BOOL show) } } - - - void LLViewerWindow::moveProgressViewToFront() { - if( mProgressView && mRootView ) + if (mProgressView && mRootView) { - mRootView->removeChild( mProgressView ); - mRootView->addChild( mProgressView ); + mRootView->removeChild(mProgressView); + mRootView->addChild(mProgressView); } } @@ -5033,6 +5029,7 @@ void LLViewerWindow::initFonts(F32 zoom_factor) return; LLFontGL::destroyAllGL(); // Initialize with possibly different zoom factor + LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), mDisplayScale.mV[VX] * zoom_factor, mDisplayScale.mV[VY] * zoom_factor, @@ -5053,7 +5050,7 @@ void LLViewerWindow::toggleFullscreen(BOOL show_progress) void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height) const { fullscreen = mWantFullscreen; - + if (mWindow && mWindow->getFullscreen() == mWantFullscreen) { @@ -5102,7 +5099,7 @@ BOOL LLViewerWindow::checkSettings() { getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio")); } - + reshape(getWindowWidthRaw(), getWindowHeightRaw()); // force aspect ratio @@ -5113,7 +5110,7 @@ BOOL LLViewerWindow::checkSettings() mResDirty = false; } - + BOOL is_fullscreen = mWindow->getFullscreen(); if(mWantFullscreen) { @@ -5122,14 +5119,14 @@ BOOL LLViewerWindow::checkSettings() gSavedSettings.getS32("FullScreenHeight")); getWindow()->getSize(&screen_size); if(!is_fullscreen || - screen_size.mX != desired_screen_size.mX + screen_size.mX != desired_screen_size.mX || screen_size.mY != desired_screen_size.mY) { if (!LLStartUp::canGoFullscreen()) { return FALSE; } - + LLGLState::checkStates(); LLGLState::checkTextureChannels(); changeDisplaySettings(TRUE, @@ -5240,7 +5237,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, new_pos.mX = gSavedSettings.getS32("WindowX"); new_pos.mY = gSavedSettings.getS32("WindowY"); } - + mWindow->setFSAASamples(fsaa); result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync, &new_pos); @@ -5280,6 +5277,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, } BOOL success = result_first_try || result_second_try; + if (success) { #if LL_WINDOWS @@ -5321,7 +5319,7 @@ F32 LLViewerWindow::getDisplayAspectRatio() const { if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio")) { - return mWindow->getNativeAspectRatio(); + return mWindow->getNativeAspectRatio(); } else { @@ -5360,7 +5358,7 @@ void LLViewerWindow::calcDisplayScale() display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRectRaw.getWidth()); display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRectRaw.getHeight()); } - + if (display_scale != mDisplayScale) { llinfos << "Setting display scale to " << display_scale << llendl; @@ -5374,7 +5372,8 @@ void LLViewerWindow::calcDisplayScale() S32 LLViewerWindow::getChatConsoleBottomPad() { S32 offset = 0; - if( gToolBar && gToolBar->getVisible() ) + + if(gToolBar && gToolBar->getVisible()) offset += TOOL_BAR_HEIGHT; return offset; @@ -5394,8 +5393,9 @@ LLRect LLViewerWindow::getChatConsoleRect() console_rect.mLeft += CONSOLE_PADDING_LEFT; - static const LLCachedControl chat_full_width("ChatFullWidth",true); - if (chat_full_width) + static const LLCachedControl CHAT_FULL_WIDTH("ChatFullWidth",true); + + if (CHAT_FULL_WIDTH) { console_rect.mRight -= CONSOLE_PADDING_RIGHT; } @@ -5447,7 +5447,7 @@ LLBottomPanel::LLBottomPanel(const LLRect &rect) : mFactoryMap["toolbar"] = LLCallbackMap(createToolBar, NULL); mFactoryMap["overlay"] = LLCallbackMap(createOverlayBar, NULL); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_bars.xml", &getFactoryMap()); - + setOrigin(rect.mLeft, rect.mBottom); reshape(rect.getWidth(), rect.getHeight()); } @@ -5482,6 +5482,7 @@ void* LLBottomPanel::createToolBar(void* data) return gToolBar; } +//////////////////////////////////////////////////////////////////////////// // // LLPickInfo // @@ -5632,7 +5633,7 @@ void LLPickInfo::getSurfaceInfo() mObjectFace = -1; mUVCoords = LLVector2(-1, -1); mSTCoords = LLVector2(-1, -1); - mXYCoords = LLCoordScreen(-1, -1); + mXYCoords = LLCoordScreen(-1, -1); mIntersection = LLVector3(0,0,0); mNormal = LLVector3(0,0,0); mBinormal = LLVector3(0,0,0); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 72e94c72c..1044f1f59 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -931,8 +931,6 @@ F32 LLVOAvatar::sLODFactor = 1.f; F32 LLVOAvatar::sPhysicsLODFactor = 1.f; BOOL LLVOAvatar::sUseImpostors = FALSE; BOOL LLVOAvatar::sJointDebug = FALSE; - - F32 LLVOAvatar::sUnbakedTime = 0.f; F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; F32 LLVOAvatar::sGreyTime = 0.f; @@ -2481,13 +2479,6 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) LLJoint::sNumUpdates = 0; LLJoint::sNumTouches = 0; - /*// *NOTE: this is necessary for the floating name text above your head. - // NOTE NOTE: This doesn't seem to be needed any more? - if (mDrawable && mDrawable.notNull()) - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_SHADOW, TRUE); - }*/ - BOOL visible = isVisible() || mNeedsAnimUpdate; // update attachments positions @@ -2930,7 +2921,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } return; } - + if (!mNameText) { mNameText = static_cast( LLHUDObject::addHUDObject( @@ -4939,31 +4930,6 @@ void LLVOAvatar::updateTextures() } } - /* - // JAMESDEBUG - if (isSelf()) - { - S32 null_count = 0; - S32 default_count = 0; - for (U32 i = 0; i < getNumTEs(); i++) - { - const LLTextureEntry* te = getTE(i); - if (te) - { - if (te->getID() == LLUUID::null) - { - null_count++; - } - else if (te->getID() == IMG_DEFAULT_AVATAR) - { - default_count++; - } - } - } - llinfos << "JAMESDEBUG my avatar TE null " << null_count << " default " << default_count << llendl; - } - */ - mMaxPixelArea = 0.f; mMinPixelArea = 99999999.f; mHasGrey = FALSE; // debug @@ -5240,10 +5206,7 @@ const LLUUID& LLVOAvatar::getStepSound() const //----------------------------------------------------------------------------- void LLVOAvatar::processAnimationStateChanges() { - if ((gNoRender)||(gAgent.isTPosed())) //isTPosed is meant to stop animation updates while force-TPosed. - { - return; - } + if (gNoRender) return; if ( isAnyAnimationSignaled(AGENT_WALK_ANIMS, NUM_AGENT_WALK_ANIMS) ) { @@ -6191,32 +6154,6 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o { LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object); - // testzone attachpt - if(!attachment) - { - llwarns << "Failed to find attachment." << llendl; - S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState()); - LLUUID item_id; - LLNameValue* item_id_nv = viewer_object->getNVPair("AttachItemID"); - if( item_id_nv ) - { - const char* s = item_id_nv->getString(); - if(s) - item_id.set(s); - } - if(!item_id.isNull()) - { - mUnsupportedAttachmentPoints[attachmentID] = std::pair(item_id,viewer_object->getID()); - if (viewer_object->isSelected()) - { - LLSelectMgr::getInstance()->updateSelectionCenter(); - LLSelectMgr::getInstance()->updatePointAt(); - } - } - else - llwarns << "No item ID" << llendl; - } - // if (!attachment || !attachment->addObject(viewer_object)) { return 0; @@ -6393,57 +6330,6 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) mPendingAttachment.erase(iter); return TRUE; } - - - // testzone attachpt - LLUUID item_id; - LLNameValue* item_id_nv = viewer_object->getNVPair("AttachItemID"); - if( item_id_nv ) - { - const char* s = item_id_nv->getString(); - if(s) - item_id.set(s); - } - if(!item_id.isNull()) - { - std::map >::iterator iter = mUnsupportedAttachmentPoints.begin(); - std::map >::iterator end = mUnsupportedAttachmentPoints.end(); - for( ; iter != end; ++iter) - { - if((*iter).second.first == item_id) - { - mUnsupportedAttachmentPoints.erase((*iter).first); - if (isSelf()) - { - // the simulator should automatically handle - // permission revocation - - stopMotionFromSource(viewer_object->getID()); - LLFollowCamMgr::setCameraActive(viewer_object->getID(), FALSE); - - LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren(); - for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++) - { - LLViewerObject* child_objectp = *iter; - // the simulator should automatically handle - // permissions revocation - - stopMotionFromSource(child_objectp->getID()); - LLFollowCamMgr::setCameraActive(child_objectp->getID(), FALSE); - } - // Then make sure the inventory is in sync with the avatar. - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - gInventory.notifyObservers(); - } - return TRUE; - } - } - llwarns << "Not found" << llendl; - } - else - llwarns << "No item ID" << llendl; - // return FALSE; } @@ -6687,19 +6573,6 @@ BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id ) return FALSE; } -// testzone attachpt -BOOL LLVOAvatar::isWearingUnsupportedAttachment( const LLUUID& inv_item_id ) -{ - std::map >::iterator end = mUnsupportedAttachmentPoints.end(); - for(std::map >::iterator iter = mUnsupportedAttachmentPoints.begin(); iter != end; ++iter) - { - if((*iter).second.first == inv_item_id) - { - return TRUE; - } - } - return FALSE; -} //----------------------------------------------------------------------------- // getWornAttachment() //----------------------------------------------------------------------------- @@ -6736,6 +6609,7 @@ const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) return LLStringUtil::null; } +// virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) { } @@ -7587,10 +7461,6 @@ LLBBox LLVOAvatar::getHUDBBox() const return bbox; } -void LLVOAvatar::rebuildHUD() -{ -} - //----------------------------------------------------------------------------- // onFirstTEMessageReceived() //----------------------------------------------------------------------------- @@ -8117,6 +7987,7 @@ void LLVOAvatar::getAnimNames( LLDynamicArray* names ) names->put( "enter_away_from_keyboard_state" ); } +// static void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) { if (!userdata) return; @@ -8210,7 +8081,7 @@ void LLVOAvatar::onInitialBakedTextureLoaded( BOOL success, LLViewerFetchedTextu { LLUUID *avatar_idp = (LLUUID *)userdata; LLVOAvatar *selfp = gObjectList.findAvatar(*avatar_idp); - + if (selfp) { LL_DEBUGS("Avatar") << selfp->avString() << "discard_level " << discard_level << " success " << success << " final " << final << LL_ENDL; @@ -8231,7 +8102,7 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - // llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; + LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL; LLUUID id = src_vi->getID(); LLUUID *avatar_idp = (LLUUID *)userdata; @@ -8261,7 +8132,6 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, // Called when baked texture is loaded and also when we start up with a baked texture void LLVOAvatar::useBakedTexture( const LLUUID& id ) { - for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { LLViewerTexture* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex, 0 ); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 6f622ff7e..b4f8f12f0 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -336,7 +336,6 @@ public: S32 mLastRezzedStatus; - void startPhase(const std::string& phase_name); void stopPhase(const std::string& phase_name, bool err_check = true); void clearPhases(); @@ -371,6 +370,7 @@ protected: /** State ** ** *******************************************************************************/ + /******************************************************************************** ** ** ** SKELETON @@ -755,7 +755,6 @@ public: public: BOOL hasHUDAttachment() const; LLBBox getHUDBBox() const; - void rebuildHUD(); void resetHUDAttachments(); BOOL canAttachMoreObjects() const; BOOL canAttachMoreObjects(U32 n) const; @@ -767,17 +766,10 @@ protected: //-------------------------------------------------------------------- public: BOOL isWearingAttachment( const LLUUID& inv_item_id ); - // testzone attachpt - BOOL isWearingUnsupportedAttachment( const LLUUID& inv_item_id ); - // LLViewerObject* getWornAttachment( const LLUUID& inv_item_id ); const std::string getAttachedPointName(const LLUUID& inv_item_id); - // - std::map > mUnsupportedAttachmentPoints; - // - /** Wearables ** ** *******************************************************************************/ diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index bd0a63ae2..49e9eba37 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -77,6 +77,9 @@ LLPointer gAgentAvatarp = NULL; +BOOL object_attached(void *user_data); +BOOL object_selected_and_point_valid(void *user_data); + BOOL isAgentAvatarValid() { return (gAgentAvatarp.notNull() && gAgentAvatarp->isValid() && diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 711406ea8..b237c2b0a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4732,11 +4732,6 @@ void LLPipeline::rebuildPools() } max_count--; } - - if (isAgentAvatarValid()) - { - gAgentAvatarp->rebuildHUD(); - } } void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) diff --git a/indra/newview/skins/default/xui/en-us/floater_snapshot.xml b/indra/newview/skins/default/xui/en-us/floater_snapshot.xml index cb9d8cfda..9e78bb6d3 100644 --- a/indra/newview/skins/default/xui/en-us/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en-us/floater_snapshot.xml @@ -1,71 +1,61 @@ - + File size: [SIZE] KB - + Target - - Post to my.secondlife.com feed + Post to profile feed Send via email - Save to my inventory ([UPLOADFEE]) + Save to inventory ([UPLOADFEE]) - Save to my hard drive + Save to hard drive -