diff --git a/indra/aistatemachine/aistatemachine.cpp b/indra/aistatemachine/aistatemachine.cpp index 4b7470e26..6903589f2 100644 --- a/indra/aistatemachine/aistatemachine.cpp +++ b/indra/aistatemachine/aistatemachine.cpp @@ -615,7 +615,7 @@ void AIStateMachine::multiplex(event_type event) // If the state is bs_multiplex we only need to run again when need_run was set again in the meantime or when this state machine isn't idle. need_new_run = sub_state_r->need_run || !sub_state_r->idle; // If this fails then the run state didn't change and neither idle() nor yield() was called. - llassert_always(!(need_new_run && !mYieldEngine && sub_state_r->run_state == run_state)); + llassert_always(!(need_new_run && !sub_state_r->skip_idle && !mYieldEngine && sub_state_r->run_state == run_state)); } break; case bs_abort: diff --git a/indra/aistatemachine/aistatemachinethread.cpp b/indra/aistatemachine/aistatemachinethread.cpp index f45d1e845..caeddea5c 100644 --- a/indra/aistatemachine/aistatemachinethread.cpp +++ b/indra/aistatemachine/aistatemachinethread.cpp @@ -101,7 +101,10 @@ void AIStateMachineThreadBase::multiplex_impl(state_type run_state) break; case wait_stopped: if (!mThread->isStopped()) + { + yield(); break; + } // We're done! // // We can only get here when AIThreadImpl::done called cont(), (very diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 1a0356a83..e8ce73f7d 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -103,10 +103,12 @@ if (LINUX) -pthread ) - # Don't catch SIGCHLD in our base application class for the viewer - # some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! - # The viewer doesn't need to catch SIGCHLD anyway. - add_definitions(-DLL_IGNORE_SIGCHLD) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_FORTIFY_SOURCE=2 ") + + # Don't catch SIGCHLD in our base application class for the viewer + # some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! + # The viewer doesn't need to catch SIGCHLD anyway. + add_definitions(-DLL_IGNORE_SIGCHLD) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") find_program(GXX g++) @@ -136,16 +138,6 @@ if (LINUX) OUTPUT_VARIABLE CXX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) - # Here's a giant hack for Fedora 8, where we can't use - # _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1. - if (${GXX_VERSION} STREQUAL ${CXX_VERSION}) - add_definitions(-D_FORTIFY_SOURCE=2) - else (${GXX_VERSION} STREQUAL ${CXX_VERSION}) - if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat") - add_definitions(-D_FORTIFY_SOURCE=2) - endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat") - endif (${GXX_VERSION} STREQUAL ${CXX_VERSION}) - #Lets actually get a numerical version of gxx's version STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" CXX_VERSION ${CXX_VERSION}) @@ -190,10 +182,6 @@ if (LINUX) set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -mfpmath=sse,387 -msse2 ${GCC_EXTRA_OPTIMIZATIONS}") endif (${ARCH} STREQUAL "x86_64") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_definitions( - -D_FORTIFY_SOURCE=2 - ) - if (NOT STANDALONE) # this stops us requiring a really recent glibc at runtime add_definitions(-fno-stack-protector) @@ -206,9 +194,6 @@ if (LINUX) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - add_definitions( - -D_FORTIFY_SOURCE=2 - ) if (NOT STANDALONE) # this stops us requiring a really recent glibc at runtime diff --git a/indra/libpathing/llpathinglib.cpp b/indra/libpathing/llpathinglib.cpp index 041311de9..19c0bff0f 100644 --- a/indra/libpathing/llpathinglib.cpp +++ b/indra/libpathing/llpathinglib.cpp @@ -1,3 +1,4 @@ +#include "sys.h" #include "llpathinglib.h" void LLPathingLib::initSystem() diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 44e0bdef8..c4704bf06 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -731,6 +731,7 @@ LLVisualParam* LLWearable::getVisualParam(S32 index) const void LLWearable::getVisualParams(visual_param_vec_t &list) { + list.reserve(mVisualParamIndexMap.size()); visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin(); visual_param_index_map_t::iterator end = mVisualParamIndexMap.end(); @@ -783,7 +784,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp) if (!avatarp) return; // Pull params - for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() ) + /*for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() ) { // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way. @@ -794,6 +795,12 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp) avatarp->setVisualParamWeight( param_id, weight, FALSE ); } + }*/ + for( visual_param_index_map_t::iterator it = mVisualParamIndexMap.begin(); it != mVisualParamIndexMap.end(); ++it ) + { + LLVisualParam* param = it->second; + if(!((LLViewerVisualParam*)param)->getCrossWearable()) + avatarp->setVisualParamWeight( param->getID(), param->getWeight(), FALSE ); } } diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index a20bd8faa..e3f54b60e 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -31,6 +31,7 @@ #include "llextendedstatus.h" #include "llpermissions.h" #include "llsaleinfo.h" +#include "llsortedvector.h" #include "llwearabletype.h" #include "lllocaltextureobject.h" @@ -136,10 +137,7 @@ protected: typedef std::map param_map_t; param_map_t mSavedVisualParamMap; // last saved version of visual params -public: - typedef std::map visual_param_index_map_t; - -protected: + typedef LLSortedVector visual_param_index_map_t; visual_param_index_map_t mVisualParamIndexMap; te_map_t mTEMap; // maps TE to LocalTextureObject diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index 4ade2b33a..61b45a94d 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -267,8 +267,7 @@ BOOL LLWearableData::isOnTop(LLWearable* wearable) const const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index) const { - //llassert_always(index == 0); - wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + /*wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) { return NULL; @@ -281,49 +280,79 @@ const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, else { return wearable_vec[index]; + }*/ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter != mWearableDatas.end() && index < wearable_iter->second.size()) + { + return wearable_iter->second[index]; } + return NULL; } LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) { - U32 count = getWearableCount(type); + /*U32 count = getWearableCount(type); if ( count == 0) { return NULL; } - return getWearable(type, count-1); + return getWearable(type, count-1);*/ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter != mWearableDatas.end() && !wearable_iter->second.empty()) + { + return wearable_iter->second.back(); + } + return NULL; } const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) const { - U32 count = getWearableCount(type); + /*U32 count = getWearableCount(type); if ( count == 0) { return NULL; } - return getWearable(type, count-1); + return getWearable(type, count-1);*/ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter != mWearableDatas.end() && !wearable_iter->second.empty()) + { + return wearable_iter->second.back(); + } + return NULL; } LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) { - if (getWearableCount(type) == 0) + /*if (getWearableCount(type) == 0) { return NULL; } - return getWearable(type, 0); + return getWearable(type, 0);*/ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter != mWearableDatas.end() && !wearable_iter->second.empty()) + { + return wearable_iter->second.front(); + } + return NULL; } const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) const { - if (getWearableCount(type) == 0) + /*if (getWearableCount(type) == 0) { return NULL; } - return getWearable(type, 0); + return getWearable(type, 0);*/ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter != mWearableDatas.end() && !wearable_iter->second.empty()) + { + return wearable_iter->second.front(); + } + return NULL; } U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h index 7c90dbde8..aeb9c1b26 100644 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -30,6 +30,7 @@ #include "llavatarappearancedefines.h" #include "llwearable.h" #include "llerror.h" +#include class LLAvatarAppearance; @@ -98,8 +99,34 @@ protected: protected: LLAvatarAppearance* mAvatarAppearance; typedef std::vector wearableentry_vec_t; // all wearables of a certain type (EG all shirts) - typedef std::map wearableentry_map_t; // wearable "categories" arranged by wearable type - wearableentry_map_t mWearableDatas; + //typedef std::map wearableentry_map_t; // wearable "categories" arranged by wearable type + + //Why this weird structure? LLWearableType::WT_COUNT small and known, therefore it's more efficient to make an array of vectors, indexed + //by wearable type. This allows O(1) lookups. This structure simply lets us plug in this optimization without touching any code elsewhere. + typedef boost::array,LLWearableType::WT_COUNT> wearable_array_t; + struct wearableentry_map_t : public wearable_array_t + { + wearableentry_map_t() + { + for(wearable_array_t::size_type i=0;i= (S32)size()) + return end(); + return begin() + index; + } + wearable_array_t::const_iterator find(const LLWearableType::EType& index) const + { + if(index < 0 || index >= (S32)size()) + return end(); + return begin() + index; + } + wearableentry_vec_t& operator [] (const S32 index) { return at(index).second; } + const wearableentry_vec_t& operator [] (const S32 index) const { return at(index).second; } + }; + wearableentry_map_t mWearableDatas; //Array for quicker lookups. }; diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 98587674c..558c929e1 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -368,7 +368,7 @@ void LLAudioEngine::idle(F32 max_decode_time) if (channelp) { channelp->updateBuffer(); - sourcep->getChannel()->play(); + channelp->play(); } continue; } @@ -391,8 +391,12 @@ void LLAudioEngine::idle(F32 max_decode_time) // Actually play the associated data. sourcep->setupChannel(); - channelp->updateBuffer(); - sourcep->getChannel()->play(); + channelp = sourcep->getChannel(); + if (channelp) + { + channelp->updateBuffer(); + channelp->play(); + } } else if (sourcep->isLoop()) { @@ -405,7 +409,12 @@ void LLAudioEngine::idle(F32 max_decode_time) // Actually, should do a time sync so if we're a loop master/slave // we don't drift away. sourcep->setupChannel(); - sourcep->getChannel()->play(); + channelp = sourcep->getChannel(); + if (channelp) + { + channelp->updateBuffer(); + channelp->play(); + } } } } @@ -597,6 +606,14 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer() lldebugs << "Taking over unused buffer " << buffer_id << llendl; //llinfos << "Flushing unused buffer!" << llendl; mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL; + for (U32 i = 0; i < MAX_CHANNELS; i++) + { + LLAudioChannel* channelp = mChannels[i]; + if(channelp && channelp->mCurrentBufferp == mBuffers[buffer_id]) + { + channelp->cleanup(); + } + } delete mBuffers[buffer_id]; mBuffers[buffer_id] = createBuffer(); return mBuffers[buffer_id]; @@ -1374,14 +1391,14 @@ void LLAudioSource::update() return ; //no need to update } - if (!getCurrentBuffer()) + //if (!getCurrentBuffer()) // Same as !adp->getBuffer() { LLAudioData *adp = getCurrentData(); - if (adp) + if (adp && !adp->getBuffer()) { // Hack - try and load the sound. Will do this as a callback // on decode later. - if (adp->load() && adp->getBuffer()) + if (adp->load()) { play(adp->getID()); } @@ -1847,8 +1864,8 @@ bool LLAudioData::load() if (!mBufferp) { // No free buffers, abort. - llinfos << "Not able to allocate a new audio buffer, aborting." << llendl; - return true; + lldebugs << "Not able to allocate a new audio buffer, aborting." << llendl; + return false; } std::string uuid_str; diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index cf44afee7..230168ee9 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -478,6 +478,7 @@ protected: class LLAudioBuffer { public: + LLAudioBuffer() : mInUse(true), mAudioDatap(NULL) { mLastUseTimer.reset(); } virtual ~LLAudioBuffer() {}; virtual bool loadWAV(const std::string& filename) = 0; virtual U32 getLength() = 0; diff --git a/indra/llaudio/llaudioengine_fmod.cpp b/indra/llaudio/llaudioengine_fmod.cpp index 168bb5f60..f47a6cac0 100644 --- a/indra/llaudio/llaudioengine_fmod.cpp +++ b/indra/llaudio/llaudioengine_fmod.cpp @@ -647,7 +647,7 @@ bool LLAudioChannelFMOD::isPlaying() // -LLAudioBufferFMOD::LLAudioBufferFMOD() +LLAudioBufferFMOD::LLAudioBufferFMOD() : LLAudioBuffer() { mSamplep = NULL; } diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index 4b4108701..56997a888 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -525,15 +525,16 @@ bool LLAudioChannelFMODEX::updateBuffer() } // If we have a source for the channel, we need to update its gain. - if (mCurrentSourcep) + if (mCurrentSourcep && mChannelp) { // SJB: warnings can spam and hurt framerate, disabling FMOD_RESULT result; - result = mChannelp->setVolume(getSecondaryGain() * mCurrentSourcep->getGain()); - //Check_FMOD_Error(result, "FMOD::Channel::setVolume"); + result = mChannelp->setVolume(getSecondaryGain() * mCurrentSourcep->getGain()); + Check_FMOD_Error(result, "FMOD::Channel::setVolume"); result = mChannelp->setMode(mCurrentSourcep->isLoop() ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); + Check_FMOD_Error(result, "FMOD::Channel::setMode"); /*if(Check_FMOD_Error(result, "FMOD::Channel::setMode")) { S32 index; @@ -595,7 +596,7 @@ void LLAudioChannelFMODEX::updateLoop() // yield false negatives. // U32 cur_pos; - mChannelp->getPosition(&cur_pos,FMOD_TIMEUNIT_PCMBYTES); + Check_FMOD_Error(mChannelp->getPosition(&cur_pos,FMOD_TIMEUNIT_PCMBYTES),"FMOD::Channel::getPosition"); if (cur_pos < (U32)mLastSamplePos) { @@ -629,12 +630,12 @@ void LLAudioChannelFMODEX::play() return; } - Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause"); + Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::setPaused"); getSource()->setPlayedOnce(true); if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]) - mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]); + Check_FMOD_Error(mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]),"FMOD::Channel::setChannelGroup"); } @@ -669,8 +670,8 @@ bool LLAudioChannelFMODEX::isPlaying() } bool paused, playing; - mChannelp->getPaused(&paused); - mChannelp->isPlaying(&playing); + Check_FMOD_Error(mChannelp->getPaused(&paused),"FMOD::Channel::getPaused"); + Check_FMOD_Error(mChannelp->isPlaying(&playing),"FMOD::Channel::isPlaying"); return !paused && playing; } @@ -680,7 +681,7 @@ bool LLAudioChannelFMODEX::isPlaying() // -LLAudioBufferFMODEX::LLAudioBufferFMODEX(FMOD::System *system) : mSystemp(system), mSoundp(NULL) +LLAudioBufferFMODEX::LLAudioBufferFMODEX(FMOD::System *system) : LLAudioBuffer(), mSystemp(system), mSoundp(NULL) { } @@ -689,7 +690,7 @@ LLAudioBufferFMODEX::~LLAudioBufferFMODEX() { if(mSoundp) { - mSoundp->release(); + Check_FMOD_Error(mSoundp->release(),"FMOD::Sound::Release"); mSoundp = NULL; } } @@ -714,7 +715,7 @@ bool LLAudioBufferFMODEX::loadWAV(const std::string& filename) if (mSoundp) { // If there's already something loaded in this buffer, clean it up. - mSoundp->release(); + Check_FMOD_Error(mSoundp->release(),"FMOD::Sound::release"); mSoundp = NULL; } @@ -757,7 +758,7 @@ U32 LLAudioBufferFMODEX::getLength() } U32 length; - mSoundp->getLength(&length, FMOD_TIMEUNIT_PCMBYTES); + Check_FMOD_Error(mSoundp->getLength(&length, FMOD_TIMEUNIT_PCMBYTES),"FMOD::Sound::getLength"); return length; } @@ -765,7 +766,7 @@ U32 LLAudioBufferFMODEX::getLength() void LLAudioChannelFMODEX::set3DMode(bool use3d) { FMOD_MODE current_mode; - if(mChannelp->getMode(¤t_mode) != FMOD_OK) + if(Check_FMOD_Error(mChannelp->getMode(¤t_mode),"FMOD::Channel::getMode")) return; FMOD_MODE new_mode = current_mode; new_mode &= ~(use3d ? FMOD_2D : FMOD_3D); @@ -773,7 +774,7 @@ void LLAudioChannelFMODEX::set3DMode(bool use3d) if(current_mode != new_mode) { - mChannelp->setMode(new_mode); + Check_FMOD_Error(mChannelp->setMode(new_mode),"FMOD::Channel::setMode"); } } diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 17c5d860f..1b2c8c6ee 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -314,7 +314,7 @@ void LLAudioChannelOpenAL::update3DPosition() alSourcef(mALSource, AL_GAIN, mCurrentSourcep->getGain() * getSecondaryGain()); } -LLAudioBufferOpenAL::LLAudioBufferOpenAL() +LLAudioBufferOpenAL::LLAudioBufferOpenAL() : LLAudioBuffer() { mALBuffer = AL_NONE; } diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp index 6f6973209..9e3e406c7 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.cpp +++ b/indra/llaudio/llstreamingaudio_fmodex.cpp @@ -107,10 +107,18 @@ void LLStreamingAudio_FMODEX::start(const std::string& url) if (!url.empty()) { - llinfos << "Starting internet stream: " << url << llendl; - mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,url); - mURL = url; - mMetaData = new LLSD; + if(mDeadStreams.empty()) + { + llinfos << "Starting internet stream: " << url << llendl; + mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,url); + mURL = url; + mMetaData = new LLSD; + } + else + { + llinfos << "Deferring stream load until buffer release: " << url << llendl; + mPendingURL = url; + } } else { @@ -139,6 +147,22 @@ void LLStreamingAudio_FMODEX::update() } } + if(!mDeadStreams.empty()) + { + llassert_always(mCurrentInternetStreamp == NULL); + return; + } + + if(!mPendingURL.empty()) + { + llassert_always(mCurrentInternetStreamp == NULL); + llinfos << "Starting internet stream: " << mPendingURL << llendl; + mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,mPendingURL); + mURL = mPendingURL; + mMetaData = new LLSD; + mPendingURL.clear(); + } + // Don't do anything if there are no streams playing if (!mCurrentInternetStreamp) { @@ -269,6 +293,8 @@ void LLStreamingAudio_FMODEX::update() void LLStreamingAudio_FMODEX::stop() { + mPendingURL.clear(); + if(mMetaData) { delete mMetaData; @@ -327,7 +353,7 @@ int LLStreamingAudio_FMODEX::isPlaying() { return 1; // Active and playing } - else if (!mURL.empty()) + else if (!mURL.empty() || !mPendingURL.empty()) { return 2; // "Paused" } @@ -439,8 +465,6 @@ bool LLAudioStreamManagerFMODEX::stopStream() { if (mInternetStream) { - - bool close = true; switch (getOpenState()) { @@ -455,9 +479,8 @@ bool LLAudioStreamManagerFMODEX::stopStream() close = true; } - if (close) + if (close && mInternetStream->release() == FMOD_OK) { - mInternetStream->release(); mStreamChannel = NULL; mInternetStream = NULL; return true; diff --git a/indra/llaudio/llstreamingaudio_fmodex.h b/indra/llaudio/llstreamingaudio_fmodex.h index 54d96e9a5..8e8bb2da6 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.h +++ b/indra/llaudio/llstreamingaudio_fmodex.h @@ -77,6 +77,7 @@ private: std::list mDeadStreams; std::string mURL; + std::string mPendingURL; F32 mGain; LLSD *mMetaData; diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 8ffebfd21..888c20cd4 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -469,6 +469,7 @@ void LLCharacter::addSharedVisualParam(LLVisualParam *param) void LLCharacter::addVisualParam(LLVisualParam *param) { S32 index = param->getID(); + // Add Index map std::pair idxres; idxres = mVisualParamIndexMap.insert(visual_param_index_map_t::value_type(index, param)); @@ -479,6 +480,8 @@ void LLCharacter::addVisualParam(LLVisualParam *param) visual_param_index_map_t::iterator index_iter = idxres.first; index_iter->second = param; } + + mVisualParamSortedVector[index] = param; if (param->getInfo()) { diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 0d66b1d52..2b872effa 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -38,6 +38,8 @@ #include "string_table.h" #include "llpointer.h" #include "llthread.h" +#include "llsortedvector.h" +#include class LLPolyMesh; @@ -208,21 +210,21 @@ public: // visual parameter accessors LLVisualParam* getFirstVisualParam() { - mCurIterator = mVisualParamIndexMap.begin(); + mCurIterator = mVisualParamSortedVector.begin(); return getNextVisualParam(); } LLVisualParam* getNextVisualParam() { - if (mCurIterator == mVisualParamIndexMap.end()) + if (mCurIterator == mVisualParamSortedVector.end()) return 0; return (mCurIterator++)->second; } - + S32 getVisualParamCountInGroup(const EVisualParamGroup group) const { S32 rtn = 0; - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); - iter != mVisualParamIndexMap.end(); + for (visual_param_sorted_vec_t::const_iterator iter = mVisualParamSortedVector.begin(); + iter != mVisualParamSortedVector.end(); /* */ ) { if ((iter++)->second->getGroup() == group) @@ -238,7 +240,7 @@ public: visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(id); return (iter == mVisualParamIndexMap.end()) ? 0 : iter->second; } - S32 getVisualParamID(LLVisualParam *id) + /*S32 getVisualParamID(LLVisualParam *id) { visual_param_index_map_t::iterator iter; for (iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) @@ -247,7 +249,7 @@ public: return iter->first; } return 0; - } + }*/ S32 getVisualParamCount() const { return (S32)mVisualParamIndexMap.size(); } LLVisualParam* getVisualParam(const char *name); @@ -278,13 +280,15 @@ protected: private: // visual parameter stuff - typedef std::map visual_param_index_map_t; - typedef std::map visual_param_name_map_t; - - visual_param_index_map_t::iterator mCurIterator; - visual_param_index_map_t mVisualParamIndexMap; - visual_param_name_map_t mVisualParamNameMap; + //typedef std::map visual_param_index_map_t; + typedef boost::unordered_map visual_param_index_map_t; //Hash map for fast lookup. + typedef LLSortedVector visual_param_sorted_vec_t; //Contiguous sorted array. + typedef std::map visual_param_name_map_t; + visual_param_sorted_vec_t::iterator mCurIterator; + visual_param_sorted_vec_t mVisualParamSortedVector; + visual_param_index_map_t mVisualParamIndexMap; + visual_param_name_map_t mVisualParamNameMap; static LLStringTable sVisualParamNames; }; diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 39260582a..35dcc1057 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -83,13 +83,7 @@ LLMotionRegistry::~LLMotionRegistry() BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { // llinfos << "Registering motion: " << name << llendl; - if (!is_in_map(mMotionTable, id)) - { - mMotionTable[id] = constructor; - return TRUE; - } - - return FALSE; + return mMotionTable.insert(std::make_pair(id,constructor)).second; } //----------------------------------------------------------------------------- diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 403df0899..ecaf55586 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -54,7 +54,10 @@ protected: template static STATICDATA& getStatic() { - void *& instances = getInstances(typeid(TRACKED)); + //Singu note: Don't de-static the instances variable. getInstances is incredibly + //expensive. Calling getInstances once and caching the result is sufficient + //to avoid the instance-per-module issue noted above. + static void *& instances = getInstances(typeid(TRACKED)); if (! instances) { instances = new STATICDATA; diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h index 391b82ee4..bb779e519 100644 --- a/indra/llcommon/llsortedvector.h +++ b/indra/llcommon/llsortedvector.h @@ -109,6 +109,16 @@ public: return const_cast(this)->find(key); } + //For easy insertion shorthand. Eases std::map => LLSortedVector drop-in replacement. + mapped_type& operator[] (const key_type& key) + { + return insert(std::make_pair(key,mapped_type())).first->second; + } + const mapped_type& operator[] (const key_type& key) const + { + return insert(std::make_pair(key,mapped_type())).first->second; + } + private: // Define our own 'less' comparator so we can specialize without messing // with std::less. diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 9f49fcbf5..ec98bb911 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -175,33 +175,10 @@ struct CopyNewPointer } }; -// Simple function to help with finding pointers in maps. -// For example: -// typedef map_t; -// std::map foo; -// foo[18] = "there"; -// foo[2] = "hello"; -// const char* bar = get_ptr_in_map(foo, 2); // bar -> "hello" -// const char* baz = get_ptr_in_map(foo, 3); // baz == NULL -template -inline T* get_ptr_in_map(const std::map& inmap, const K& key) -{ - // Typedef here avoids warnings because of new c++ naming rules. - typedef typename std::map::const_iterator map_iter; - map_iter iter = inmap.find(key); - if(iter == inmap.end()) - { - return NULL; - } - else - { - return iter->second; - } -}; - // helper function which returns true if key is in inmap. -template -inline bool is_in_map(const std::map& inmap, const K& key) +template +//Singu note: This has been generalized to support a broader range of map-esque containers +inline bool is_in_map(const T& inmap, typename T::key_type const& key) { if(inmap.find(key) == inmap.end()) { @@ -217,11 +194,13 @@ inline bool is_in_map(const std::map& inmap, const K& key) // To replace LLSkipMap getIfThere, use: // get_if_there(map, key, 0) // WARNING: Make sure default_value (generally 0) is not a valid map entry! -template -inline T get_if_there(const std::map& inmap, const K& key, T default_value) +// +//Singu note: This has been generalized to support a broader range of map-esque containers. +template +inline typename T::mapped_type get_if_there(const T& inmap, typename T::key_type const& key, typename T::mapped_type default_value) { // Typedef here avoids warnings because of new c++ naming rules. - typedef typename std::map::const_iterator map_iter; + typedef typename T::const_iterator map_iter; map_iter iter = inmap.find(key); if(iter == inmap.end()) { @@ -233,6 +212,21 @@ inline T get_if_there(const std::map& inmap, const K& key, T default_value) } }; +// Simple function to help with finding pointers in maps. +// For example: +// typedef map_t; +// std::map foo; +// foo[18] = "there"; +// foo[2] = "hello"; +// const char* bar = get_ptr_in_map(foo, 2); // bar -> "hello" +// const char* baz = get_ptr_in_map(foo, 3); // baz == NULL +//Singu note: This has been generalized to support a broader range of map-esque containers +template +inline typename T::mapped_type get_ptr_in_map(const T& inmap, typename T::key_type const& key) +{ + return get_if_there(inmap,key,NULL); +}; + // Useful for replacing the removeObj() functionality of LLDynamicArray // Example: // for (std::vector::iterator iter = mList.begin(); iter != mList.end(); ) @@ -242,10 +236,12 @@ inline T get_if_there(const std::map& inmap, const K& key, T default_value) // else // ++iter; // } -template -inline Iter vector_replace_with_last(std::vector& invec, Iter iter) +// +//Singu note: This has been generalized to support a broader range of sequence containers +template +inline typename T::iterator vector_replace_with_last(T& invec, typename T::iterator& iter) { - typename std::vector::iterator last = invec.end(); --last; + typename T::iterator last = invec.end(); --last; if (iter == invec.end()) { return iter; @@ -266,13 +262,15 @@ inline Iter vector_replace_with_last(std::vector& invec, Iter iter) // Useful for replacing the removeObj() functionality of LLDynamicArray // Example: // vector_replace_with_last(mList, x); +// +//Singu note: This has been generalized to support a broader range of sequence containers template -inline bool vector_replace_with_last(std::vector& invec, const T& val) +inline bool vector_replace_with_last(T& invec, typename T::value_type const& val) { - typename std::vector::iterator iter = std::find(invec.begin(), invec.end(), val); + typename T::iterator iter = std::find(invec.begin(), invec.end(), val); if (iter != invec.end()) { - typename std::vector::iterator last = invec.end(); --last; + typename T::iterator last = invec.end(); --last; *iter = *last; invec.pop_back(); return true; diff --git a/indra/llinventory/llpermissionsflags.h b/indra/llinventory/llpermissionsflags.h index 02224d0c8..925976242 100644 --- a/indra/llinventory/llpermissionsflags.h +++ b/indra/llinventory/llpermissionsflags.h @@ -89,6 +89,10 @@ const U8 PERM_GROUP = 0x04; const U8 PERM_EVERYONE = 0x08; const U8 PERM_NEXT_OWNER = 0x10; +// Boolean values for "Set". +const U8 PERM_SET_TRUE = 0x1; +const U8 PERM_SET_FALSE = 0x0; + // This is just a quickie debugging key // no modify: PERM_ALL & ~PERM_MODIFY = 0x7fffbfff // no copy: PERM_ALL & ~PERM_COPY = 0x7fff7fff diff --git a/indra/llmessage/aicurl.h b/indra/llmessage/aicurl.h index d15c72cd8..6249db171 100644 --- a/indra/llmessage/aicurl.h +++ b/indra/llmessage/aicurl.h @@ -197,6 +197,9 @@ U32 getNumHTTPQueued(void); // Returns the number of curl requests currently added to the multi handle. U32 getNumHTTPAdded(void); +// Return the maximum number of total allowed added curl requests. +U32 getMaxHTTPAdded(void); + // This used to be LLAppViewer::getTextureFetch()->getNumHTTPRequests(). // Returns the number of active curl easy handles (that are actually attempting to download something). U32 getNumHTTPRunning(void); diff --git a/indra/llmessage/aicurlperservice.cpp b/indra/llmessage/aicurlperservice.cpp index ff452c358..8b00d32b6 100644 --- a/indra/llmessage/aicurlperservice.cpp +++ b/indra/llmessage/aicurlperservice.cpp @@ -84,6 +84,7 @@ AIPerService::CapabilityType::CapabilityType(void) : mQueuedCommands(0), mAdded(0), mFlags(0), + mDownloading(0), mMaxPipelinedRequests(CurlConcurrentConnectionsPerService) { } @@ -263,11 +264,16 @@ void AIPerService::added_to_multi_handle(AICapabilityType capability_type) ++mTotalAdded; } -void AIPerService::removed_from_multi_handle(AICapabilityType capability_type) +void AIPerService::removed_from_multi_handle(AICapabilityType capability_type, bool downloaded_something) { + llassert(mTotalAdded > 0 && mCapabilityType[capability_type].mAdded > 0); --mCapabilityType[capability_type].mAdded; + if (downloaded_something) + { + llassert(mCapabilityType[capability_type].mDownloading > 0); + --mCapabilityType[capability_type].mDownloading; + } --mTotalAdded; - llassert(mTotalAdded >= 0 && mCapabilityType[capability_type].mAdded >= 0); } void AIPerService::queue(AICurlEasyRequest const& easy_request, AICapabilityType capability_type) @@ -450,7 +456,7 @@ void AIPerService::Approvement::honored(void) if (!mHonored) { mHonored = true; - AICurlPrivate::PerService_wat per_service_w(*mPerServicePtr); + PerService_wat per_service_w(*mPerServicePtr); llassert(per_service_w->mCapabilityType[mCapabilityType].mApprovedRequests > 0); per_service_w->mCapabilityType[mCapabilityType].mApprovedRequests--; } diff --git a/indra/llmessage/aicurlperservice.h b/indra/llmessage/aicurlperservice.h index f50c1f393..7c53a06ab 100644 --- a/indra/llmessage/aicurlperservice.h +++ b/indra/llmessage/aicurlperservice.h @@ -43,12 +43,15 @@ #include #include #include +#include +#include #include #include "aithreadsafe.h" #include "aiaverage.h" class AICurlEasyRequest; class AIPerService; +class AIServiceBar; namespace AICurlPrivate { namespace curlthread { class MultiHandle; } @@ -59,6 +62,8 @@ class ThreadSafeBufferedCurlEasyRequest; // Forward declaration of BufferedCurlEasyRequestPtr (see aicurlprivate.h). typedef boost::intrusive_ptr BufferedCurlEasyRequestPtr; +} // namespace AICurlPrivate + // AIPerService objects are created by the curl thread and destructed by the main thread. // We need locking. typedef AIThreadSafeSimpleDC threadsafe_PerService; @@ -66,8 +71,6 @@ typedef AIAccessConst PerService_crat; typedef AIAccess PerService_rat; typedef AIAccess PerService_wat; -} // namespace AICurlPrivate - // We can't put threadsafe_PerService in a std::map because you can't copy a mutex. // Therefore, use an intrusive pointer for the threadsafe type. typedef boost::intrusive_ptr AIPerServicePtr; @@ -93,12 +96,13 @@ enum AICapabilityType { // {Capabilities} [Responders] // for that service already have been reached. And to keep track of the bandwidth usage, and the // number of queued requests in the pipeline, for this service. class AIPerService { - private: + public: typedef std::map instance_map_type; typedef AIThreadSafeSimpleDC threadsafe_instance_map_type; typedef AIAccess instance_map_rat; typedef AIAccess instance_map_wat; + private: static threadsafe_instance_map_type sInstanceMap; // Map of AIPerService instances with the hostname as key. friend class AIThreadSafeSimpleDC; // threadsafe_PerService @@ -120,6 +124,10 @@ class AIPerService { // Remove everything. Called upon viewer exit. static void purge(void); + // Make a copy of the instanceMap and then run 'action(per_service)' on each AIPerService object. + template + static void copy_forEach(Action const& action); + private: static U16 const ctf_empty = 1; static U16 const ctf_full = 2; @@ -135,6 +143,7 @@ class AIPerService { U16 mFlags; // ctf_empty: Set to true when the queue becomes precisely empty. // ctf_full : Set to true when the queue is popped and then still isn't empty; // ctf_starvation: Set to true when the queue was about to be popped but was already empty. + U32 mDownloading; // The number of active easy handles with this service for which data was received. U32 mMaxPipelinedRequests; // The maximum number of accepted requests for this service and (approved) capability type, that didn't finish yet. // Declare, not define, constructor and destructor - in order to avoid instantiation of queued_request_type from header. @@ -144,6 +153,7 @@ class AIPerService { S32 pipelined_requests(void) const { return mApprovedRequests + mQueuedCommands + mQueuedRequests.size() + mAdded; } }; + friend class AIServiceBar; CapabilityType mCapabilityType[number_of_capability_types]; AIAverage mHTTPBandwidth; // Keeps track on number of bytes received for this service in the past second. @@ -203,8 +213,9 @@ class AIPerService { public: void added_to_command_queue(AICapabilityType capability_type) { ++mCapabilityType[capability_type].mQueuedCommands; } void removed_from_command_queue(AICapabilityType capability_type) { --mCapabilityType[capability_type].mQueuedCommands; llassert(mCapabilityType[capability_type].mQueuedCommands >= 0); } - void added_to_multi_handle(AICapabilityType capability_type); // Called when an easy handle for this host has been added to the multi handle. - void removed_from_multi_handle(AICapabilityType capability_type); // Called when an easy handle for this host is removed again from the multi handle. + void added_to_multi_handle(AICapabilityType capability_type); // Called when an easy handle for this host has been added to the multi handle. + void removed_from_multi_handle(AICapabilityType capability_type, bool downloaded_something); // Called when an easy handle for this host is removed again from the multi handle. + void download_started(AICapabilityType capability_type) { ++mCapabilityType[capability_type].mDownloading; } bool throttled(void) const; // Returns true if the maximum number of allowed requests for this host have been added to the multi handle. void queue(AICurlEasyRequest const& easy_request, AICapabilityType capability_type); // Add easy_request to the queue. @@ -222,6 +233,7 @@ class AIPerService { static void setNoHTTPBandwidthThrottling(bool nb) { sNoHTTPBandwidthThrottling = nb; } static void setHTTPThrottleBandwidth(F32 max_kbps) { sHTTPThrottleBandwidth125 = 125.f * max_kbps; } static size_t getHTTPThrottleBandwidth125(void) { return sHTTPThrottleBandwidth125; } + static F32 throttleFraction(void) { return ThrottleFraction_wat(sThrottleFraction)->fraction / 1024.f; } // Called when CurlConcurrentConnectionsPerService changes. static void adjust_concurrent_connections(int increment); @@ -275,4 +287,17 @@ extern U32 CurlConcurrentConnectionsPerService; } // namespace AICurlPrivate +template +void AIPerService::copy_forEach(Action const& action) +{ + // Make a copy so we don't need to keep the lock on sInstanceMap for too long. + std::vector > current_services; + { + instance_map_rat instance_map_r(sInstanceMap); + std::copy(instance_map_r->begin(), instance_map_r->end(), std::back_inserter(current_services)); + } + // Apply the functor on each of the services. + std::for_each(current_services.begin(), current_services.end(), action); +} + #endif // AICURLPERSERVICE_H diff --git a/indra/llmessage/aicurlprivate.h b/indra/llmessage/aicurlprivate.h index aa5a1ba7b..af8b6b267 100644 --- a/indra/llmessage/aicurlprivate.h +++ b/indra/llmessage/aicurlprivate.h @@ -463,6 +463,9 @@ class BufferedCurlEasyRequest : public CurlEasyRequest { // Return the capability type of this request. AICapabilityType capability_type(void) const { llassert(mCapabilityType != number_of_capability_types); return mCapabilityType; } + + // Return true if any data was received. + bool received_data(void) const { return mTotalRawBytes > 0; } }; inline ThreadSafeBufferedCurlEasyRequest* CurlEasyRequest::get_lockobj(void) diff --git a/indra/llmessage/aicurlthread.cpp b/indra/llmessage/aicurlthread.cpp index 2611ef7bf..4a9c9198c 100644 --- a/indra/llmessage/aicurlthread.cpp +++ b/indra/llmessage/aicurlthread.cpp @@ -1721,8 +1721,7 @@ bool MultiHandle::add_easy_request(AICurlEasyRequest const& easy_request, bool f AICurlEasyRequest_wat curl_easy_request_w(*easy_request); capability_type = curl_easy_request_w->capability_type(); per_service = curl_easy_request_w->getPerServicePtr(); - // Never throttle on bandwidth if there are no handles running (sTotalAdded == 1, the long poll connection). - bool too_much_bandwidth = sTotalAdded > 1 && !curl_easy_request_w->approved() && AIPerService::checkBandwidthUsage(per_service, get_clock_count() * HTTPTimeout::sClockWidth_40ms); + bool too_much_bandwidth = !curl_easy_request_w->approved() && AIPerService::checkBandwidthUsage(per_service, get_clock_count() * HTTPTimeout::sClockWidth_40ms); PerService_wat per_service_w(*per_service); if (!too_much_bandwidth && sTotalAdded < curl_max_total_concurrent_connections && !per_service_w->throttled()) { @@ -1791,10 +1790,11 @@ CURLMcode MultiHandle::remove_easy_request(addedEasyRequests_type::iterator cons AIPerServicePtr per_service; { AICurlEasyRequest_wat curl_easy_request_w(**iter); + bool downloaded_something = curl_easy_request_w->received_data(); res = curl_easy_request_w->remove_handle_from_multi(curl_easy_request_w, mMultiHandle); capability_type = curl_easy_request_w->capability_type(); per_service = curl_easy_request_w->getPerServicePtr(); - PerService_wat(*per_service)->removed_from_multi_handle(capability_type); // (About to be) removed from mAddedEasyRequests. + PerService_wat(*per_service)->removed_from_multi_handle(capability_type, downloaded_something); // (About to be) removed from mAddedEasyRequests. #ifdef SHOW_ASSERT curl_easy_request_w->mRemovedPerCommand = as_per_command; #endif @@ -2137,6 +2137,12 @@ void BufferedCurlEasyRequest::update_body_bandwidth(void) getinfo(CURLINFO_SIZE_DOWNLOAD, &size_download); size_t total_raw_bytes = size_download; size_t raw_bytes = total_raw_bytes - mTotalRawBytes; + if (mTotalRawBytes == 0 && total_raw_bytes > 0) + { + // Update service/capability type administration for the HTTP Debug Console. + PerService_wat per_service_w(*mPerServicePtr); + per_service_w->download_started(mCapabilityType); + } mTotalRawBytes = total_raw_bytes; // Note that in some cases (like HTTP_PARTIAL_CONTENT), the output of CURLINFO_SIZE_DOWNLOAD lags // behind and will return 0 the first time, and the value of the previous chunk the next time. @@ -2589,6 +2595,11 @@ U32 getNumHTTPAdded(void) return AICurlPrivate::curlthread::MultiHandle::total_added_size(); } +U32 getMaxHTTPAdded(void) +{ + return AICurlPrivate::curlthread::curl_max_total_concurrent_connections; +} + size_t getHTTPBandwidth(void) { using namespace AICurlPrivate; @@ -2673,21 +2684,21 @@ AIPerService::Approvement* AIPerService::approveHTTPRequestFor(AIPerServicePtr c PerService_wat per_service_w(*per_service); CapabilityType& ct(per_service_w->mCapabilityType[capability_type]); S32 const pipelined_requests_per_capability_type = ct.pipelined_requests(); - reject = pipelined_requests_per_capability_type >= ct.mMaxPipelinedRequests; + reject = pipelined_requests_per_capability_type >= (S32)ct.mMaxPipelinedRequests; equal = pipelined_requests_per_capability_type == ct.mMaxPipelinedRequests; increment_threshold = ct.mFlags & ctf_starvation; decrement_threshold = (ct.mFlags & (ctf_empty | ctf_full)) == ctf_full; ct.mFlags = 0; if (decrement_threshold) { - if (ct.mMaxPipelinedRequests > per_service_w->mConcurrectConnections) + if ((int)ct.mMaxPipelinedRequests > per_service_w->mConcurrectConnections) { ct.mMaxPipelinedRequests--; } } else if (increment_threshold && reject) { - if (ct.mMaxPipelinedRequests < 2 * per_service_w->mConcurrectConnections) + if ((int)ct.mMaxPipelinedRequests < 2 * per_service_w->mConcurrectConnections) { ct.mMaxPipelinedRequests++; // Immediately take the new threshold into account. diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 1cb832983..5aa1ebdc3 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -37,13 +37,11 @@ #pragma warning (disable : 4263) #pragma warning (disable : 4264) #endif -#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Woverloaded-virtual" #include "dae.h" #include "dae/daeErrorHandler.h" #include "dom/domConstants.h" #include "dom/domMesh.h" -#pragma GCC diagnostic pop #if LL_MSVC #pragma warning (pop) #endif diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 14b9d0685..010dcf940 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -219,17 +219,15 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } } - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurDepth); + gGL.pushUIMatrix(); - // this code snaps the text origin to a pixel grid to start with - F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX); - F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY); - gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f); + gGL.loadUIIdentity(); + + LLVector2 origin(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY)); - - gGL.color4fv( color.mV ); + // Depth translation, so that floating text appears 'in-world' + // and is correctly occluded. + gGL.translatef(0.f,0.f,sCurDepth); S32 chars_drawn = 0; S32 i; @@ -249,20 +247,21 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // Not guaranteed to be set correctly gGL.setSceneBlendType(LLRender::BT_ALPHA); - cur_x = ((F32)x * sScaleX); - cur_y = ((F32)y * sScaleY); + cur_x = ((F32)x * sScaleX) + origin.mV[VX]; + cur_y = ((F32)y * sScaleY) + origin.mV[VY]; // Offset y by vertical alignment. + // use unscaled font metrics here switch (valign) { case TOP: - cur_y -= mAscender; + cur_y -= llceil(mAscender); break; case BOTTOM: - cur_y += mDescender; + cur_y += llceil(mDescender); break; case VCENTER: - cur_y -= ((mAscender - mDescender)/2.f); + cur_y -= llceil((llceil(mAscender) - llceil(mDescender))/2.f); break; case BASELINE: // Baseline, do nothing. @@ -276,10 +275,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons case LEFT: break; case RIGHT: - cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)); + cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)); break; case HCENTER: - cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)) / 2; + cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2; break; default: break; @@ -288,10 +287,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons cur_render_y = cur_y; cur_render_x = cur_x; - F32 start_x = cur_x; + F32 start_x = (F32)llround(cur_x); - F32 inv_width = 1.f / mFontBitmapCachep->getBitmapWidth(); - F32 inv_height = 1.f / mFontBitmapCachep->getBitmapHeight(); + const LLFontBitmapCache* font_bitmap_cache = mFontBitmapCachep; + + F32 inv_width = 1.f / font_bitmap_cache->getBitmapWidth(); + F32 inv_height = 1.f / font_bitmap_cache->getBitmapHeight(); const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL; @@ -300,7 +301,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (use_ellipses && halign == LEFT) { // check for too long of a string - if (getWidthF32(wstr.c_str(), 0, max_chars) * sScaleX > scaled_max_pixels) + S32 string_width = llround(getWidthF32(wstr.c_str(), begin_offset, max_chars) * sScaleX); + if (string_width > scaled_max_pixels) { // use four dots for ellipsis width to generate padding const LLWString dots(utf8str_to_wstring(std::string("...."))); @@ -358,12 +360,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (!label.empty()) { gGL.pushMatrix(); - //gGL.loadIdentity(); - //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); - //gGL.scalef(sScaleX, sScaleY, 1.f); getFontExtChar()->render(label, 0, - /*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX), - /*llfloor*/(cur_y / sScaleY), + /*llfloor*/(ext_x / sScaleX) + ext_image->getWidth() + EXT_X_BEARING - sCurOrigin.mX, + /*llfloor*/(cur_render_y / sScaleY) - sCurOrigin.mY, color, halign, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL, TRUE ); @@ -412,12 +411,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons LLRectf uv_rect((fgi->mXBitmapOffset) * inv_width, (fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height, (fgi->mXBitmapOffset + fgi->mWidth) * inv_width, - (fgi->mYBitmapOffset - PAD_UVY) * inv_height); - // snap glyph origin to whole screen pixel - LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing), - llround(cur_render_y + (F32)fgi->mYBearing), - llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, - llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); + (fgi->mYBitmapOffset - PAD_UVY) * inv_height); + // snap glyph origin to whole screen pixel + LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing), + (F32)llround(cur_render_y + (F32)fgi->mYBearing), + (F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, + (F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); drawGlyph(screen_rect, uv_rect, color, style, shadow, drop_shadow_strength); @@ -440,8 +439,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // Must do this to cur_x, not just to cur_render_x, otherwise you // will squish sub-pixel kerned characters too close together. // For example, "CCCCC" looks bad. - cur_x = (F32)llfloor(cur_x + 0.5f); - //cur_y = (F32)llfloor(cur_y + 0.5f); + cur_x = (F32)llround(cur_x); + //cur_y = (F32)llround(cur_y); cur_render_x = cur_x; cur_render_y = cur_y; @@ -450,41 +449,40 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (right_x) { - *right_x = cur_x / sScaleX; + *right_x = (cur_x - origin.mV[VX]) / sScaleX; } if (style & UNDERLINE) { + F32 descender = (F32)llfloor(mDescender); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.begin(LLRender::LINES); - gGL.vertex2f(start_x, cur_y - (mDescender)); - gGL.vertex2f(cur_x, cur_y - (mDescender)); + gGL.vertex2f(start_x, cur_y - descender); + gGL.vertex2f(cur_x, cur_y - descender); gGL.end(); } - // *FIX: get this working in all alignment cases, etc. if (draw_ellipses) { + // recursively render ellipses at end of string // we've already reserved enough room - gGL.pushMatrix(); - //gGL.loadIdentity(); - //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); - //gGL.scalef(sScaleX, sScaleY, 1.f); + gGL.pushUIMatrix(); renderUTF8(std::string("..."), 0, - cur_x / sScaleX, (F32)y, + (cur_x - origin.mV[VX]) / sScaleX, (F32)y, color, LEFT, valign, style, - LLFontGL::NO_SHADOW, + shadow, S32_MAX, max_pixels, right_x, FALSE); - gGL.popMatrix(); + gGL.popUIMatrix(); } - gGL.popMatrix(); + gGL.popUIMatrix(); return chars_drawn; } @@ -578,7 +576,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S cur_x += getXAdvance(wch); llwchar next_char = wchars[i+1]; - if (((i + 1) < max_chars) + if (((i + 1) < begin_offset + max_chars) && next_char && (next_char < LAST_CHARACTER)) { @@ -587,7 +585,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S } } // Round after kerning. - cur_x = (F32)llfloor(cur_x + 0.5f); + cur_x = (F32)llround(cur_x); } return cur_x / sScaleX; @@ -694,7 +692,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch } } // Round after kerning. - cur_x = (F32)llfloor(cur_x + 0.5f); + cur_x = (F32)llround(cur_x); drawn_x = cur_x; } @@ -871,7 +869,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, const S32 begin_offset, } // Round after kerning. - cur_x = (F32)llfloor(cur_x + 0.5f); + cur_x = (F32)llround(cur_x); } } diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 044931fa1..7ab223f4d 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -100,22 +100,21 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); left += LLFontGL::sCurOrigin.mX; right += LLFontGL::sCurOrigin.mX; bottom += LLFontGL::sCurOrigin.mY; top += LLFontGL::sCurOrigin.mY; - gGL.loadIdentity(); + gGL.loadUIIdentity(); gl_rect_2d(llfloor((F32)left * LLRender2D::sGLScaleFactor.mV[VX]) - pixel_offset, llfloor((F32)top * LLRender2D::sGLScaleFactor.mV[VY]) + pixel_offset, llfloor((F32)right * LLRender2D::sGLScaleFactor.mV[VX]) + pixel_offset, llfloor((F32)bottom * LLRender2D::sGLScaleFactor.mV[VY]) - pixel_offset, filled); - gGL.popMatrix(); + gGL.popUIMatrix(); } - void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) { stop_glerror(); @@ -386,8 +385,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex } // add in offset of current image to current UI translation - const LLVector3 ui_scale = LLVector3(1.f,1.f,1.f);//gGL.getUIScale(); - const LLVector3 ui_translation = LLVector3(x,y,0.f);//(gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); + const LLVector3 ui_scale = gGL.getUIScale(); + const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); F32 uv_width = uv_outer_rect.getWidth(); F32 uv_height = uv_outer_rect.getHeight(); @@ -451,6 +450,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); + gGL.diffuseColor4fv(color.mV); //workaround: Intel HD 4000 const S32 NUM_VERTICES = 9 * 4; // 9 quads LLVector2 uv[NUM_VERTICES]; @@ -658,8 +658,8 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre gGL.begin(LLRender::QUADS); { - LLVector3 ui_scale = LLVector3(1.f,1.f,1.f);//gGL.getUIScale(); - LLVector3 ui_translation = LLVector3(0.f,0.f,0.f); //gGL.getUITranslation(); + LLVector3 ui_scale = gGL.getUIScale(); + LLVector3 ui_translation = gGL.getUITranslation(); ui_translation.mV[VX] += x; ui_translation.mV[VY] += y; ui_translation.scaleVec(ui_scale); @@ -689,13 +689,13 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre } else { - gGL.pushMatrix(); - gGL.translatef((F32)x, (F32)y, 0.f); + gGL.pushUIMatrix(); + gGL.translateUI((F32)x, (F32)y, 0.f); F32 offset_x = F32(width/2); F32 offset_y = F32(height/2); - gGL.translatef(offset_x, offset_y, 0.f); + gGL.translateUI(offset_x, offset_y, 0.f); LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); @@ -724,7 +724,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre gGL.vertex2f(v.mV[0], v.mV[1] ); } gGL.end(); - gGL.popMatrix(); + gGL.popUIMatrix(); } } @@ -765,9 +765,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F end_angle += F_TWO_PI; } - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef(center_x, center_y, 0.f); + gGL.translateUI(center_x, center_y, 0.f); // Inexact, but reasonably fast. F32 delta = (end_angle - start_angle) / steps; @@ -798,15 +798,15 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F } gGL.end(); } - gGL.popMatrix(); + gGL.popUIMatrix(); } void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.translatef(center_x, center_y, 0.f); + gGL.translateUI(center_x, center_y, 0.f); // Inexact, but reasonably fast. F32 delta = F_TWO_PI / steps; @@ -837,7 +837,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled } gGL.end(); } - gGL.popMatrix(); + gGL.popUIMatrix(); } // Renders a ring with sides (tube shape) @@ -864,9 +864,9 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps ) void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef(0.f, 0.f, -width / 2); + gGL.translateUI(0.f, 0.f, -width / 2); if( render_center ) { gGL.color4fv(center_color.mV); @@ -877,11 +877,11 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor { gGL.diffuseColor4fv(side_color.mV); gl_washer_2d(radius, radius - width, steps, side_color, side_color); - gGL.translatef(0.f, 0.f, width); + gGL.translateUI(0.f, 0.f, width); gl_washer_2d(radius - width, radius, steps, side_color, side_color); } } - gGL.popMatrix(); + gGL.popUIMatrix(); } // Draw gray and white checkerboard with black border @@ -1056,9 +1056,9 @@ void gl_segmented_rect_2d_tex(const S32 left, S32 width = llabs(right - left); S32 height = llabs(top - bottom); - gGL.pushMatrix(); + gGL.pushUIMatrix(); - gGL.translatef((F32)left, (F32)bottom, 0.f); + gGL.translateUI((F32)left, (F32)bottom, 0.f); LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); if (border_uv_scale.mV[VX] > 0.5f) @@ -1199,7 +1199,7 @@ void gl_segmented_rect_2d_tex(const S32 left, } gGL.end(); - gGL.popMatrix(); + gGL.popUIMatrix(); } //FIXME: rewrite to use scissor? @@ -1217,9 +1217,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, S32 width = llabs(right - left); S32 height = llabs(top - bottom); - gGL.pushMatrix(); + gGL.pushUIMatrix(); - gGL.translatef((F32)left, (F32)bottom, 0.f); + gGL.translateUI((F32)left, (F32)bottom, 0.f); LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); if (border_uv_scale.mV[VX] > 0.5f) @@ -1390,7 +1390,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, } gGL.end(); - gGL.popMatrix(); + gGL.popUIMatrix(); } void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, @@ -1553,7 +1553,7 @@ void LLRender2D::cleanupClass() //static void LLRender2D::translate(F32 x, F32 y, F32 z) { - gGL.translatef(x,y,z); + gGL.translateUI(x,y,z); LLFontGL::sCurOrigin.mX += (S32) x; LLFontGL::sCurOrigin.mY += (S32) y; LLFontGL::sCurDepth += z; @@ -1562,14 +1562,14 @@ void LLRender2D::translate(F32 x, F32 y, F32 z) //static void LLRender2D::pushMatrix() { - gGL.pushMatrix(); + gGL.pushUIMatrix(); LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth)); } //static void LLRender2D::popMatrix() { - gGL.popMatrix(); + gGL.popUIMatrix(); LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first; LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second; LLFontGL::sOriginStack.pop_back(); @@ -1578,7 +1578,7 @@ void LLRender2D::popMatrix() //static void LLRender2D::loadIdentity() { - gGL.loadIdentity(); + gGL.loadUIIdentity(); LLFontGL::sCurOrigin.mX = 0; LLFontGL::sCurOrigin.mY = 0; LLFontGL::sCurDepth = 0.f; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 502d8a53c..67c271a0e 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -36,9 +36,6 @@ #include "llshadermgr.h" #include "llglslshader.h" #include "llmemory.h" -#include "llfasttimer.h" - -#define LL_VBO_POOLING 0 //Next Highest Power Of Two //helper function, returns first number > v that is a power of 2, or v if v is already a power of 2 @@ -67,6 +64,7 @@ U32 wpo2(U32 i) const U32 LL_VBO_BLOCK_SIZE = 2048; +const U32 LL_VBO_POOL_MAX_SEED_SIZE = 256*1024; U32 vbo_block_size(U32 size) { //what block size will fit size? @@ -79,6 +77,7 @@ U32 vbo_block_index(U32 size) return vbo_block_size(size)/LL_VBO_BLOCK_SIZE; } +const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE); //============================================================================ @@ -91,6 +90,11 @@ LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_ U32 LLVBOPool::sBytesPooled = 0; U32 LLVBOPool::sIndexBytesPooled = 0; +U32 LLVBOPool::sCurGLName = 1; + +std::list LLVertexBuffer::sAvailableVAOName; +U32 LLVertexBuffer::sCurVAOName = 1; + U32 LLVertexBuffer::sAllocatedIndexBytes = 0; U32 LLVertexBuffer::sIndexCount = 0; @@ -116,14 +120,54 @@ bool LLVertexBuffer::sUseVAO = false; bool LLVertexBuffer::sPreferStreamDraw = false; -volatile U8* LLVBOPool::allocate(U32& name, U32 size) +U32 LLVBOPool::genBuffer() +{ + U32 ret = 0; + + if (mGLNamePool.empty()) + { + ret = sCurGLName++; + } + else + { + ret = mGLNamePool.front(); + mGLNamePool.pop_front(); + } + + return ret; +} + +void LLVBOPool::deleteBuffer(U32 name) +{ + if (gGLManager.mInited) + { + LLVertexBuffer::unbind(); + + glBindBufferARB(mType, name); + glBufferDataARB(mType, 0, NULL, mUsage); + + llassert(std::find(mGLNamePool.begin(), mGLNamePool.end(), name) == mGLNamePool.end()); + + mGLNamePool.push_back(name); + + glBindBufferARB(mType, 0); + } +} + + +LLVBOPool::LLVBOPool(U32 vboUsage, U32 vboType) +: mUsage(vboUsage), mType(vboType) +{ + mMissCount.resize(LL_VBO_POOL_SEED_COUNT); + std::fill(mMissCount.begin(), mMissCount.end(), 0); +} + +volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) { llassert(vbo_block_size(size) == size); volatile U8* ret = NULL; -#if LL_VBO_POOLING - U32 i = vbo_block_index(size); if (mFreeList.size() <= i) @@ -131,12 +175,18 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size) mFreeList.resize(i+1); } - if (mFreeList[i].empty()) + if (mFreeList[i].empty() || for_seed) { //make a new buffer - glGenBuffersARB(1, &name); + name = genBuffer(); + glBindBufferARB(mType, name); + if (!for_seed && i < LL_VBO_POOL_SEED_COUNT) + { //record this miss + mMissCount[i]++; + } + if (mType == GL_ARRAY_BUFFER_ARB) { LLVertexBuffer::sAllocatedBytes += size; @@ -157,6 +207,25 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size) } glBindBufferARB(mType, 0); + + if (for_seed) + { //put into pool for future use + llassert(mFreeList.size() > i); + + Record rec; + rec.mGLName = name; + rec.mClientData = ret; + + if (mType == GL_ARRAY_BUFFER_ARB) + { + sBytesPooled += size; + } + else + { + sIndexBytesPooled += size; + } + mFreeList[i].push_back(rec); + } } else { @@ -174,33 +243,6 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size) mFreeList[i].pop_front(); } -#else //no pooling - - glGenBuffersARB(1, &name); - glBindBufferARB(mType, name); - - if (mType == GL_ARRAY_BUFFER_ARB) - { - LLVertexBuffer::sAllocatedBytes += size; - } - else - { - LLVertexBuffer::sAllocatedIndexBytes += size; - } - - if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) - { - glBufferDataARB(mType, size, 0, mUsage); - ret = (U8*) ll_aligned_malloc_16(size); - } - else - { //always use a true hint of static draw when allocating non-client-backed buffers - glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB); - } - - glBindBufferARB(mType, 0); - -#endif return ret; } @@ -209,34 +251,7 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size) { llassert(vbo_block_size(size) == size); -#if LL_VBO_POOLING - - U32 i = vbo_block_index(size); - - llassert(mFreeList.size() > i); - - Record rec; - rec.mGLName = name; - rec.mClientData = buffer; - - if (buffer == NULL) - { - glDeleteBuffersARB(1, &rec.mGLName); - } - else - { - if (mType == GL_ARRAY_BUFFER_ARB) - { - sBytesPooled += size; - } - else - { - sIndexBytesPooled += size; - } - mFreeList[i].push_back(rec); - } -#else //no pooling - glDeleteBuffersARB(1, &name); + deleteBuffer(name); ll_aligned_free_16((U8*) buffer); if (mType == GL_ARRAY_BUFFER_ARB) @@ -247,12 +262,37 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size) { LLVertexBuffer::sAllocatedIndexBytes -= size; } -#endif } +void LLVBOPool::seedPool() +{ + U32 dummy_name = 0; + + if (mFreeList.size() < LL_VBO_POOL_SEED_COUNT) + { + mFreeList.resize(LL_VBO_POOL_SEED_COUNT); + } + + for (U32 i = 0; i < LL_VBO_POOL_SEED_COUNT; i++) + { + if (mMissCount[i] > mFreeList[i].size()) + { + U32 size = i*LL_VBO_BLOCK_SIZE; + + S32 count = mMissCount[i] - mFreeList[i].size(); + for (S32 j = 0; j < count; ++j) + { + allocate(dummy_name, size, true); + } + } + } +} + + + void LLVBOPool::cleanup() { - U32 size = 1; + U32 size = LL_VBO_BLOCK_SIZE; for (U32 i = 0; i < mFreeList.size(); ++i) { @@ -262,8 +302,8 @@ void LLVBOPool::cleanup() { Record& r = l.front(); - glDeleteBuffersARB(1, &r.mGLName); - + deleteBuffer(r.mGLName); + if (r.mClientData) { ll_aligned_free_16((void*) r.mClientData); @@ -283,8 +323,11 @@ void LLVBOPool::cleanup() } } - size *= 2; + size += LL_VBO_BLOCK_SIZE; } + + //reset miss counts + std::fill(mMissCount.begin(), mMissCount.end(), 0); } @@ -318,6 +361,41 @@ U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] = GL_LINE_LOOP, }; +//static +U32 LLVertexBuffer::getVAOName() +{ + U32 ret = 0; + + if (!sAvailableVAOName.empty()) + { + ret = sAvailableVAOName.front(); + sAvailableVAOName.pop_front(); + } + else + { +#ifdef GL_ARB_vertex_array_object + glGenVertexArrays(1, &ret); +#endif + } + + return ret; +} + +//static +void LLVertexBuffer::releaseVAOName(U32 name) +{ + sAvailableVAOName.push_back(name); +} + + +//static +void LLVertexBuffer::seedPools() +{ + sStreamVBOPool.seedPool(); + sDynamicVBOPool.seedPool(); + sStreamIBOPool.seedPool(); + sDynamicIBOPool.seedPool(); +} //static void LLVertexBuffer::setupClientArrays(U32 data_mask) @@ -473,8 +551,21 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, con gGL.syncMatrices(); U32 count = pos.size(); - llassert_always(norm.size() >= pos.size()); - llassert_always(count > 0); + + llassert(norm.size() >= pos.size()); + llassert(count > 0); + + if( count == 0 ) + { + llwarns << "Called drawArrays with 0 vertices" << llendl; + return; + } + + if( norm.size() < pos.size() ) + { + llwarns << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << llendl; + return; + } unbind(); @@ -690,6 +781,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const placeFence(); } +static LLFastTimer::DeclareTimer FTM_GL_DRAW_ARRAYS("GL draw arrays"); void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); @@ -724,8 +816,11 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const return; } - stop_glerror(); - glDrawArrays(sGLMode[mode], first, count); + { + LLFastTimer t2(FTM_GL_DRAW_ARRAYS); + stop_glerror(); + glDrawArrays(sGLMode[mode], first, count); + } stop_glerror(); placeFence(); } @@ -920,7 +1015,7 @@ LLVertexBuffer::~LLVertexBuffer() if (mGLArray) { #if GL_ARB_vertex_array_object - glDeleteVertexArrays(1, &mGLArray); + releaseVAOName(mGLArray); #endif } @@ -1193,7 +1288,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) if (gGLManager.mHasVertexArrayObject && useVBOs() && (LLRender::sGLCoreProfile || sUseVAO)) { #if GL_ARB_vertex_array_object - glGenVertexArrays(1, &mGLArray); + mGLArray = getVAOName(); #endif setupVertexArray(); } diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 3762d956b..4801117a5 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -56,24 +56,29 @@ class LLVBOPool public: static U32 sBytesPooled; static U32 sIndexBytesPooled; + + static U32 sCurGLName; - LLVBOPool(U32 vboUsage, U32 vboType) - : mUsage(vboUsage) - , mType(vboType) - {} - + LLVBOPool(U32 vboUsage, U32 vboType); + const U32 mUsage; const U32 mType; //size MUST be a power of 2 - volatile U8* allocate(U32& name, U32 size); + volatile U8* allocate(U32& name, U32 size, bool for_seed = false); //size MUST be the size provided to allocate that returned the given name void release(U32 name, volatile U8* buffer, U32 size); + //batch allocate buffers to be provided to the application on demand + void seedPool(); + //destroy all records in mFreeList void cleanup(); + U32 genBuffer(); + void deleteBuffer(U32 name); + class Record { public: @@ -81,8 +86,12 @@ public: volatile U8* mClientData; }; + std::list mGLNamePool; + typedef std::list record_list_t; std::vector mFreeList; + std::vector mMissCount; + }; @@ -119,10 +128,18 @@ public: static LLVBOPool sStreamIBOPool; static LLVBOPool sDynamicIBOPool; + static std::list sAvailableVAOName; + static U32 sCurVAOName; + static bool sUseStreamDraw; static bool sUseVAO; static bool sPreferStreamDraw; + static void seedPools(); + + static U32 getVAOName(); + static void releaseVAOName(U32 name); + static void initClass(bool use_vbo, bool no_vbo_mapping); static void cleanupClass(); static void setupClientArrays(U32 data_mask); diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index a13c0c3ca..54ebcb504 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -29,9 +29,11 @@ set(llui_SOURCE_FILES llcheckboxctrl.cpp llclipboard.cpp llcombobox.cpp + llcontainerview.cpp llctrlselectioninterface.cpp lldraghandle.cpp lleditmenuhandler.cpp + llfiltereditor.cpp llfloater.cpp llfocusmgr.cpp llfunctorregistry.cpp @@ -57,9 +59,13 @@ set(llui_SOURCE_FILES llscrollcontainer.cpp llscrollingpanellist.cpp llscrolllistctrl.cpp + llsearcheditor.cpp llslider.cpp llsliderctrl.cpp llspinctrl.cpp + llstatbar.cpp + llstatgraph.cpp + llstatview.cpp llstyle.cpp lltabcontainer.cpp lltextbox.cpp @@ -88,9 +94,11 @@ set(llui_HEADER_FILES llcheckboxctrl.h llclipboard.h llcombobox.h + llcontainerview.h llctrlselectioninterface.h lldraghandle.h lleditmenuhandler.h + llfiltereditor.h llfloater.h llfocusmgr.h llfunctorregistry.h @@ -116,6 +124,7 @@ set(llui_HEADER_FILES llresizehandle.h llresmgr.h llrootview.h + llsearcheditor.h llscrollbar.h llscrollcontainer.h llscrollingpanellist.h @@ -123,6 +132,9 @@ set(llui_HEADER_FILES llslider.h llsliderctrl.h llspinctrl.h + llstatbar.h + llstatgraph.h + llstatview.h llstyle.h lltabcontainer.h lltextbox.h diff --git a/indra/llui/llalertdialog.cpp b/indra/llui/llalertdialog.cpp index feb04aa67..7015e9c6a 100644 --- a/indra/llui/llalertdialog.cpp +++ b/indra/llui/llalertdialog.cpp @@ -251,7 +251,7 @@ LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal) LLButton* btn = new LLButton( button_data.mName, button_rect, "","", "", - NULL, NULL, + NULL, font, button_data.mText, button_data.mText); @@ -369,8 +369,7 @@ bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::stri check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, max_msg_width, LINE_HEIGHT); - mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font); - mCheck->setCommitCallback(boost::bind(&LLAlertDialog::onClickIgnore, this, _1)); + mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, boost::bind(&LLAlertDialog::onClickIgnore, this, _1)); addChild(mCheck); return true; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 12906fd92..888dc2e6e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -61,8 +61,8 @@ S32 BTN_HEIGHT = 0; S32 BTN_GRID = 12; S32 BORDER_SIZE = 1; -LLButton::LLButton( const std::string& name, const LLRect& rect, const std::string& control_name, void (*click_callback)(void*), void *callback_data) -: LLUICtrl(name, rect, TRUE, NULL, NULL), +LLButton::LLButton( const std::string& name, const LLRect& rect, const std::string& control_name, commit_callback_t commit_callback) +: LLUICtrl(name, rect, TRUE, commit_callback), mMouseDownFrame( 0 ), mMouseHeldDownCount(0), @@ -120,7 +120,7 @@ LLButton::LLButton( const std::string& name, const LLRect& rect, const std::stri mButtonFlashRate(LLUI::sConfigGroup->getF32("ButtonFlashRate")), mAlpha(1.f) { - init(click_callback, callback_data, control_name); + init(control_name); } @@ -128,12 +128,11 @@ LLButton::LLButton(const std::string& name, const LLRect& rect, const std::string &unselected_image_name, const std::string &selected_image_name, const std::string& control_name, - void (*click_callback)(void*), - void *callback_data, + commit_callback_t commit_callback, const LLFontGL *font, const std::string& unselected_label, const std::string& selected_label ) -: LLUICtrl(name, rect, TRUE, NULL, NULL), +: LLUICtrl(name, rect, TRUE, commit_callback), mMouseDownFrame( 0 ), mMouseHeldDownCount(0), mBorderEnabled( FALSE ), @@ -215,10 +214,10 @@ LLButton::LLButton(const std::string& name, const LLRect& rect, mImagePressed = mImageSelected; } - init(click_callback, callback_data, control_name); + init(control_name); } -void LLButton::init(void (*click_callback)(void*), void *callback_data, const std::string& control_name) +void LLButton::init(const std::string& control_name) { // Hack to make sure there is space for at least one character if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(std::string(" "))) @@ -230,11 +229,7 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const st mMouseDownTimer.stop(); - if(click_callback) - setClickedCallback(click_callback, callback_data); - setControlName(control_name, NULL); - } @@ -1219,7 +1214,6 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa image_selected, LLStringUtil::null, NULL, - parent, font, label, label_selected); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 039ee034b..5710585fd 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -75,15 +75,14 @@ class LLButton { public: // simple button with text label - LLButton(const std::string& name, const LLRect &rect, const std::string& control_name = std::string(), - void (*on_click)(void*) = NULL, void *data = NULL); + LLButton(const std::string& name, const LLRect &rect = LLRect(), const std::string& control_name = std::string(), + commit_callback_t commit_callback = NULL); LLButton(const std::string& name, const LLRect& rect, const std::string &unselected_image, const std::string &selected_image, const std::string& control_name, - void (*click_callback)(void*), - void *callback_data = NULL, + commit_callback_t commit_callback, const LLFontGL* mGLFont = NULL, const std::string& unselected_label = LLStringUtil::null, const std::string& selected_label = LLStringUtil::null ); @@ -94,7 +93,7 @@ public: typedef boost::function button_callback_t; void addImageAttributeToXML(LLXMLNodePtr node, const LLPointer, const std::string& xmlTagName) const; - void init(void (*click_callback)(void*), void *callback_data, const std::string& control_name); + void init(const std::string& control_name); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); diff --git a/indra/llui/llcallbackmap.h b/indra/llui/llcallbackmap.h index eadb9c98f..2ad6d54c5 100644 --- a/indra/llui/llcallbackmap.h +++ b/indra/llui/llcallbackmap.h @@ -30,24 +30,25 @@ * $/LicenseInfo$ */ -#ifndef LL_CALLBACK_MAP_H -#define LL_CALLBACK_MAP_H +#ifndef LLCALLBACKMAP_H +#define LLCALLBACKMAP_H #include -#include "llstring.h" +#include +#include class LLCallbackMap { public: // callback definition. - typedef void* (*callback_t)(void* data); + typedef boost::function callback_t; typedef std::map map_t; typedef map_t::iterator map_iter_t; typedef map_t::const_iterator map_const_iter_t; LLCallbackMap() : mCallback(NULL), mData(NULL) { } - LLCallbackMap(callback_t callback, void* data) : mCallback(callback), mData(data) { } + LLCallbackMap(callback_t callback, void* data = NULL) : mCallback(callback), mData(data) { } callback_t mCallback; void* mData; diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index c7ed9ba34..ad0fac5df 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -55,12 +55,11 @@ static LLRegisterWidget r("check_box"); LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font, - void (*commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_user_data, + commit_callback_t commit_callback, BOOL initial_value, BOOL use_radio_style, const std::string& control_which) -: LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP), +: LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP), mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), mRadioStyle( use_radio_style ), @@ -122,7 +121,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect, mButton = new LLButton( button_name, btn_rect, active_false_id, active_true_id, control_which, - &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() ); + boost::bind(&LLCheckBoxCtrl::onButtonPress, this, _2), LLFontGL::getFontSansSerif() ); mButton->setImageDisabledSelected(LLUI::getUIImage(inactive_true_id)); mButton->setImageDisabled(LLUI::getUIImage(inactive_false_id)); @@ -144,10 +143,14 @@ LLCheckBoxCtrl::~LLCheckBoxCtrl() // static -void LLCheckBoxCtrl::onButtonPress( void *userdata ) +void LLCheckBoxCtrl::onButtonPress( const LLSD& data ) { - LLCheckBoxCtrl* self = (LLCheckBoxCtrl*)userdata; - self->onCommit(); + //if (mRadioStyle) + //{ + // setValue(TRUE); + //} + + onCommit(); } void LLCheckBoxCtrl::onCommit() @@ -315,8 +318,6 @@ LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto BOOL radio_style = FALSE; node->getAttributeBOOL("radio_style", radio_style); - LLUICtrlCallback callback = NULL; - if (label.empty()) { label.assign(node->getTextContents()); @@ -329,7 +330,6 @@ LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto rect, label, font, - callback, NULL, FALSE, radio_style); // if true, draw radio button style icons diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index b9f8bec6f..47eb46670 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -68,8 +68,7 @@ class LLCheckBoxCtrl public: LLCheckBoxCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font = NULL, - void (*commit_callback)(LLUICtrl*, void*) = NULL, - void* callback_userdata = NULL, + commit_callback_t commit_callback = NULL, BOOL initial_value = FALSE, BOOL use_radio_style = FALSE, // if true, draw radio button style icons const std::string& control_which = LLStringUtil::null); @@ -113,7 +112,7 @@ public: virtual void setControlName(const std::string& control_name, LLView* context); virtual std::string getControlName() const; - static void onButtonPress(void *userdata); + void onButtonPress(const LLSD& data); virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. virtual void resetDirty(); // Clear dirty state diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 6a03f5687..bdd0fe4a8 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -61,11 +61,8 @@ S32 MAX_COMBO_WIDTH = 500; static LLRegisterWidget r1("combo_box"); LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, - void (*commit_callback)(LLUICtrl*,void*), - void *callback_userdata - ) -: LLUICtrl(name, rect, TRUE, commit_callback, callback_userdata, - FOLLOWS_LEFT | FOLLOWS_TOP), + commit_callback_t commit_callback) +: LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP), mTextEntry(NULL), mArrowImage(NULL), mAllowTextEntry(FALSE), @@ -83,15 +80,14 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: // Text label button mButton = new LLButton(mLabel, LLRect(), - LLStringUtil::null, - NULL, this); + LLStringUtil::null); mButton->setImageUnselected(LLUI::getUIImage("square_btn_32x128.tga")); mButton->setImageSelected(LLUI::getUIImage("square_btn_selected_32x128.tga")); mButton->setImageDisabled(LLUI::getUIImage("square_btn_32x128.tga")); mButton->setImageDisabledSelected(LLUI::getUIImage("square_btn_selected_32x128.tga")); mButton->setScaleImage(TRUE); - mButton->setMouseDownCallback(boost::bind(&LLComboBox::onButtonDown,this)); + mButton->setMouseDownCallback(boost::bind(&LLComboBox::onButtonMouseDown,this)); mButton->setFont(LLFontGL::getFontSansSerifSmall()); mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mButton->setHAlign( LLFontGL::LEFT ); @@ -100,7 +96,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: // disallow multiple selection mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), - &LLComboBox::onItemSelected, this, FALSE); + boost::bind(&LLComboBox::onItemSelected, this), FALSE); mList->setVisible(FALSE); mList->setBgWriteableColor(mListColor); mList->setCommitOnKeyboardMovement(FALSE); @@ -168,13 +164,9 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * S32 max_chars = 20; node->getAttributeS32("max_chars", max_chars); - LLUICtrlCallback callback = NULL; - LLComboBox* combo_box = new LLComboBox(name, rect, - label, - callback, - NULL); + label); combo_box->setAllowTextEntry(allow_text_entry, max_chars); const std::string& contents = node->getValue(); @@ -550,10 +542,8 @@ void LLComboBox::updateLayout() LLStringUtil::null, LLFontGL::getFontSansSerifSmall(), mMaxChars, - onTextCommit, - onTextEntry, - NULL, - this); + boost::bind(&LLComboBox::onTextCommit, this, _2), + boost::bind(&LLComboBox::onTextEntry, this, _1)); mTextEntry->setSelectAllonFocusReceived(TRUE); mTextEntry->setHandleEditKeysDirectly(TRUE); mTextEntry->setCommitOnFocusLost(FALSE); @@ -720,31 +710,27 @@ void LLComboBox::hideList() // static functions //------------------------------------------------------------------ -// static -void LLComboBox::onButtonDown(void *userdata) +void LLComboBox::onButtonMouseDown() { - LLComboBox *self = (LLComboBox *)userdata; - - if (!self->mList->getVisible()) + if (!mList->getVisible()) { - LLScrollListItem* last_selected_item = self->mList->getLastSelectedItem(); + // this might change selection, so do it first + prearrangeList(); + + // highlight the last selected item from the original selection before potentially selecting a new item + // as visual cue to original value of combo box + LLScrollListItem* last_selected_item = mList->getLastSelectedItem(); if (last_selected_item) { - // highlight the original selection before potentially selecting a new item - self->mList->mouseOverHighlightNthItem(self->mList->getItemIndex(last_selected_item)); + mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item)); } - if( self->mPrearrangeCallback ) + if (mList->getItemCount() != 0) { - self->mPrearrangeCallback( self, self->mCallbackUserData ); + showList(); } - if (self->mList->getItemCount() != 0) - { - self->showList(); - } - - self->setFocus( TRUE ); + setFocus( TRUE ); // pass mouse capture on to list if button is depressed /*if (self->mButton->hasMouseCapture()) @@ -754,36 +740,33 @@ void LLComboBox::onButtonDown(void *userdata) } else { - self->hideList(); + hideList(); } } -// static -void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata) +void LLComboBox::onItemSelected() { // Note: item is the LLScrollListCtrl - LLComboBox *self = (LLComboBox *) userdata; + const std::string name = mList->getSelectedItemLabel(); - const std::string name = self->mList->getSelectedItemLabel(); - - S32 cur_id = self->getCurrentIndex(); + S32 cur_id = getCurrentIndex(); if (cur_id != -1) { - self->setLabel(name); + setLabel(name); - if (self->mAllowTextEntry) + if (mAllowTextEntry) { - gFocusMgr.setKeyboardFocus(self->mTextEntry); - self->mTextEntry->selectAll(); + gFocusMgr.setKeyboardFocus(mTextEntry); + mTextEntry->selectAll(); } } // hiding the list reasserts the old value stored in the text editor/dropdown button - self->hideList(); + hideList(); // commit does the reverse, asserting the value in the list - self->onCommit(); + onCommit(); } BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) @@ -908,28 +891,26 @@ const std::string LLComboBox::getTextEntry() const return mTextEntry->getText(); } -//static -void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data) +void LLComboBox::onTextEntry(LLLineEditor* line_editor) { - LLComboBox* self = (LLComboBox*)user_data; - - if (self->mTextEntryCallback) + if (mTextEntryCallback != NULL) { - (*self->mTextEntryCallback)(line_editor, self->mCallbackUserData); + (mTextEntryCallback)(line_editor, LLSD()); } KEY key = gKeyboard->currentKey(); if (key == KEY_BACKSPACE || key == KEY_DELETE) { - if (self->mList->selectItemByLabel(line_editor->getText(), FALSE)) + if (mList->selectItemByLabel(line_editor->getText(), FALSE)) { line_editor->setTentative(FALSE); } else { - if (!self->mSuppressTentative) line_editor->setTentative(self->mTextEntryTentative); - self->mList->deselectAllItems(); + if (!mSuppressTentative) + line_editor->setTentative(mTextEntryTentative); + mList->deselectAllItems(); } return; } @@ -942,17 +923,14 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data) if (key == KEY_DOWN) { - self->setCurrentByIndex(llmin(self->getItemCount() - 1, self->getCurrentIndex() + 1)); - if (!self->mList->getVisible()) + setCurrentByIndex(llmin(getItemCount() - 1, getCurrentIndex() + 1)); + if (!mList->getVisible()) { - if( self->mPrearrangeCallback ) - { - self->mPrearrangeCallback( self, self->mCallbackUserData ); - } + prearrangeList(); - if (self->mList->getItemCount() != 0) + if (mList->getItemCount() != 0) { - self->showList(); + showList(); } } line_editor->selectAll(); @@ -960,17 +938,14 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data) } else if (key == KEY_UP) { - self->setCurrentByIndex(llmax(0, self->getCurrentIndex() - 1)); - if (!self->mList->getVisible()) + setCurrentByIndex(llmax(0, getCurrentIndex() - 1)); + if (!mList->getVisible()) { - if( self->mPrearrangeCallback ) - { - self->mPrearrangeCallback( self, self->mCallbackUserData ); - } + prearrangeList(); - if (self->mList->getItemCount() != 0) + if (mList->getItemCount() != 0) { - self->showList(); + showList(); } } line_editor->selectAll(); @@ -979,7 +954,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data) else { // RN: presumably text entry - self->updateSelection(); + updateSelection(); } } @@ -1000,10 +975,7 @@ void LLComboBox::updateSelection() // callback to populate content if( mTextEntry->getWText().size() == 1 ) { - if (mPrearrangeCallback) - { - mPrearrangeCallback( this, mCallbackUserData ); - } + prearrangeList(mTextEntry->getText()); } if (mList->selectItemByLabel(full_string, FALSE)) @@ -1027,14 +999,12 @@ void LLComboBox::updateSelection() } } -//static -void LLComboBox::onTextCommit(LLUICtrl* caller, void* user_data) +void LLComboBox::onTextCommit(const LLSD& data) { - LLComboBox* self = (LLComboBox*)user_data; - std::string text = self->mTextEntry->getText(); - self->setSimple(text); - self->onCommit(); - self->mTextEntry->selectAll(); + std::string text = mTextEntry->getText(); + setSimple(text); + onCommit(); + mTextEntry->selectAll(); } void LLComboBox::setSuppressTentative(bool suppress) @@ -1081,6 +1051,14 @@ void LLComboBox::setPrevalidate( BOOL (*func)(const LLWString &) ) if (mTextEntry) mTextEntry->setPrevalidate(func); } +void LLComboBox::prearrangeList(std::string filter) +{ + if (mPrearrangeCallback) + { + mPrearrangeCallback(this, LLSD(filter)); + } +} + //============================================================================ // LLCtrlListInterface functions @@ -1201,20 +1179,16 @@ const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24; LLFlyoutButton::LLFlyoutButton( const std::string& name, const LLRect &rect, - const std::string& label, - void (*commit_callback)(LLUICtrl*, void*) , - void *callback_userdata) -: LLComboBox(name, rect, LLStringUtil::null, commit_callback, callback_userdata), + const std::string& label) +: LLComboBox(name, rect, LLStringUtil::null), mToggleState(FALSE), mActionButton(NULL) { // Always use text box // Text label button mActionButton = new LLButton(label, - LLRect(), LLStringUtil::null, NULL, this); + LLRect(), LLStringUtil::null, boost::bind(&LLFlyoutButton::onActionButtonClick, this)); mActionButton->setScaleImage(TRUE); - - mActionButton->setClickedCallback(boost::bind(&LLFlyoutButton::onActionButtonClick, this)); mActionButton->setFollowsAll(); mActionButton->setHAlign( LLFontGL::HCENTER ); mActionButton->setLabel(label); @@ -1280,13 +1254,9 @@ LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto LLRect rect; createRect(node, rect, parent, LLRect()); - LLUICtrlCallback callback = NULL; - LLFlyoutButton* flyout_button = new LLFlyoutButton(name, rect, - label, - callback, - NULL); + label); std::string list_position; node->getAttributeString("list_position", list_position); @@ -1335,13 +1305,11 @@ void LLFlyoutButton::updateLayout() mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight()); } -//static -void LLFlyoutButton::onActionButtonClick(void *user_data) +void LLFlyoutButton::onActionButtonClick() { - LLFlyoutButton* buttonp = (LLFlyoutButton*)user_data; // remember last list selection? - buttonp->mList->deselect(); - buttonp->onCommit(); + mList->deselect(); + onCommit(); } void LLFlyoutButton::draw() diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 1afe2155d..f061865b8 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -68,11 +68,13 @@ public: const std::string& name, const LLRect &rect, const std::string& label, - void (*commit_callback)(LLUICtrl*, void*) = NULL, - void *callback_userdata = NULL + commit_callback_t commit_callback = NULL ); virtual ~LLComboBox(); +protected: +void prearrangeList(std::string filter = ""); +public: // LLView interface virtual LLXMLNodePtr getXML(bool save_children = true) const; @@ -176,15 +178,16 @@ public: void* getCurrentUserdata(); - void setPrearrangeCallback( void (*cb)(LLUICtrl*,void*) ) { mPrearrangeCallback = cb; } - void setTextEntryCallback( void (*cb)(LLLineEditor*, void*) ) { mTextEntryCallback = cb; } + void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; } + void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; } + void setButtonVisible(BOOL visible); - static void onButtonDown(void *userdata); - static void onItemSelected(LLUICtrl* item, void *userdata); - static void onTextEntry(LLLineEditor* line_editor, void* user_data); - static void onTextCommit(LLUICtrl* caller, void* user_data); + void onButtonMouseDown(); + void onItemSelected(); + + void onTextCommit(const LLSD& data); void setSuppressTentative(bool suppress); void setSuppressAutoComplete(bool suppress); @@ -193,8 +196,11 @@ public: virtual void showList(); virtual void hideList(); + virtual void onTextEntry(LLLineEditor* line_editor); + protected: LLButton* mButton; + LLLineEditor* mTextEntry; LLScrollListCtrl* mList; EPreferredPosition mListPosition; LLPointer mArrowImage; @@ -202,14 +208,13 @@ protected: LLColor4 mListColor; private: - LLLineEditor* mTextEntry; BOOL mAllowTextEntry; S32 mMaxChars; BOOL mTextEntryTentative; bool mSuppressAutoComplete; bool mSuppressTentative; - void (*mPrearrangeCallback)(LLUICtrl*,void*); - void (*mTextEntryCallback)(LLLineEditor*, void*); + commit_callback_t mPrearrangeCallback; + commit_callback_t mTextEntryCallback; boost::signals2::connection mTopLostSignalConnection; }; @@ -219,9 +224,7 @@ public: LLFlyoutButton( const std::string& name, const LLRect &rect, - const std::string& label, - void (*commit_callback)(LLUICtrl*, void*) = NULL, - void *callback_userdata = NULL); + const std::string& label); virtual void updateLayout(); virtual void draw(); @@ -231,8 +234,8 @@ public: virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - static void onActionButtonClick(void *userdata); - static void onSelectAction(LLUICtrl* ctrl, void *userdata); + void onActionButtonClick(); + void onSelectAction(LLUICtrl* ctrl); protected: LLButton* mActionButton; diff --git a/indra/newview/llcontainerview.cpp b/indra/llui/llcontainerview.cpp similarity index 93% rename from indra/newview/llcontainerview.cpp rename to indra/llui/llcontainerview.cpp index e6d9b0119..f9ee54e9f 100644 --- a/indra/newview/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -30,7 +30,7 @@ * $/LicenseInfo$ */ -#include "llviewerprecompiledheaders.h" +#include "linden_common.h" #include "llcontainerview.h" @@ -41,14 +41,17 @@ #include "llresmgr.h" #include "llstring.h" #include "llscrollcontainer.h" +#include "lluictrlfactory.h" -LLContainerView::LLContainerView(const std::string& name, const LLRect& rect) -: LLView(name, rect, FALSE) +LLContainerView::LLContainerView(const LLContainerView::Params& p) +: LLView(p), + mShowLabel(p.show_label), + mLabel(p.label), + mDisplayChildren(p.display_children) { - mShowLabel = TRUE; mCollapsible = TRUE; - mDisplayChildren = TRUE; mScrollContainer = NULL; + mRectAlpha = 0.25; } LLContainerView::~LLContainerView() @@ -56,6 +59,13 @@ LLContainerView::~LLContainerView() // Children all cleaned up by default view destructor. } +BOOL LLContainerView::postBuild() +{ + setDisplayChildren(mDisplayChildren); + reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + return TRUE; +} + BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -91,7 +101,7 @@ void LLContainerView::draw() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, mRectAlpha)); } // Draw the label @@ -279,7 +289,7 @@ void LLContainerView::setDisplayChildren(const BOOL displayChildren) } } -void LLContainerView::setScrollContainer(LLScrollableContainerView* scroll) +void LLContainerView::setScrollContainer(LLScrollContainer* scroll) { mScrollContainer = scroll; scroll->setPassBackToChildren(false); diff --git a/indra/newview/llcontainerview.h b/indra/llui/llcontainerview.h similarity index 66% rename from indra/newview/llcontainerview.h rename to indra/llui/llcontainerview.h index 1b337b09b..70d994f87 100644 --- a/indra/newview/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -36,36 +36,56 @@ #include "stdtypes.h" #include "lltextbox.h" #include "llstatbar.h" +#include "llview.h" -class LLScrollableContainerView; +class LLScrollContainer; class LLContainerView : public LLView { +public: + struct Params : public LLInitParam::Block + { + Optional label; + Optional show_label; + Optional display_children; + Params() + : label("label"), + show_label("show_label", FALSE), + display_children("display_children", TRUE) + { + changeDefault(mouse_opaque, false); + } + }; protected: - BOOL mDisplayChildren; - std::string mLabel; + LLContainerView(const Params& p); + friend class LLUICtrlFactory; public: - BOOL mCollapsible; -public: - LLContainerView(const std::string& name, const LLRect& rect); ~LLContainerView(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. + /*virtual*/ void draw(); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. void setLabel(const std::string& label); void showLabel(BOOL show) { mShowLabel = show; } void setDisplayChildren(const BOOL displayChildren); BOOL getDisplayChildren() { return mDisplayChildren; } - void setScrollContainer(LLScrollableContainerView* scroll); + void setScrollContainer(LLScrollContainer* scroll); + void setRectAlpha(F32 alpha) { mRectAlpha = alpha; } private: - LLScrollableContainerView* mScrollContainer; + LLScrollContainer* mScrollContainer; void arrange(S32 width, S32 height, BOOL called_from_parent = TRUE); BOOL mShowLabel; + F32 mRectAlpha; +protected: + BOOL mDisplayChildren; + std::string mLabel; +public: + BOOL mCollapsible; }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp new file mode 100644 index 000000000..fa05c03d7 --- /dev/null +++ b/indra/llui/llfiltereditor.cpp @@ -0,0 +1,81 @@ +/** + * @file llfiltereditor.cpp + * @brief LLFilterEditor implementation + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Text editor widget to let users enter a single line. + +#include "linden_common.h" + +#include "llfiltereditor.h" + +static LLRegisterWidget r2("filter_editor"); + +LLFilterEditor::LLFilterEditor(const std::string& name, + const LLRect& rect, + S32 max_length_bytes) +: LLSearchEditor(name,rect,max_length_bytes) +{ + setCommitOnFocusLost(FALSE); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!) +} + + +void LLFilterEditor::handleKeystroke() +{ + this->LLSearchEditor::handleKeystroke(); + + // Commit on every keystroke. + onCommit(); +} + +// static +LLView* LLFilterEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) +{ + std::string name("filter_editor"); + node->getAttributeString("name", name); + + LLRect rect; + createRect(node, rect, parent, LLRect()); + + S32 max_text_length = 128; + node->getAttributeS32("max_length", max_text_length); + + std::string text = node->getValue().substr(0, max_text_length - 1); + + LLFilterEditor* search_editor = new LLFilterEditor(name, + rect, + max_text_length); + + std::string label; + if(node->getAttributeString("label", label)) + { + search_editor->setLabel(label); + } + + search_editor->setText(text); + + search_editor->initFromXML(node, parent); + + return search_editor; +} diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h new file mode 100644 index 000000000..1924823cb --- /dev/null +++ b/indra/llui/llfiltereditor.h @@ -0,0 +1,54 @@ +/** + * @file llfiltereditor.h + * @brief Text editor widget that represents a filter operation + * + * Features: + * Text entry of a single line (text, delete, left and right arrow, insert, return). + * Callbacks either on every keystroke or just on the return key. + * Focus (allow multiple text entry widgets) + * Clipboard (cut, copy, and paste) + * Horizontal scrolling to allow strings longer than widget size allows + * Pre-validation (limit which keys can be used) + * Optional line history so previous entries can be recalled by CTRL UP/DOWN + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_FILTEREDITOR_H +#define LL_FILTEREDITOR_H + +#include "llsearcheditor.h" + +class LLFilterEditor : public LLSearchEditor +{ +public: + LLFilterEditor(const std::string& name, + const LLRect& rect, + S32 max_length_bytes); + static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); +protected: + friend class LLUICtrlFactory; + + /*virtual*/ void handleKeystroke(); +}; + +#endif // LL_FILTEREDITOR_H diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index fde30fa6b..cee6f7500 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -113,13 +113,14 @@ std::string LLFloater::sButtonToolTips[BUTTON_COUNT] = "Edit", //BUTTON_EDIT }; -LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = + +LLFloater::button_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = { - LLFloater::onClickClose, //BUTTON_CLOSE - LLFloater::onClickMinimize, //BUTTON_RESTORE - LLFloater::onClickMinimize, //BUTTON_MINIMIZE - LLFloater::onClickTearOff, //BUTTON_TEAR_OFF - LLFloater::onClickEdit, //BUTTON_EDIT + &LLFloater::onClickClose, //BUTTON_CLOSE + &LLFloater::onClickMinimize, //BUTTON_RESTORE + &LLFloater::onClickMinimize, //BUTTON_MINIMIZE + &LLFloater::onClickTearOff, //BUTTON_TEAR_OFF + &LLFloater::onClickEdit, //BUTTON_EDIT }; LLMultiFloater* LLFloater::sHostp = NULL; @@ -313,67 +314,7 @@ void LLFloater::initFloater(const std::string& title, if( mResizable ) { - // Resize bars (sides) - const S32 RESIZE_BAR_THICKNESS = 3; - mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( - std::string("resizebar_left"), - this, - LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), - min_width, S32_MAX, LLResizeBar::LEFT ); - addChild( mResizeBar[0] ); - - mResizeBar[LLResizeBar::TOP] = new LLResizeBar( - std::string("resizebar_top"), - this, - LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), - min_height, S32_MAX, LLResizeBar::TOP ); - addChild( mResizeBar[1] ); - - mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( - std::string("resizebar_right"), - this, - LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), - min_width, S32_MAX, LLResizeBar::RIGHT ); - addChild( mResizeBar[2] ); - - mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( - std::string("resizebar_bottom"), - this, - LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), - min_height, S32_MAX, LLResizeBar::BOTTOM ); - addChild( mResizeBar[3] ); - - - // Resize handles (corners) - mResizeHandle[0] = new LLResizeHandle( - std::string("Resize Handle"), - LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), - min_width, - min_height, - LLResizeHandle::RIGHT_BOTTOM); - addChild(mResizeHandle[0]); - - mResizeHandle[1] = new LLResizeHandle( - std::string("resize"), - LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), - min_width, - min_height, - LLResizeHandle::RIGHT_TOP ); - addChild(mResizeHandle[1]); - - mResizeHandle[2] = new LLResizeHandle( std::string("resize"), - LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), - min_width, - min_height, - LLResizeHandle::LEFT_BOTTOM ); - addChild(mResizeHandle[2]); - - mResizeHandle[3] = new LLResizeHandle( std::string("resize"), - LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), - min_width, - min_height, - LLResizeHandle::LEFT_TOP ); - addChild(mResizeHandle[3]); + addResizeCtrls(); } // Close button. @@ -413,6 +354,94 @@ void LLFloater::initFloater(const std::string& title, } } +void LLFloater::addResizeCtrls() +{ + // Resize bars (sides) + LLResizeBar::Params p; + p.name("resizebar_left"); + p.resizing_view(this); + p.min_size(mMinWidth); + p.side(LLResizeBar::LEFT); + mResizeBar[LLResizeBar::LEFT] = LLUICtrlFactory::create(p); + addChild( mResizeBar[LLResizeBar::LEFT] ); + + p.name("resizebar_top"); + p.min_size(mMinHeight); + p.side(LLResizeBar::TOP); + + mResizeBar[LLResizeBar::TOP] = LLUICtrlFactory::create(p); + addChild( mResizeBar[LLResizeBar::TOP] ); + + p.name("resizebar_right"); + p.min_size(mMinWidth); + p.side(LLResizeBar::RIGHT); + mResizeBar[LLResizeBar::RIGHT] = LLUICtrlFactory::create(p); + addChild( mResizeBar[LLResizeBar::RIGHT] ); + + p.name("resizebar_bottom"); + p.min_size(mMinHeight); + p.side(LLResizeBar::BOTTOM); + mResizeBar[LLResizeBar::BOTTOM] = LLUICtrlFactory::create(p); + addChild( mResizeBar[LLResizeBar::BOTTOM] ); + + // Resize handles (corners) + LLResizeHandle::Params handle_p; + // handles must not be mouse-opaque, otherwise they block hover events + // to other buttons like the close box. JC + handle_p.mouse_opaque(false); + handle_p.min_width(mMinWidth); + handle_p.min_height(mMinHeight); + handle_p.corner(LLResizeHandle::RIGHT_BOTTOM); + mResizeHandle[0] = LLUICtrlFactory::create(handle_p); + addChild(mResizeHandle[0]); + + handle_p.corner(LLResizeHandle::RIGHT_TOP); + mResizeHandle[1] = LLUICtrlFactory::create(handle_p); + addChild(mResizeHandle[1]); + + handle_p.corner(LLResizeHandle::LEFT_BOTTOM); + mResizeHandle[2] = LLUICtrlFactory::create(handle_p); + addChild(mResizeHandle[2]); + + handle_p.corner(LLResizeHandle::LEFT_TOP); + mResizeHandle[3] = LLUICtrlFactory::create(handle_p); + addChild(mResizeHandle[3]); + + layoutResizeCtrls(); +} + +void LLFloater::layoutResizeCtrls() +{ + LLRect rect; + + // Resize bars (sides) + const S32 RESIZE_BAR_THICKNESS = 3; + rect = LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0); + mResizeBar[LLResizeBar::LEFT]->setRect(rect); + + rect = LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS); + mResizeBar[LLResizeBar::TOP]->setRect(rect); + + rect = LLRect(getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0); + mResizeBar[LLResizeBar::RIGHT]->setRect(rect); + + rect = LLRect(0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0); + mResizeBar[LLResizeBar::BOTTOM]->setRect(rect); + + // Resize handles (corners) + rect = LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0); + mResizeHandle[0]->setRect(rect); + + rect = LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT); + mResizeHandle[1]->setRect(rect); + + rect = LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ); + mResizeHandle[2]->setRect(rect); + + rect = LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ); + mResizeHandle[3]->setRect(rect); +} + void LLFloater::enableResizeCtrls(bool enable, bool width, bool height) { mResizeBar[LLResizeBar::LEFT]->setVisible(enable && width); @@ -1045,7 +1074,8 @@ void LLFloater::setForeground(BOOL front) releaseFocus(); } - setBackgroundOpaque( front ); + if (front || !LLUI::sConfigGroup->getBOOL("FloaterUnfocusedBackgroundOpaque")) // Singu Note: This can be removed when InactiveFloaterTransparency is added + setBackgroundOpaque( front ); } } @@ -1286,60 +1316,49 @@ void LLFloater::setEditModeEnabled(BOOL enable) } -// static -void LLFloater::onClickMinimize(void *userdata) +void LLFloater::onClickMinimize() { - LLFloater* self = (LLFloater*) userdata; - if (!self) return; - - self->setMinimized( !self->isMinimized() ); + setMinimized( !isMinimized() ); } -void LLFloater::onClickTearOff(void *userdata) +void LLFloater::onClickTearOff() { - LLFloater* self = (LLFloater*) userdata; - if (!self) return; - - LLMultiFloater* host_floater = self->getHost(); + LLMultiFloater* host_floater = getHost(); if (host_floater) //Tear off { LLRect new_rect; - host_floater->removeFloater(self); + host_floater->removeFloater(this); // reparent to floater view - gFloaterView->addChild(self); + gFloaterView->addChild(this); - self->open(); /* Flawfinder: ignore */ + open(); /* Flawfinder: ignore */ // only force position for floaters that don't have that data saved - if (self->getRectControl().empty()) + if (getRectControl().empty()) { - new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->getRect().getWidth(), self->getRect().getHeight()); - self->setRect(new_rect); + new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, getRect().getWidth(), getRect().getHeight()); + setRect(new_rect); } - gFloaterView->adjustToFitScreen(self, FALSE); + gFloaterView->adjustToFitScreen(this, FALSE); // give focus to new window to keep continuity for the user - self->setFocus(TRUE); + setFocus(TRUE); } else //Attach to parent. { - LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); + LLMultiFloater* new_host = (LLMultiFloater*)mLastHostHandle.get(); if (new_host) { - self->setMinimized(FALSE); // to reenable minimize button if it was minimized - new_host->showFloater(self); + setMinimized(FALSE); // to reenable minimize button if it was minimized + new_host->showFloater(this); // make sure host is visible new_host->open(); } } } -// static -void LLFloater::onClickEdit(void *userdata) +void LLFloater::onClickEdit() { - LLFloater* self = (LLFloater*) userdata; - if (!self) return; - - self->mEditing = self->mEditing ? FALSE : TRUE; + mEditing = mEditing ? FALSE : TRUE; } // static @@ -1393,13 +1412,9 @@ void LLFloater::closeFocusedFloater() } -// static -void LLFloater::onClickClose( void* userdata ) +void LLFloater::onClickClose() { - LLFloater* self = (LLFloater*) userdata; - if (!self) return; - - self->close(); + close(); } @@ -1561,66 +1576,7 @@ void LLFloater::setCanResize(BOOL can_resize) } else if (!mResizable && can_resize) { - // Resize bars (sides) - const S32 RESIZE_BAR_THICKNESS = 3; - mResizeBar[0] = new LLResizeBar( - std::string("resizebar_left"), - this, - LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), - mMinWidth, S32_MAX, LLResizeBar::LEFT ); - addChild( mResizeBar[0] ); - - mResizeBar[1] = new LLResizeBar( - std::string("resizebar_top"), - this, - LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), - mMinHeight, S32_MAX, LLResizeBar::TOP ); - addChild( mResizeBar[1] ); - - mResizeBar[2] = new LLResizeBar( - std::string("resizebar_right"), - this, - LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), - mMinWidth, S32_MAX, LLResizeBar::RIGHT ); - addChild( mResizeBar[2] ); - - mResizeBar[3] = new LLResizeBar( - std::string("resizebar_bottom"), - this, - LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), - mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); - addChild( mResizeBar[3] ); - - - // Resize handles (corners) - mResizeHandle[0] = new LLResizeHandle( - std::string("Resize Handle"), - LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), - mMinWidth, - mMinHeight, - LLResizeHandle::RIGHT_BOTTOM); - addChild(mResizeHandle[0]); - - mResizeHandle[1] = new LLResizeHandle( std::string("resize"), - LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), - mMinWidth, - mMinHeight, - LLResizeHandle::RIGHT_TOP ); - addChild(mResizeHandle[1]); - - mResizeHandle[2] = new LLResizeHandle( std::string("resize"), - LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), - mMinWidth, - mMinHeight, - LLResizeHandle::LEFT_BOTTOM ); - addChild(mResizeHandle[2]); - - mResizeHandle[3] = new LLResizeHandle( std::string("resize"), - LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), - mMinWidth, - mMinHeight, - LLResizeHandle::LEFT_TOP ); - addChild(mResizeHandle[3]); + addResizeCtrls(); enableResizeCtrls(can_resize); } mResizable = can_resize; @@ -1716,8 +1672,7 @@ void LLFloater::buildButtons() sButtonActiveImageNames[i], sButtonPressedImageNames[i], LLStringUtil::null, - sButtonCallbacks[i], - this, + boost::bind(sButtonCallbacks[i],this), LLFontGL::getFontSansSerif()); buttonp->setTabStop(FALSE); @@ -1740,7 +1695,7 @@ void LLFloater::buildButtons() // LLFloaterView LLFloaterView::LLFloaterView( const std::string& name, const LLRect& rect ) -: LLUICtrl( name, rect, FALSE, NULL, NULL, FOLLOWS_ALL ), +: LLUICtrl( name, rect, FALSE, NULL, FOLLOWS_ALL ), mFocusCycleMode(FALSE), mSnapOffsetBottom(0) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 421f03efa..9a9fa9d19 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -237,10 +237,10 @@ public: return LLNotification::Params(name).context(mNotificationContext); } - static void onClickClose(void *userdata); - static void onClickMinimize(void *userdata); - static void onClickTearOff(void *userdata); - static void onClickEdit(void *userdata); + void onClickClose(); + void onClickMinimize(); + void onClickTearOff(); + void onClickEdit(); static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; } static void setEditModeEnabled(BOOL enable); @@ -269,6 +269,8 @@ private: void updateButtons(); void buildButtons(); BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index); + void addResizeCtrls(); + void layoutResizeCtrls(); LLRect mExpandedRect; LLDragHandle* mDragHandle; @@ -313,8 +315,10 @@ private: static std::string sButtonPressedImageNames[BUTTON_COUNT]; static std::string sButtonNames[BUTTON_COUNT]; static std::string sButtonToolTips[BUTTON_COUNT]; - typedef void (*click_callback)(void *); - static click_callback sButtonCallbacks[BUTTON_COUNT]; + + typedef void (LLFloater::*button_callback)(); + + static button_callback sButtonCallbacks[BUTTON_COUNT]; typedef std::map, LLFloater*> handle_map_t; typedef std::map, LLFloater*>::iterator handle_map_iter_t; diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 9b0f1d038..1e4a5dcec 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -49,7 +49,7 @@ LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID : LLUICtrl(name, rect, FALSE, // mouse opaque - NULL, NULL, + NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mColor( LLColor4::white ) { @@ -61,7 +61,7 @@ LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::s : LLUICtrl(name, rect, FALSE, // mouse opaque - NULL, NULL, + NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mColor( LLColor4::white ), mImageName(image_name) diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 547ff4088..972209859 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -42,31 +42,25 @@ const U32 KEYWORD_FILE_CURRENT_VERSION = 2; -inline BOOL LLKeywordToken::isHead(const llwchar* s, bool search_end_c_comment) const +inline BOOL LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare + BOOL res = TRUE; const llwchar* t = mToken.c_str(); S32 len = mToken.size(); - if (search_end_c_comment && len == 2 && t[0] == '/' && t[1] == '*') - { - // Special case for C-like */ end comment token - if (s[0] == '*' && s[1] == '/') - { - return TRUE; - } - else - { - return FALSE; - } - } - for (S32 i = 0; i < len; i++) + for (S32 i=0; i= other_end) + { + // We've hit the end of other. + // This covers two cases: other being shorter than self, or the strings being equal. + // In either case, we want to return false. + result = false; + break; + } + else if(self_iter >= self_end) + { + // self is shorter than other. + result = true; + break; + } + else if(*self_iter != *other_iter) + { + // The current character differs. The strings are not equal. + result = *self_iter < *other_iter; + break; + } + + self_iter++; + other_iter++; + } + + return result; +} LLColor3 LLKeywords::readColor( const std::string& s ) { F32 r, g, b; r = g = b = 0.0f; - S32 read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b ); - if( read != 3 ) /* Flawfinder: ignore */ + S32 values_read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b ); + if( values_read != 3 ) { llinfos << " poorly formed color in keyword file" << llendl; } return LLColor3( r, g, b ); } +LLFastTimer::DeclareTimer FTM_SYNTAX_COLORING("Syntax Coloring"); + // Walk through a string, applying the rules specified by the keyword token list and // create a list of color segments. -void LLKeywords::findSegments(std::vector* seg_list, const LLWString& wtext, const LLColor4 &defaultColor) +void LLKeywords::findSegments(std::vector* seg_list, const LLWString& wtext, const LLColor4 &defaultColor) { - std::for_each(seg_list->begin(), seg_list->end(), DeletePointer()); + LLFastTimer ft(FTM_SYNTAX_COLORING); seg_list->clear(); if( wtext.empty() ) @@ -290,7 +367,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS return; } - S32 text_len = wtext.size(); + S32 text_len = wtext.size() + 1; seg_list->push_back( new LLTextSegment( LLColor3(defaultColor), 0, text_len ) ); @@ -343,9 +420,9 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS } S32 seg_end = cur - base; - LLTextSegment* text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end ); + LLTextSegmentPtr text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end ); text_segment->setToken( cur_token ); - insertSegment( seg_list, text_segment, text_len, defaultColor); + insertSegment( *seg_list, text_segment, text_len, defaultColor); line_done = TRUE; // to break out of second loop. break; } @@ -387,17 +464,15 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS S32 seg_end = 0; seg_start = cur - base; - cur += cur_delimiter->getLength(); + cur += cur_delimiter->getLengthHead(); - //if( cur_delimiter->getType() == LLKeywordToken::TWO_SIDED_DELIMITER ) LLKeywordToken::TOKEN_TYPE type = cur_delimiter->getType(); - if( type == LLKeywordToken::TWO_SIDED_DELIMITER || type == LLKeywordToken::TWO_SIDED_DELIMITER_ESC ) + if( type == LLKeywordToken::TWO_SIDED_DELIMITER || type == LLKeywordToken::DOUBLE_QUOTATION_MARKS ) { - //llassert( cur_delimiter->getDelimiter() != NULL ); - while( *cur && !cur_delimiter->isTail(cur) ) + while( *cur && !cur_delimiter->isTail(cur)) { // Check for an escape sequence. - if (type == LLKeywordToken::TWO_SIDED_DELIMITER_ESC && *cur == '\\') + if (type == LLKeywordToken::DOUBLE_QUOTATION_MARKS && *cur == '\\') { // Count the number of backslashes. S32 num_backslashes = 0; @@ -433,13 +508,13 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS if( *cur ) { - cur += cur_delimiter->getLength(); - seg_end = seg_start + between_delimiters + cur_delimiter->getLength() + cur_delimiter->getLength2(); + cur += cur_delimiter->getLengthHead(); + seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead() + cur_delimiter->getLengthTail(); } else { // eof - seg_end = seg_start + between_delimiters + cur_delimiter->getLength(); + seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead(); } } else @@ -451,13 +526,13 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS between_delimiters++; cur++; } - seg_end = seg_start + between_delimiters + cur_delimiter->getLength(); + seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead(); } - LLTextSegment* text_segment = new LLTextSegment( cur_delimiter->getColor(), seg_start, seg_end ); + LLTextSegmentPtr text_segment = new LLTextSegment( cur_delimiter->getColor(), seg_start, seg_end ); text_segment->setToken( cur_delimiter ); - insertSegment( seg_list, text_segment, text_len, defaultColor); + insertSegment( *seg_list, text_segment, text_len, defaultColor); // Note: we don't increment cur, since the end of one delimited seg may be immediately // followed by the start of another one. @@ -477,7 +552,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS S32 seg_len = p - cur; if( seg_len > 0 ) { - LLWString word( cur, 0, seg_len ); + WStringMapIndex word( cur, seg_len ); word_token_map_t::iterator map_iter = mWordTokenMap.find(word); if( map_iter != mWordTokenMap.end() ) { @@ -488,9 +563,9 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS // llinfos << "Seg: [" << word.c_str() << "]" << llendl; - LLTextSegment* text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end ); + LLTextSegmentPtr text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end ); text_segment->setToken( cur_token ); - insertSegment( seg_list, text_segment, text_len, defaultColor); + insertSegment( *seg_list, text_segment, text_len, defaultColor); } cur += seg_len; continue; @@ -505,25 +580,24 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS } } -void LLKeywords::insertSegment(std::vector* seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor ) +void LLKeywords::insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor ) { - LLTextSegment* last = seg_list->back(); + LLTextSegmentPtr last = seg_list.back(); S32 new_seg_end = new_segment->getEnd(); if( new_segment->getStart() == last->getStart() ) { - *last = *new_segment; - delete new_segment; + seg_list.pop_back(); } else { last->setEnd( new_segment->getStart() ); - seg_list->push_back( new_segment ); } + seg_list.push_back( new_segment ); if( new_seg_end < text_len ) { - seg_list->push_back( new LLTextSegment( defaultColor, new_seg_end, text_len ) ); + seg_list.push_back( new LLTextSegment( defaultColor, new_seg_end, text_len ) ); } } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 5c55157ac..b6b7a9fdd 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -39,14 +39,32 @@ #include #include #include +#include "llpointer.h" class LLTextSegment; - +typedef LLPointer LLTextSegmentPtr; class LLKeywordToken { public: - enum TOKEN_TYPE { WORD, LINE, TWO_SIDED_DELIMITER, ONE_SIDED_DELIMITER, TWO_SIDED_DELIMITER_ESC }; + /** + * @brief Types of tokens/delimters being parsed. + * + * @desc Tokens/delimiters that need to be identified/highlighted. All are terminated if an EOF is encountered. + * - WORD are keywords in the normal sense, i.e. constants, events, etc. + * - LINE are for entire lines (currently only flow control labels use this). + * - ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL. + * - TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with. + * - DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close. + */ + enum TOKEN_TYPE + { + WORD, + LINE, + TWO_SIDED_DELIMITER, + ONE_SIDED_DELIMITER, + DOUBLE_QUOTATION_MARKS + }; LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) : @@ -58,9 +76,9 @@ public: { } - S32 getLength() const { return mToken.size(); } - S32 getLength2() const { return mDelimiter.size(); } - BOOL isHead(const llwchar* s, bool search_end_c_comment = false) const; + S32 getLengthHead() const { return mToken.size(); } + S32 getLengthTail() const { return mDelimiter.size(); } + BOOL isHead(const llwchar* s) const; BOOL isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } const LLColor3& getColor() const { return mColor; } @@ -89,7 +107,7 @@ public: BOOL loadFromFile(const std::string& filename); BOOL isLoaded() const { return mLoaded; } - void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor ); + void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor ); // Add the token as described void addToken(LLKeywordToken::TOKEN_TYPE type, @@ -97,8 +115,33 @@ public: const LLColor3& color, const std::string& tool_tip = LLStringUtil::null, const std::string& delimiter = LLStringUtil::null); + + // This class is here as a performance optimization. + // The word token map used to be defined as std::map. + // This worked, but caused a performance bottleneck due to memory allocation and string copies + // because it's not possible to search such a map without creating an LLWString. + // Using this class as the map index instead allows us to search using segments of an existing + // text run without copying them first, which greatly reduces overhead in LLKeywords::findSegments(). + class WStringMapIndex + { + public: + // copy constructor + WStringMapIndex(const WStringMapIndex& other); + // constructor from a string (copies the string's data into the new object) + WStringMapIndex(const LLWString& str); + // constructor from pointer and length + // NOTE: does NOT copy data, caller must ensure that the lifetime of the pointer exceeds that of the new object! + WStringMapIndex(const llwchar *start, size_t length); + ~WStringMapIndex(); + bool operator<(const WStringMapIndex &other) const; + private: + void copyData(const llwchar *start, size_t length); + const llwchar *mData; + size_t mLength; + bool mOwner; + }; - typedef std::map word_token_map_t; + typedef std::map word_token_map_t; typedef word_token_map_t::const_iterator keyword_iterator_t; keyword_iterator_t begin() const { return mWordTokenMap.begin(); } keyword_iterator_t end() const { return mWordTokenMap.end(); } @@ -109,7 +152,7 @@ public: private: LLColor3 readColor(const std::string& s); - void insertSegment(std::vector *seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor); + void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor); BOOL mLoaded; word_token_map_t mWordTokenMap; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 7ba0bf599..811de99a9 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -93,16 +93,15 @@ static LLRegisterWidget r1("line_editor"); LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, const std::string& default_text, const LLFontGL* font, S32 max_length_bytes, - void (*commit_callback)(LLUICtrl* caller, void* user_data ), - void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), - void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data ), - void* userdata, - LLLinePrevalidateFunc prevalidate_func, + commit_callback_t commit_callback, + keystroke_callback_t keystroke_callback, + focus_lost_callback_t focus_lost_callback, + validate_func_t prevalidate_func, LLViewBorder::EBevel border_bevel, LLViewBorder::EStyle border_style, S32 border_thickness) : - LLUICtrl( name, rect, TRUE, commit_callback, userdata, FOLLOWS_TOP | FOLLOWS_LEFT ), + LLUICtrl( name, rect, TRUE, commit_callback, FOLLOWS_TOP | FOLLOWS_LEFT ), mMaxLengthBytes(max_length_bytes), mCursorPos( 0 ), mScrollHPos( 0 ), @@ -142,6 +141,9 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, mSpellCheckable( FALSE ), mContextMenuHandle() { + if(focus_lost_callback) + setFocusLostCallback(focus_lost_callback); + llassert( max_length_bytes > 0 ); // Initialize current history line iterator @@ -156,9 +158,6 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, mGLFont = LLFontGL::getFontSansSerifSmall(); } - if(focus_lost_callback) - setFocusLostCallback(boost::bind(focus_lost_callback,_1,(void*)NULL)); - setTextPadding(0, 0); mScrollTimer.reset(); @@ -1112,9 +1111,8 @@ void LLLineEditor::cut() reportBadKeystroke(); } else - if( mKeystrokeCallback ) { - mKeystrokeCallback( this, mCallbackUserData ); + onKeystroke(); } } } @@ -1160,8 +1158,10 @@ void LLLineEditor::insert(std::string what, S32 wher) rollback.doRollback( this ); reportBadKeystroke(); } - else if( mKeystrokeCallback ) - mKeystrokeCallback( this, mCallbackUserData ); + else + { + onKeystroke(); + } } BOOL LLLineEditor::canPaste() const @@ -1261,9 +1261,8 @@ void LLLineEditor::pasteHelper(bool is_primary) reportBadKeystroke(); } else - if( mKeystrokeCallback ) { - mKeystrokeCallback( this, mCallbackUserData ); + onKeystroke(); } } } @@ -1582,10 +1581,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) // Notify owner if requested if (!need_to_rollback && handled) { - if (mKeystrokeCallback) - { - mKeystrokeCallback(this, mCallbackUserData); - } + onKeystroke(); } } } @@ -1637,12 +1633,10 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) // Notify owner if requested if( !need_to_rollback && handled ) { - if( mKeystrokeCallback ) - { - // HACK! The only usage of this callback doesn't do anything with the character. - // We'll have to do something about this if something ever changes! - Doug - mKeystrokeCallback( this, mCallbackUserData ); - } + // HACK! The only usage of this callback doesn't do anything with the character. + // We'll have to do something about this if something ever changes! - Doug + onKeystroke(); + } } return handled; @@ -1651,7 +1645,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) BOOL LLLineEditor::canDoDelete() const { - return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); + return ( !mReadOnly && mText.length() > 0 && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); } void LLLineEditor::doDelete() @@ -1680,10 +1674,7 @@ void LLLineEditor::doDelete() } else { - if( mKeystrokeCallback ) - { - mKeystrokeCallback( this, mCallbackUserData ); - } + onKeystroke(); } } } @@ -1757,7 +1748,8 @@ void LLLineEditor::draw() } // draw rectangle for the background - LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 ); + //LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 ); + LLRect background = getLocalRect(); background.stretch( -mBorderThickness ); LLColor4 bg_color = mReadOnlyBgColor; @@ -2131,7 +2123,7 @@ void LLLineEditor::setRect(const LLRect& rect) } } -void LLLineEditor::setPrevalidate(BOOL (*func)(const LLWString &)) +void LLLineEditor::setPrevalidate(LLLineEditor::validate_func_t func) { mPrevalidateFunc = func; updateAllowingLanguageInput(); @@ -2483,12 +2475,21 @@ void LLLineEditor::setSelectAllonFocusReceived(BOOL b) mSelectAllonFocusReceived = b; } - -void LLLineEditor::setKeystrokeCallback(void (*keystroke_callback)(LLLineEditor* caller, void* user_data)) +void LLLineEditor::onKeystroke() { - mKeystrokeCallback = keystroke_callback; + if (mKeystrokeCallback) + { + mKeystrokeCallback(this); + } } +void LLLineEditor::setKeystrokeCallback(keystroke_callback_t callback) +{ + mKeystrokeCallback = callback; +} + + + // virtual LLXMLNodePtr LLLineEditor::getXML(bool save_children) const { @@ -2579,14 +2580,11 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory S32 border_thickness = 1; node->getAttributeS32("border_thickness", border_thickness); - LLUICtrlCallback commit_callback = NULL; - LLLineEditor* line_editor = new LLLineEditor(name, rect, text, font, max_text_length, - commit_callback, NULL, NULL, NULL, @@ -2833,10 +2831,8 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, // Update of the preedit should be caused by some key strokes. mKeystrokeTimer.reset(); - if( mKeystrokeCallback ) - { - mKeystrokeCallback( this, mCallbackUserData ); - } + onKeystroke(); + } BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const @@ -3093,156 +3089,3 @@ void LLLineEditor::setContextMenu(LLMenuGL* new_context_menu) mContextMenuHandle.markDead(); } -static LLRegisterWidget r2("search_editor"); - - -LLSearchEditor::LLSearchEditor(const std::string& name, - const LLRect& rect, - S32 max_length_bytes, - void (*search_callback)(const std::string& search_string, void* user_data), - void* userdata) - : - LLUICtrl(name, rect, TRUE, NULL, userdata), - mSearchCallback(search_callback) -{ - LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0); - mSearchEdit = new LLLineEditor(std::string("search edit"), - search_edit_rect, - LLStringUtil::null, - NULL, - max_length_bytes, - NULL, - onSearchEdit, - NULL, - this); - - mSearchEdit->setFollowsAll(); - mSearchEdit->setSelectAllonFocusReceived(TRUE); - - addChild(mSearchEdit); - - S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor - LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0); - mClearSearchButton = new LLButton(std::string("clear search"), - clear_btn_rect, - std::string("icn_clear_lineeditor.tga"), - std::string("UIImgBtnCloseInactiveUUID"), - LLStringUtil::null, - onClearSearch, - this, - NULL, - LLStringUtil::null); - mClearSearchButton->setFollowsRight(); - mClearSearchButton->setFollowsTop(); - mClearSearchButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor")); - mClearSearchButton->setTabStop(FALSE); - mSearchEdit->addChild(mClearSearchButton); - - mSearchEdit->setTextPadding(0, btn_width); -} - - -//virtual -void LLSearchEditor::setValue(const LLSD& value ) -{ - mSearchEdit->setValue(value); -} - -//virtual -LLSD LLSearchEditor::getValue() const -{ - return mSearchEdit->getValue(); -} - -//virtual -BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) -{ - return mSearchEdit->setTextArg(key, text); -} - -//virtual -BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) -{ - return mSearchEdit->setLabelArg(key, text); -} - -//virtual -void LLSearchEditor::clear() -{ - if (mSearchEdit) - { - mSearchEdit->clear(); - } -} - -void LLSearchEditor::draw() -{ - mClearSearchButton->setVisible(!mSearchEdit->getWText().empty()); - - LLUICtrl::draw(); -} - - -//static -void LLSearchEditor::onSearchEdit(LLLineEditor* caller, void* user_data ) -{ - LLSearchEditor* search_editor = (LLSearchEditor*)user_data; - if (search_editor->mSearchCallback) - { - search_editor->mSearchCallback(caller->getText(), search_editor->mCallbackUserData); - } -} - -//static -void LLSearchEditor::onClearSearch(void* user_data) -{ - LLSearchEditor* search_editor = (LLSearchEditor*)user_data; - - search_editor->setText(LLStringUtil::null); - if (search_editor->mSearchCallback) - { - search_editor->mSearchCallback(LLStringUtil::null, search_editor->mCallbackUserData); - } -} - -// virtual -LLXMLNodePtr LLSearchEditor::getXML(bool save_children) const -{ - LLXMLNodePtr node = LLUICtrl::getXML(); - - node->setName(LL_SEARCH_EDITOR_TAG); - - return node; -} - -// static -LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("search_editor"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - S32 max_text_length = 128; - node->getAttributeS32("max_length", max_text_length); - - std::string text = node->getValue().substr(0, max_text_length - 1); - - LLSearchEditor* search_editor = new LLSearchEditor(name, - rect, - max_text_length, - NULL, NULL); - - std::string label; - if(node->getAttributeString("label", label)) - { - search_editor->mSearchEdit->setLabel(label); - } - - search_editor->setText(text); - - search_editor->initFromXML(node, parent); - - return search_editor; -} diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 280fafbca..c665ad96c 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -58,24 +58,24 @@ class LLLineEditorRollback; class LLButton; class LLMenuGL; -typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr); - - class LLLineEditor : public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor { public: + typedef boost::function keystroke_callback_t; + typedef boost::function focus_lost_callback_t; + typedef boost::function validate_func_t; + LLLineEditor(const std::string& name, const LLRect& rect, const std::string& default_text = LLStringUtil::null, const LLFontGL* glfont = NULL, S32 max_length_bytes = 254, - void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, - void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, - void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data) = NULL, - void* userdata = NULL, - LLLinePrevalidateFunc prevalidate_func = NULL, + commit_callback_t commit_callback = NULL, + keystroke_callback_t keystroke_callback = NULL, + focus_lost_callback_t focus_lost_callback = NULL, + validate_func_t prevalidate_func = NULL, LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN, LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE, S32 border_thickness = 1); @@ -230,13 +230,14 @@ public: void setSelectAllonFocusReceived(BOOL b); void setSelectAllonCommit(BOOL b) { mSelectAllonCommit = b; } - void setKeystrokeCallback(void (*keystroke_callback)(LLLineEditor* caller, void* user_data)); + void onKeystroke(); + void setKeystrokeCallback(keystroke_callback_t callback); void setMaxTextLength(S32 max_text_length); void setTextPadding(S32 left, S32 right); // Used to specify room for children before or after text. // Prevalidation controls which keystrokes can affect the editor - void setPrevalidate( BOOL (*func)(const LLWString &) ); + void setPrevalidate( validate_func_t func ); static BOOL prevalidateFloat(const LLWString &str ); static BOOL prevalidateInt(const LLWString &str ); static BOOL prevalidatePositiveS32(const LLWString &str); @@ -323,7 +324,7 @@ protected: BOOL mCommitOnFocusLost; BOOL mRevertOnEsc; - void (*mKeystrokeCallback)( LLLineEditor* caller, void* userdata ); + keystroke_callback_t mKeystrokeCallback; BOOL mIsSelecting; // Selection for clipboard operations S32 mSelectionStart; @@ -333,8 +334,7 @@ protected: S32 mLastSelectionStart; S32 mLastSelectionEnd; - S32 (*mPrevalidateFunc)(const LLWString &str); - + validate_func_t mPrevalidateFunc; LLFrameTimer mKeystrokeTimer; LLColor4 mCursorColor; @@ -418,46 +418,4 @@ private: -/* - * @brief A line editor with a button to clear it and a callback to call on every edit event. - */ -class LLSearchEditor : public LLUICtrl -{ -public: - LLSearchEditor(const std::string& name, - const LLRect& rect, - S32 max_length_bytes, - void (*search_callback)(const std::string& search_string, void* user_data), - void* userdata); - - virtual ~LLSearchEditor() {} - - /*virtual*/ void draw(); - - virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - - void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); } - - typedef boost::function search_callback_t; - void setSearchCallback(search_callback_t cb,void *user_data) { mSearchCallback = boost::bind(cb,_1,user_data); } - - // LLUICtrl interface - virtual void setValue(const LLSD& value ); - virtual LLSD getValue() const; - virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - virtual void clear(); - -private: - static void onSearchEdit(LLLineEditor* caller, void* user_data ); - static void onClearSearch(void* user_data); - - LLLineEditor* mSearchEdit; - class LLButton* mClearSearchButton; - - search_callback_t mSearchCallback; - -}; - #endif // LL_LINEEDITOR_ diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index f8f31440c..f1f61a045 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -136,7 +136,7 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f; // Default constructor LLMenuItemGL::LLMenuItemGL( const std::string& name, const std::string& label, KEY key, MASK mask ) : - LLUICtrl( name, LLRect(), TRUE, NULL, NULL ), + LLUICtrl( name ), mJumpKey(KEY_NONE), mAllowKeyRepeat(FALSE), mHighlight( FALSE ), @@ -268,19 +268,6 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list *listp) accelerator = *list_it; if ((accelerator->mKey == mAcceleratorKey) && (accelerator->mMask == (mAcceleratorMask & MASK_NORMALKEYS))) { - - // *NOTE: get calling code to throw up warning or route - // warning messages back to app-provided output - // std::string warning; - // warning.append("Duplicate key binding <"); - // appendAcceleratorString( warning ); - // warning.append("> for menu items:\n "); - // warning.append(accelerator->mName); - // warning.append("\n "); - // warning.append(mLabel); - - // llwarns << warning << llendl; - // LLAlertDialog::modalAlert(warning); return FALSE; } } @@ -1826,7 +1813,7 @@ static LLRegisterWidget r1("menu"); // Default constructor LLMenuGL::LLMenuGL( const std::string& name, const std::string& label ) -: LLUICtrl( name, LLRect(), FALSE, NULL, NULL ), +: LLUICtrl( name, LLRect(), FALSE), mBackgroundColor( sDefaultBackgroundColor ), mBgVisible( TRUE ), mHasSelection( FALSE ), @@ -1852,7 +1839,7 @@ LLMenuGL::LLMenuGL( const std::string& name, const std::string& label ) } LLMenuGL::LLMenuGL( const std::string& label) -: LLUICtrl( label, LLRect(), FALSE, NULL, NULL ), +: LLUICtrl( label, LLRect(), FALSE), mBackgroundColor( sDefaultBackgroundColor ), mBgVisible( TRUE ), mHasSelection( FALSE ), @@ -2257,6 +2244,11 @@ void LLMenuGL::removeChild( LLView* ctrl) return LLUICtrl::removeChild(ctrl); } +BOOL LLMenuGL::postBuild() +{ + return LLUICtrl::postBuild(); +} + // are we the childmost active menu and hence our jump keys should be enabled? // or are we a free-standing torn-off menu (which uses jump keys too) BOOL LLMenuGL::jumpKeysActive() @@ -3757,9 +3749,9 @@ void LLPieMenu::draw() F32 center_y = height/2; S32 steps = 100; - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef(center_x, center_y, 0.f); + gGL.translateUI(center_x, center_y, 0.f); F32 line_width = LLUI::sConfigGroup->getF32("PieMenuLineWidth"); LLColor4 line_color = LLUI::sColorsGroup->getColor("PieMenuLineColor"); @@ -3807,7 +3799,7 @@ void LLPieMenu::draw() LLUI::setLineWidth(1.0f); } - gGL.popMatrix(); + gGL.popUIMatrix(); mHoverThisFrame = FALSE; @@ -3823,9 +3815,9 @@ void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color) S32 steps = 100; gGL.color4fv( color.mV ); - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef(center_x - itemp->getRect().mLeft, center_y - itemp->getRect().mBottom, 0.f); + gGL.translateUI(center_x - itemp->getRect().mLeft, center_y - itemp->getRect().mBottom, 0.f); item_list_t::iterator item_iter; S32 i = 0; @@ -3845,7 +3837,7 @@ void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color) i++; } } - gGL.popMatrix(); + gGL.popUIMatrix(); } // virtual diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 99a46027e..f0b140b40 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -57,8 +57,7 @@ S32 LLMultiSlider::mNameCounter = 0; LLMultiSlider::LLMultiSlider( const std::string& name, const LLRect& rect, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, @@ -69,8 +68,7 @@ LLMultiSlider::LLMultiSlider( BOOL use_triangle, const std::string& control_name) : - LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata, - FOLLOWS_LEFT | FOLLOWS_TOP), + LLUICtrl( name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP), mInitialValue( initial_value ), mMinValue( min_value ), @@ -659,7 +657,6 @@ LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor LLMultiSlider* multiSlider = new LLMultiSlider(name, rect, NULL, - NULL, initial_value, min_value, max_value, diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index f8363fd97..a56b59cce 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -44,8 +44,7 @@ public: LLMultiSlider( const std::string& name, const LLRect& rect, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index c3a0f5a6b..1cd91c3a4 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -60,14 +60,12 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect S32 text_left, BOOL show_text, BOOL can_edit_text, - void (*commit_callback)(LLUICtrl*, void*), - void* callback_user_data, F32 initial_value, F32 min_value, F32 max_value, F32 increment, S32 max_sliders, BOOL allow_overlap, BOOL draw_track, BOOL use_triangle, const std::string& control_which) - : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), + : LLUICtrl(name, rect, TRUE ), mFont(font), mShowText( show_text ), mCanEditText( can_edit_text ), @@ -107,7 +105,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect mMultiSlider = new LLMultiSlider( std::string("multi_slider"), slider_rect, - LLMultiSliderCtrl::onSliderCommit, this, + boost::bind(&LLMultiSliderCtrl::onSliderCommit,this,_2), initial_value, min_value, max_value, increment, max_sliders, allow_overlap, draw_track, use_triangle, @@ -123,8 +121,10 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect mEditor = new LLLineEditor( std::string("MultiSliderCtrl Editor"), text_rect, LLStringUtil::null, font, MAX_STRING_LENGTH, - &LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this, - &LLLineEditor::prevalidateFloat ); + boost::bind(&LLMultiSliderCtrl::onEditorCommit,this,_2), + NULL, + NULL, + boost::bind(&LLLineEditor::prevalidateFloat, _1) ); mEditor->setFollowsLeft(); mEditor->setFollowsBottom(); mEditor->setFocusReceivedCallback( boost::bind(&LLMultiSliderCtrl::onFocusReceived, this) ); @@ -278,26 +278,22 @@ void LLMultiSliderCtrl::updateText() } } -// static -void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) +void LLMultiSliderCtrl::onEditorCommit(const LLSD& value) { - LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata; - llassert( caller == self->mEditor ); - BOOL success = FALSE; - F32 val = self->mCurValue; - F32 saved_val = self->mCurValue; + F32 val = mCurValue; + F32 saved_val = mCurValue; - std::string text = self->mEditor->getText(); + std::string text = value.asString(); if( LLLineEditor::postvalidateFloat( text ) ) { LLLocale locale(LLLocale::USER_LOCALE); val = (F32) atof( text.c_str() ); - if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() ) + if( mMultiSlider->getMinValue() <= val && val <= mMultiSlider->getMaxValue() ) { - self->setCurSliderValue( val ); - if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && - (!self->mValidateSignal || (*(self->mValidateSignal))(self, val))) + setCurSliderValue( val ); + if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) && + (!mValidateSignal || (*(mValidateSignal))(this, val))) { success = TRUE; } @@ -306,49 +302,45 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) if( success ) { - self->onCommit(); + onCommit(); } else { - if( self->getCurSliderValue() != saved_val ) + if( getCurSliderValue() != saved_val ) { - self->setCurSliderValue( saved_val ); + setCurSliderValue( saved_val ); } - self->reportInvalidData(); + reportInvalidData(); } - self->updateText(); + updateText(); } -// static -void LLMultiSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata ) +void LLMultiSliderCtrl::onSliderCommit(const LLSD& value) { - LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata; - //llassert( caller == self->mSlider ); - BOOL success = FALSE; - F32 saved_val = self->mCurValue; - F32 new_val = self->mMultiSlider->getCurSliderValue(); + F32 saved_val = mCurValue; + F32 new_val = mMultiSlider->getCurSliderValue(); - self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. - if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && - (!self->mValidateSignal || (*(self->mValidateSignal))(self, new_val ))) + mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. + if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) && + (!mValidateSignal || (*mValidateSignal)(this, new_val ) )) { success = TRUE; } if( success ) { - self->onCommit(); + onCommit(); } else { - if( self->mCurValue != saved_val ) + if( mCurValue != saved_val ) { - self->setCurSliderValue( saved_val ); + setCurSliderValue( saved_val ); } - self->reportInvalidData(); + reportInvalidData(); } - self->updateText(); + updateText(); } void LLMultiSliderCtrl::setEnabled(BOOL b) @@ -561,8 +553,6 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa } } - LLUICtrlCallback callback = NULL; - if (label.empty()) { label.assign(node->getTextContents()); @@ -576,8 +566,6 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa rect.getWidth() - text_left, show_text, can_edit_text, - callback, - NULL, initial_value, min_value, max_value, diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 05e15178c..896062c00 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -64,8 +64,6 @@ public: S32 text_left, BOOL show_text, BOOL can_edit_text, - void (*commit_callback)(LLUICtrl*, void*), - void* callback_userdata, F32 initial_value, F32 min_value, F32 max_value, F32 increment, S32 max_sliders, BOOL allow_overlap, BOOL draw_track, BOOL use_triangle, @@ -123,10 +121,9 @@ public: virtual void setControlName(const std::string& control_name, LLView* context); virtual std::string getControlName() const; - static void onSliderCommit(LLUICtrl* caller, void* userdata); + void onSliderCommit(const LLSD& value); - static void onEditorCommit(LLUICtrl* ctrl, void* userdata); - static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); + void onEditorCommit(const LLSD& value); private: void updateText(); diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index c512f6816..b950d5274 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -880,6 +880,7 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt assert(!wasFound); if (passesFilter) { + llinfos << "Inserting " << pNotification->getName() << llendl; // not in our list, add it and say so mItems.insert(pNotification); abortProcessing = mChanged(payload); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 8a22df234..27d0111fc 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -36,7 +36,6 @@ #include "llpanel.h" -#include "llalertdialog.h" #include "llfocusmgr.h" #include "llfontgl.h" #include "lllocalcliprect.h" @@ -92,7 +91,7 @@ LLPanel::LLPanel() } LLPanel::LLPanel(const std::string& name) -: LLUICtrl(name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL), +: LLUICtrl(name), mRectControl() { init(); @@ -100,7 +99,7 @@ LLPanel::LLPanel(const std::string& name) LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered) -: LLUICtrl(name, rect, TRUE, NULL, NULL), +: LLUICtrl(name,rect), mRectControl() { init(); @@ -112,7 +111,7 @@ LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered) LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL bordered) -: LLUICtrl(name, LLUI::sConfigGroup->getRect(rect_control), TRUE, NULL, NULL), +: LLUICtrl(name, LLUI::sConfigGroup->getRect(rect_control)), mRectControl( rect_control ) { init(); @@ -186,19 +185,14 @@ void LLPanel::draw() // draw background if( mBgVisible ) { - //RN: I don't see the point of this - S32 left = 0;//LLPANEL_BORDER_WIDTH; - S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH; - S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH; - S32 bottom = 0;//LLPANEL_BORDER_WIDTH; - + LLRect local_rect = getLocalRect(); if (mBgOpaque ) { - gl_rect_2d( left, top, right, bottom, mBgColorOpaque ); + gl_rect_2d( local_rect, mBgColorOpaque ); } else { - gl_rect_2d( left, top, right, bottom, mBgColorAlpha ); + gl_rect_2d( local_rect, mBgColorAlpha ); } } @@ -611,6 +605,11 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent) setLabel(label); } +bool LLPanel::hasString(const std::string& name) +{ + return mUIStrings.find(name) != mUIStrings.end(); +} + std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const { ui_string_map_t::const_iterator found_it = mUIStrings.find(name); @@ -916,29 +915,6 @@ LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const } return NULL; } - -void LLPanel::childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data) -{ - LLLineEditor* child = getChild(id); - if (child) - { - child->setKeystrokeCallback(keystroke_callback); - if (user_data) - { - child->setCallbackUserData(user_data); - } - } -} - -void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ) -{ - LLLineEditor* child = getChild(id); - if (child) - { - child->setPrevalidate(func); - } -} - void LLPanel::childSetWrappedText(const std::string& id, const std::string& text, bool visible) { LLTextBox* child = getChild(id); @@ -949,14 +925,7 @@ void LLPanel::childSetWrappedText(const std::string& id, const std::string& text } } -void LLPanel::childSetAction(const std::string& id, boost::function function, void* value) -{ - LLButton* button = getChild(id); - if (button) - { - button->setClickedCallback(function, value); - } -} + void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function) { @@ -967,12 +936,21 @@ void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_ } } -void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value) +void LLPanel::childSetAction(const std::string& id, boost::function function, void* value) +{ + LLButton* button = getChild(id); + if (button) + { + button->setClickedCallback(boost::bind(function, value)); + } +} + +void LLPanel::childSetActionTextbox(const std::string& id, boost::function function, void* value) { LLTextBox* textbox = getChild(id); if (textbox) { - textbox->setClickedCallback(function, value); + textbox->setClickedCallback(boost::bind(function, value)); } } @@ -1075,7 +1053,13 @@ struct LLLayoutStack::LLEmbeddedPanel { min_dim = mMinWidth; } - mResizeBar = new LLResizeBar(std::string("resizer"), mPanel, LLRect(), min_dim, S32_MAX, side); + LLResizeBar::Params p; + p.name = "resizer"; + p.resizing_view = mPanel; + p.min_size = min_dim; + p.max_size = S32_MAX; + p.side = side; + mResizeBar = LLUICtrlFactory::create(p); mResizeBar->setEnableSnapping(FALSE); // panels initialized as hidden should not start out partially visible if (!mPanel->getVisible()) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 330378da0..d781dbae3 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -144,6 +144,7 @@ public: void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); void setPanelParameters(LLXMLNodePtr node, LLView *parentp); + bool hasString(const std::string& name); std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; std::string getString(const std::string& name) const; @@ -205,14 +206,13 @@ public: void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); } std::string childGetText(const std::string& id) const { return childGetValue(id).asString(); } - // LLLineEditor - void childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data); - void childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ); - // LLButton void childSetAction(const std::string& id, boost::function function, void* value); void childSetAction(const std::string& id, const commit_signal_t::slot_type& function); - void childSetActionTextbox(const std::string& id, void(*function)(void*), void* value = NULL); + + // LLTextBox + void childSetActionTextbox(const std::string& id, boost::function function, void* value = NULL); + void childSetControlName(const std::string& id, const std::string& control_name); // Error reporting diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index b193c22b2..ce01f75bf 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -47,19 +47,9 @@ static LLRegisterWidget r("radio_group"); LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect, - const std::string& control_name, LLUICtrlCallback callback, - void* userdata, BOOL border) : - LLUICtrl(name, rect, TRUE, callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), - mSelectedIndex(0) -{ - setControlName(control_name, NULL); - init(border); -} - -LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect, - S32 initial_index, LLUICtrlCallback callback, - void* userdata, BOOL border) : - LLUICtrl(name, rect, TRUE, callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), + S32 initial_index, commit_callback_t commit_callback, + BOOL border) : + LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP), mSelectedIndex(initial_index) { init(border); @@ -251,7 +241,7 @@ void LLRadioGroup::draw() LLRadioCtrl* LLRadioGroup::addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font ) { // Highlight will get fixed in draw method above - LLRadioCtrl* radio = new LLRadioCtrl(name, rect, label, font, onClickButton, this); + LLRadioCtrl* radio = new LLRadioCtrl(name, rect, label, font, boost::bind(&LLRadioGroup::onClickButton, this, _1)); addChild(radio); mRadioButtons.push_back(radio); return radio; @@ -260,32 +250,30 @@ LLRadioCtrl* LLRadioGroup::addRadioButton(const std::string& name, const std::st // Handle one button being clicked. All child buttons must have this // function as their callback function. -// static -void LLRadioGroup::onClickButton(LLUICtrl* ui_ctrl, void* userdata) +void LLRadioGroup::onClickButton(LLUICtrl* ctrl) { // llinfos << "LLRadioGroup::onClickButton" << llendl; - - LLRadioCtrl* clickedRadio = (LLRadioCtrl*) ui_ctrl; - LLRadioGroup* self = (LLRadioGroup*) userdata; - - S32 counter = 0; - for (button_list_t::iterator iter = self->mRadioButtons.begin(); - iter != self->mRadioButtons.end(); ++iter) + LLRadioCtrl* clicked_radio = dynamic_cast(ctrl); + if (!clicked_radio) + return; + S32 index = 0; + for (button_list_t::iterator iter = mRadioButtons.begin(); + iter != mRadioButtons.end(); ++iter) { LLRadioCtrl* radio = *iter; - if (radio == clickedRadio) + if (radio == clicked_radio) { // llinfos << "clicked button " << counter << llendl; - self->setSelectedIndex(counter); - self->setControlValue(counter); + setSelectedIndex(index); + setControlValue(index); // BUG: Calls click callback even if button didn't actually change - self->onCommit(); + onCommit(); return; } - counter++; + index++; } llwarns << "LLRadioGroup::onClickButton - clicked button that isn't a child" << llendl; @@ -380,7 +368,6 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory rect, initial_value, NULL, - NULL, draw_border); const std::string& contents = node->getValue(); diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index b4f65e796..3cc042217 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -45,8 +45,8 @@ class LLRadioCtrl : public LLCheckBoxCtrl { public: LLRadioCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font = NULL, - void (*commit_callback)(LLUICtrl*, void*) = NULL, void* callback_userdata = NULL) : - LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE) + commit_callback_t commit_callback = NULL) : + LLCheckBoxCtrl(name, rect, label, font, commit_callback, FALSE, RADIO_STYLE) { setTabStop(FALSE); } @@ -66,21 +66,11 @@ class LLRadioGroup : public LLUICtrl, public LLCtrlSelectionInterface { public: - // Build a radio group. The number (0...n-1) of the currently selected - // element will be stored in the named control. After the control is - // changed the callback will be called. - LLRadioGroup(const std::string& name, const LLRect& rect, - const std::string& control_name, - LLUICtrlCallback callback = NULL, - void* userdata = NULL, - BOOL border = TRUE); - - // Another radio group constructor, but this one doesn't rely on + // Radio group constructor. Doesn't rely on // needing a control LLRadioGroup(const std::string& name, const LLRect& rect, S32 initial_index, - LLUICtrlCallback callback = NULL, - void* userdata = NULL, + commit_callback_t commit_callback, BOOL border = TRUE); virtual ~LLRadioGroup(); @@ -111,7 +101,7 @@ public: LLRadioCtrl* addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font); LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; } // Update the control as needed. Userdata must be a pointer to the button. - static void onClickButton(LLUICtrl* radio, void* userdata); + void onClickButton(LLUICtrl* clicked_radio); //======================================================================== LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; }; diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index bd99e6c73..95c8068fd 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -40,23 +40,22 @@ #include "llfocusmgr.h" #include "llwindow.h" -LLResizeBar::LLResizeBar( const std::string& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ) - : - LLView( name, rect, TRUE ), +LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) +: LLView(p), mDragLastScreenX( 0 ), mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), mLastMouseScreenY( 0 ), - mMinSize( min_size ), - mMaxSize( max_size ), - mSide( side ), - mSnappingEnabled(TRUE), - mAllowDoubleClickSnapping(TRUE), - mResizingView(resizing_view) + mMinSize( p.min_size ), + mMaxSize( p.max_size ), + mSide( p.side ), + mSnappingEnabled(p.snapping_enabled), + mAllowDoubleClickSnapping(p.allow_double_click_snapping), + mResizingView(p.resizing_view) { setFollowsNone(); // set up some generically good follow code. - switch( side ) + switch( mSide ) { case LEFT: setFollowsLeft(); @@ -180,6 +179,11 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) break; } + notifyParent(LLSD().with("action", "resize") + .with("view_name", mResizingView->getName()) + .with("new_height", new_height) + .with("new_width", new_width)); + scaled_rect.mTop = scaled_rect.mBottom + new_height; scaled_rect.mRight = scaled_rect.mLeft + new_width; mResizingView->setRect(scaled_rect); @@ -188,8 +192,7 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) if (mSnappingEnabled) { - //static LLCachedControl snap_margin (*LLUI::sConfigGroup,"SnapMargin", 0); - S32 snap_margin = LLUI::sConfigGroup->getS32("SnapMargin"); + static LLUICachedControl snap_margin ("SnapMargin", 0); switch( mSide ) { case LEFT: @@ -220,17 +223,62 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) switch(mSide) { case LEFT: - mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft; + { + S32 actual_delta_x = new_rect.mLeft - orig_rect.mLeft; + if (actual_delta_x != delta_x) + { + // restore everything by left + new_rect.mBottom = orig_rect.mBottom; + new_rect.mTop = orig_rect.mTop; + new_rect.mRight = orig_rect.mRight; + mResizingView->setShape(new_rect, true); + } + mDragLastScreenX += actual_delta_x; + break; + } case RIGHT: + { + S32 actual_delta_x = new_rect.mRight - orig_rect.mRight; + if (actual_delta_x != delta_x) + { + // restore everything by left + new_rect.mBottom = orig_rect.mBottom; + new_rect.mTop = orig_rect.mTop; + new_rect.mLeft = orig_rect.mLeft; + mResizingView->setShape(new_rect, true); + } mDragLastScreenX += new_rect.mRight - orig_rect.mRight; break; + } case TOP: + { + S32 actual_delta_y = new_rect.mTop - orig_rect.mTop; + if (actual_delta_y != delta_y) + { + // restore everything by left + new_rect.mBottom = orig_rect.mBottom; + new_rect.mLeft = orig_rect.mLeft; + new_rect.mRight = orig_rect.mRight; + mResizingView->setShape(new_rect, true); + } mDragLastScreenY += new_rect.mTop - orig_rect.mTop; break; + } case BOTTOM: + { + S32 actual_delta_y = new_rect.mBottom - orig_rect.mBottom; + if (actual_delta_y != delta_y) + { + // restore everything by left + new_rect.mTop = orig_rect.mTop; + new_rect.mLeft = orig_rect.mLeft; + new_rect.mRight = orig_rect.mRight; + mResizingView->setShape(new_rect, true); + } mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom; break; + } default: break; } diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 14bdd8d16..b2c34d93d 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -41,7 +41,31 @@ class LLResizeBar : public LLView public: enum Side { LEFT, TOP, RIGHT, BOTTOM }; - LLResizeBar(const std::string& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ); + struct Params : public LLInitParam::Block + { + Mandatory resizing_view; + Mandatory side; + + Optional min_size; + Optional max_size; + Optional snapping_enabled; + Optional allow_double_click_snapping; + + Params() + : max_size("max_size", S32_MAX), + snapping_enabled("snapping_enabled", true), + resizing_view("resizing_view"), + side("side"), + allow_double_click_snapping("allow_double_click_snapping", true) + { + name = "resize_bar"; + } + }; + +protected: + LLResizeBar(const LLResizeBar::Params& p); + friend class LLUICtrlFactory; +public: // virtual void draw(); No appearance virtual BOOL handleHover(S32 x, S32 y, MASK mask); diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 690f12b42..3eb25907d 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -44,31 +44,36 @@ const S32 RESIZE_BORDER_WIDTH = 3; -LLResizeHandle::LLResizeHandle( const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner ) - : - LLView( name, rect, FALSE ), +LLResizeHandle::Params::Params() +: corner("corner"), + min_width("min_width"), + min_height("min_height") +{ + name = "resize_handle"; +} + +LLResizeHandle::LLResizeHandle(const LLResizeHandle::Params& p) +: LLView(p), mDragLastScreenX( 0 ), mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), mLastMouseScreenY( 0 ), mImage( NULL ), - mMinWidth( min_width ), - mMinHeight( min_height ), - mCorner( corner ) + mMinWidth( p.min_width ), + mMinHeight( p.min_height ), + mCorner( p.corner ) { - setSaveToXML(false); - if( RIGHT_BOTTOM == mCorner) { mImage = LLUI::getUIImage("UIImgResizeBottomRightUUID"); } - switch( mCorner ) + switch( p.corner ) { - case LEFT_TOP: setFollows( FOLLOWS_LEFT | FOLLOWS_TOP ); break; - case LEFT_BOTTOM: setFollows( FOLLOWS_LEFT | FOLLOWS_BOTTOM ); break; - case RIGHT_TOP: setFollows( FOLLOWS_RIGHT | FOLLOWS_TOP ); break; - case RIGHT_BOTTOM: setFollows( FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); break; + case LEFT_TOP: setFollows( FOLLOWS_LEFT | FOLLOWS_TOP ); break; + case LEFT_BOTTOM: setFollows( FOLLOWS_LEFT | FOLLOWS_BOTTOM ); break; + case RIGHT_TOP: setFollows( FOLLOWS_RIGHT | FOLLOWS_TOP ); break; + case RIGHT_BOTTOM: setFollows( FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); break; } // decorator object, don't serialize @@ -205,8 +210,7 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) LLView* snap_view = NULL; LLView* test_view = NULL; - //static LLCachedControl snap_margin (*LLUI::sConfigGroup,"SnapMargin", 0); - S32 snap_margin = LLUI::sConfigGroup->getS32("SnapMargin"); + static LLUICachedControl snap_margin ("SnapMargin", 0); // now do snapping switch(mCorner) { @@ -255,23 +259,65 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) // update last valid mouse cursor position based on resized view's actual size LLRect new_rect = resizing_view->getRect(); + S32 actual_delta_x = 0; + S32 actual_delta_y = 0; switch(mCorner) { case LEFT_TOP: - mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft; - mDragLastScreenY += new_rect.mTop - orig_rect.mTop; + actual_delta_x = new_rect.mLeft - orig_rect.mLeft; + actual_delta_y = new_rect.mTop - orig_rect.mTop; + if (actual_delta_x != delta_x + || actual_delta_y != delta_y) + { + new_rect.mRight = orig_rect.mRight; + new_rect.mBottom = orig_rect.mBottom; + resizing_view->setShape(new_rect, true); + } + + mDragLastScreenX += actual_delta_x; + mDragLastScreenY += actual_delta_y; break; case LEFT_BOTTOM: - mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft; - mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom; + actual_delta_x = new_rect.mLeft - orig_rect.mLeft; + actual_delta_y = new_rect.mBottom - orig_rect.mBottom; + if (actual_delta_x != delta_x + || actual_delta_y != delta_y) + { + new_rect.mRight = orig_rect.mRight; + new_rect.mTop = orig_rect.mTop; + resizing_view->setShape(new_rect, true); + } + + mDragLastScreenX += actual_delta_x; + mDragLastScreenY += actual_delta_y; break; case RIGHT_TOP: - mDragLastScreenX += new_rect.mRight - orig_rect.mRight; - mDragLastScreenY += new_rect.mTop - orig_rect.mTop; + actual_delta_x = new_rect.mRight - orig_rect.mRight; + actual_delta_y = new_rect.mTop - orig_rect.mTop; + if (actual_delta_x != delta_x + || actual_delta_y != delta_y) + { + new_rect.mLeft = orig_rect.mLeft; + new_rect.mBottom = orig_rect.mBottom; + resizing_view->setShape(new_rect, true); + } + + mDragLastScreenX += actual_delta_x; + mDragLastScreenY += actual_delta_y; break; case RIGHT_BOTTOM: - mDragLastScreenX += new_rect.mRight - orig_rect.mRight; - mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom; + actual_delta_x = new_rect.mRight - orig_rect.mRight; + actual_delta_y = new_rect.mBottom - orig_rect.mBottom; + if (actual_delta_x != delta_x + || actual_delta_y != delta_y) + { + new_rect.mLeft = orig_rect.mLeft; + new_rect.mTop = orig_rect.mTop; + resizing_view->setShape(new_rect, true); + } + + mDragLastScreenX += actual_delta_x; + mDragLastScreenY += actual_delta_y; break; default: break; diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 0e23d526f..1560a0379 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -35,7 +35,6 @@ #include "stdtypes.h" #include "llview.h" -#include "llimagegl.h" #include "llcoord.h" @@ -44,9 +43,18 @@ class LLResizeHandle : public LLView public: enum ECorner { LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM }; - - LLResizeHandle(const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ); + struct Params : public LLInitParam::Block + { + Mandatory corner; + Optional min_width; + Optional min_height; + Params(); + }; +protected: + LLResizeHandle(const LLResizeHandle::Params&); + friend class LLUICtrlFactory; +public: virtual void draw(); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); diff --git a/indra/llui/llrootview.cpp b/indra/llui/llrootview.cpp index e4f178be0..287841401 100644 --- a/indra/llui/llrootview.cpp +++ b/indra/llui/llrootview.cpp @@ -33,8 +33,7 @@ #include "llrootview.h" -LLRootView::LLRootView(const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 follows) -: LLView(name,rect,mouse_opaque,follows) -{ } - +LLRootView::LLRootView(const Params& p) + : LLView(p) + {} // pretty exciting file, eh? diff --git a/indra/llui/llrootview.h b/indra/llui/llrootview.h index 33ebf8dcb..c50515490 100644 --- a/indra/llui/llrootview.h +++ b/indra/llui/llrootview.h @@ -30,15 +30,15 @@ * $/LicenseInfo$ */ -#ifndef LLROOTVIEW_H -#define LLROOTVIEW_H +#ifndef LL_LLROOTVIEW_H +#define LL_LLROOTVIEW_H #include "llview.h" class LLRootView : public LLView { public: - LLRootView(const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE); + LLRootView(const Params& p) ; }; #endif diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index d41606636..ca898a4d0 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -51,13 +51,11 @@ LLScrollbar::LLScrollbar( const std::string& name, LLRect rect, LLScrollbar::ORIENTATION orientation, S32 doc_size, S32 doc_pos, S32 page_size, - void (*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), - void* callback_user_data, + callback_t change_callback, S32 step_size) -: LLUICtrl( name, rect, TRUE, NULL, NULL ), +: LLUICtrl( name, rect ), mChangeCallback( change_callback ), - mCallbackUserData( callback_user_data ), mOrientation( orientation ), mDocSize( doc_size ), mDocPos( doc_pos ), @@ -115,7 +113,7 @@ LLScrollbar::LLScrollbar( LLButton* line_up_btn = new LLButton(std::string("Line Up"), line_up_rect, line_up_img, line_up_selected_img, LLStringUtil::null, - &LLScrollbar::onLineUpBtnPressed, this, LLFontGL::getFontSansSerif() ); + boost::bind(&LLScrollbar::onLineUpBtnPressed, this, _2), LLFontGL::getFontSansSerif() ); if( LLScrollbar::VERTICAL == mOrientation ) { line_up_btn->setFollowsRight(); @@ -127,7 +125,7 @@ LLScrollbar::LLScrollbar( line_up_btn->setFollowsLeft(); line_up_btn->setFollowsBottom(); } - line_up_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineUpBtnPressed, (void*)this) ); + line_up_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineUpBtnPressed, this, _2) ); line_up_btn->setTabStop(FALSE); line_up_btn->setScaleImage(TRUE); @@ -135,10 +133,10 @@ LLScrollbar::LLScrollbar( LLButton* line_down_btn = new LLButton(std::string("Line Down"), line_down_rect, line_down_img, line_down_selected_img, LLStringUtil::null, - &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::getFontSansSerif() ); + boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2), LLFontGL::getFontSansSerif() ); line_down_btn->setFollowsRight(); line_down_btn->setFollowsBottom(); - line_down_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineDownBtnPressed, this) ); + line_down_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2) ); line_down_btn->setTabStop(FALSE); line_down_btn->setScaleImage(TRUE); addChild(line_down_btn); @@ -170,7 +168,7 @@ bool LLScrollbar::setDocPos(S32 pos, BOOL update_thumb) if( mChangeCallback ) { - mChangeCallback( mDocPos, this, mCallbackUserData ); + mChangeCallback( mDocPos, this ); } if( update_thumb ) @@ -629,19 +627,12 @@ void LLScrollbar::pageDown(S32 overlap) } } -// static -void LLScrollbar::onLineUpBtnPressed( void* userdata ) +void LLScrollbar::onLineUpBtnPressed( const LLSD& data ) { - LLScrollbar* self = (LLScrollbar*) userdata; - - self->changeLine( - self->mStepSize, TRUE ); + changeLine( -mStepSize, TRUE ); } -// static -void LLScrollbar::onLineDownBtnPressed( void* userdata ) +void LLScrollbar::onLineDownBtnPressed( const LLSD& data ) { - LLScrollbar* self = (LLScrollbar*) userdata; - self->changeLine( self->mStepSize, TRUE ); + changeLine( mStepSize, TRUE ); } - - diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index da13ff2af..fab34326c 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -52,11 +52,11 @@ class LLScrollbar public: enum ORIENTATION { HORIZONTAL, VERTICAL }; + typedef boost::function callback_t; LLScrollbar(const std::string& name, LLRect rect, ORIENTATION orientation, S32 doc_size, S32 doc_pos, S32 page_size, - void(*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), - void* callback_user_data = NULL, + callback_t change_callback, S32 step_size = 1); virtual ~LLScrollbar(); @@ -101,8 +101,8 @@ public: void pageUp(S32 overlap); void pageDown(S32 overlap); - static void onLineUpBtnPressed(void* userdata); - static void onLineDownBtnPressed(void* userdata); + void onLineUpBtnPressed(const LLSD& data); + void onLineDownBtnPressed(const LLSD& data); void setTrackColor( const LLColor4& color ) { mTrackColor = color; } void setThumbColor( const LLColor4& color ) { mThumbColor = color; } @@ -115,8 +115,7 @@ private: void updateThumbRect(); bool changeLine(S32 delta, BOOL update_thumb ); - void (*mChangeCallback)( S32 new_pos, LLScrollbar* self, void* userdata ); - void* mCallbackUserData; + callback_t mChangeCallback; const ORIENTATION mOrientation; S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize. diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 1206d3b76..f8998e40a 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -1,6 +1,6 @@ /** * @file llscrollcontainer.cpp - * @brief LLScrollableContainerView base class + * @brief LLScrollContainer base class * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -33,8 +33,10 @@ #include "linden_common.h" -#include "llrender.h" #include "llscrollcontainer.h" + +#include "llrender.h" +#include "llcontainerview.h" #include "lllocalcliprect.h" #include "llscrollbar.h" #include "llui.h" @@ -44,6 +46,7 @@ #include "llfocusmgr.h" #include "llframetimer.h" #include "lluictrlfactory.h" +#include "llpanel.h" #include "llfontgl.h" ///---------------------------------------------------------------------------- @@ -57,18 +60,18 @@ static const F32 MAX_AUTO_SCROLL_RATE = 500.f; static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f; ///---------------------------------------------------------------------------- -/// Class LLScrollableContainerView +/// Class LLScrollContainer ///---------------------------------------------------------------------------- -static LLRegisterWidget r("scroll_container"); +static LLRegisterWidget r("scroll_container"); // Default constructor -LLScrollableContainerView::LLScrollableContainerView( const std::string& name, +LLScrollContainer::LLScrollContainer( const std::string& name, const LLRect& rect, LLView* scrolled_view, BOOL is_opaque, const LLColor4& bg_color ) : - LLUICtrl( name, rect, FALSE, NULL, NULL ), + LLUICtrl( name, rect, FALSE ), mAutoScrolling( FALSE ), mAutoScrollRate( 0.f ), mBackgroundColor( bg_color ), @@ -101,7 +104,7 @@ LLScrollableContainerView::LLScrollableContainerView( const std::string& name, mInnerRect.getHeight(), 0, mInnerRect.getHeight(), - NULL, this, + NULL, VERTICAL_MULTIPLE); LLView::addChild( mScrollbar[VERTICAL] ); mScrollbar[VERTICAL]->setVisible( FALSE ); @@ -117,7 +120,7 @@ LLScrollableContainerView::LLScrollableContainerView( const std::string& name, mInnerRect.getWidth(), 0, mInnerRect.getWidth(), - NULL, this, + NULL, HORIZONTAL_MULTIPLE); LLView::addChild( mScrollbar[HORIZONTAL] ); mScrollbar[HORIZONTAL]->setVisible( FALSE ); @@ -128,7 +131,7 @@ LLScrollableContainerView::LLScrollableContainerView( const std::string& name, } // Destroys the object -LLScrollableContainerView::~LLScrollableContainerView( void ) +LLScrollContainer::~LLScrollContainer( void ) { // mScrolledView and mScrollbar are child views, so the LLView // destructor takes care of memory deallocation. @@ -141,9 +144,9 @@ LLScrollableContainerView::~LLScrollableContainerView( void ) // internal scrollbar handlers // virtual -void LLScrollableContainerView::scrollHorizontal( S32 new_pos ) +void LLScrollContainer::scrollHorizontal( S32 new_pos ) { - //llinfos << "LLScrollableContainerView::scrollHorizontal()" << llendl; + //llinfos << "LLScrollContainer::scrollHorizontal()" << llendl; if( mScrolledView ) { LLRect doc_rect = mScrolledView->getRect(); @@ -153,9 +156,9 @@ void LLScrollableContainerView::scrollHorizontal( S32 new_pos ) } // virtual -void LLScrollableContainerView::scrollVertical( S32 new_pos ) +void LLScrollContainer::scrollVertical( S32 new_pos ) { - // llinfos << "LLScrollableContainerView::scrollVertical() " << new_pos << llendl; + // llinfos << "LLScrollContainer::scrollVertical() " << new_pos << llendl; if( mScrolledView ) { LLRect doc_rect = mScrolledView->getRect(); @@ -165,7 +168,7 @@ void LLScrollableContainerView::scrollVertical( S32 new_pos ) } // LLView functionality -void LLScrollableContainerView::reshape(S32 width, S32 height, +void LLScrollContainer::reshape(S32 width, S32 height, BOOL called_from_parent) { LLUICtrl::reshape( width, height, called_from_parent ); @@ -192,7 +195,7 @@ void LLScrollableContainerView::reshape(S32 width, S32 height, } } -BOOL LLScrollableContainerView::handleKeyHere(KEY key, MASK mask) +BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) { // allow scrolled view to handle keystrokes in case it delegated keyboard focus // to the scroll container. @@ -215,7 +218,7 @@ BOOL LLScrollableContainerView::handleKeyHere(KEY key, MASK mask) return FALSE; } -BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks ) +BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // Give event to my child views - they may have scroll bars // (Bad UI design, but technically possible.) @@ -252,7 +255,7 @@ BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks ) return FALSE; } -BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, +BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, @@ -273,7 +276,7 @@ BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, return TRUE; } -bool LLScrollableContainerView::autoScroll(S32 x, S32 y) +bool LLScrollContainer::autoScroll(S32 x, S32 y) { S32 scrollbar_size = SCROLLBAR_SIZE; @@ -346,7 +349,7 @@ bool LLScrollableContainerView::autoScroll(S32 x, S32 y) } -BOOL LLScrollableContainerView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect) +BOOL LLScrollContainer::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect) { S32 local_x, local_y; for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) @@ -373,7 +376,7 @@ BOOL LLScrollableContainerView::handleToolTip(S32 x, S32 y, std::string& msg, LL return TRUE; } -void LLScrollableContainerView::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const +void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const { const LLRect& doc_rect = getScrolledViewRect(); S32 scrollbar_size = SCROLLBAR_SIZE; @@ -410,7 +413,7 @@ void LLScrollableContainerView::calcVisibleSize( S32 *visible_width, S32 *visibl } } -void LLScrollableContainerView::draw() +void LLScrollContainer::draw() { S32 scrollbar_size = SCROLLBAR_SIZE; if (mAutoScrolling) @@ -503,7 +506,7 @@ void LLScrollableContainerView::draw() } // end draw -bool LLScrollableContainerView::addChild(LLView* view, S32 tab_group) +bool LLScrollContainer::addChild(LLView* view, S32 tab_group) { if (!mScrolledView) { @@ -520,7 +523,7 @@ bool LLScrollableContainerView::addChild(LLView* view, S32 tab_group) return ret_val; } -void LLScrollableContainerView::updateScroll() +void LLScrollContainer::updateScroll() { if (!mScrolledView) { @@ -607,7 +610,7 @@ void LLScrollableContainerView::updateScroll() mScrollbar[VERTICAL]->setPageSize( visible_height ); } // end updateScroll -void LLScrollableContainerView::setBorderVisible(BOOL b) +void LLScrollContainer::setBorderVisible(BOOL b) { mBorder->setVisible( b ); // Recompute inner rect, as border visibility changes it @@ -615,7 +618,7 @@ void LLScrollableContainerView::setBorderVisible(BOOL b) mInnerRect.stretch( -getBorderWidth() ); } -LLRect LLScrollableContainerView::getVisibleContentRect() +LLRect LLScrollContainer::getVisibleContentRect() { updateScroll(); LLRect visible_rect = getContentWindowRect(); @@ -623,7 +626,7 @@ LLRect LLScrollableContainerView::getVisibleContentRect() visible_rect.translate(-contents_rect.mLeft, -contents_rect.mBottom); return visible_rect; } -LLRect LLScrollableContainerView::getContentWindowRect() +LLRect LLScrollContainer::getContentWindowRect() { updateScroll(); LLRect scroller_view_rect; @@ -641,7 +644,7 @@ LLRect LLScrollableContainerView::getContentWindowRect() } // rect is in document coordinates, constraint is in display coordinates relative to content window rect -void LLScrollableContainerView::scrollToShowRect(const LLRect& rect, const LLRect& constraint) +void LLScrollContainer::scrollToShowRect(const LLRect& rect, const LLRect& constraint) { if (!mScrolledView) { @@ -692,31 +695,31 @@ void LLScrollableContainerView::scrollToShowRect(const LLRect& rect, const LLRec notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue())); } -void LLScrollableContainerView::pageUp(S32 overlap) +void LLScrollContainer::pageUp(S32 overlap) { mScrollbar[VERTICAL]->pageUp(overlap); updateScroll(); } -void LLScrollableContainerView::pageDown(S32 overlap) +void LLScrollContainer::pageDown(S32 overlap) { mScrollbar[VERTICAL]->pageDown(overlap); updateScroll(); } -void LLScrollableContainerView::goToTop() +void LLScrollContainer::goToTop() { mScrollbar[VERTICAL]->setDocPos(0); updateScroll(); } -void LLScrollableContainerView::goToBottom() +void LLScrollContainer::goToBottom() { mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocSize()); updateScroll(); } -S32 LLScrollableContainerView::getBorderWidth() const +S32 LLScrollContainer::getBorderWidth() const { if (mBorder && mBorder->getVisible()) { @@ -727,7 +730,7 @@ S32 LLScrollableContainerView::getBorderWidth() const } // virtual -LLXMLNodePtr LLScrollableContainerView::getXML(bool save_children) const +LLXMLNodePtr LLScrollContainer::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); @@ -751,7 +754,7 @@ LLXMLNodePtr LLScrollableContainerView::getXML(bool save_children) const return node; } -LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) +LLView* LLScrollContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { std::string name("scroll_container"); node->getAttributeString("name", name); @@ -766,7 +769,7 @@ LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LL LLUICtrlFactory::getAttributeColor(node,"color", color); // Create the scroll view - LLScrollableContainerView *ret = new LLScrollableContainerView(name, rect, (LLPanel*)NULL, opaque, color); + LLScrollContainer *ret = new LLScrollContainer(name, rect, (LLPanel*)NULL, opaque, color); LLPanel* panelp = NULL; diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 2e1cf1dd3..8239789b3 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -1,6 +1,6 @@ /** * @file llscrollcontainer.h - * @brief LLScrollableContainerView class header file. + * @brief LLScrollContainer class header file. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -53,17 +53,17 @@ class LLUICtrlFactory; * the width and height of the view you're scrolling. * *****************************************************************************/ -class LLScrollableContainerView : public LLUICtrl +class LLScrollContainer : public LLUICtrl { public: // Note: vertical comes before horizontal because vertical // scrollbars have priority for mouse and keyboard events. enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; - LLScrollableContainerView( const std::string& name, const LLRect& rect, + LLScrollContainer( const std::string& name, const LLRect& rect, LLView* scrolled_view, BOOL is_opaque = FALSE, const LLColor4& bg_color = LLColor4(0,0,0,0) ); - virtual ~LLScrollableContainerView( void ); + virtual ~LLScrollContainer( void ); void setScrolledView(LLView* view) { mScrolledView = view; } diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index 946073b97..4ba29fa01 100644 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h @@ -57,7 +57,7 @@ class LLScrollingPanelList : public LLUICtrl { public: LLScrollingPanelList(const std::string& name, const LLRect& rect) - : LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {} + : LLUICtrl(name, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {} typedef std::deque panel_list_t; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 38c9b67d7..a5bbc9b90 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -662,13 +662,12 @@ public: //--------------------------------------------------------------------------- LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect, - void (*commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_user_data, + commit_callback_t commit_callback, BOOL allow_multiple_selection, BOOL show_border, bool draw_heading ) - : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data), + : LLUICtrl(name, rect, TRUE, commit_callback), mLineHeight(0), mScrollLines(0), mMouseWheelOpaque(true), @@ -735,7 +734,7 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect, getItemCount(), mScrollLines, getLinesPerPage(), - &LLScrollListCtrl::onScrollChange, this ); + boost::bind(&LLScrollListCtrl::onScrollChange, this, _1, _2) ); mScrollbar->setFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); @@ -2853,11 +2852,9 @@ S32 LLScrollListCtrl::getLinesPerPage() } // Called by scrollbar -//static -void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void* userdata ) +void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar ) { - LLScrollListCtrl* self = (LLScrollListCtrl*) userdata; - self->mScrollLines = new_pos; + mScrollLines = new_pos; } @@ -2932,7 +2929,7 @@ void LLScrollListCtrl::setScrollPos( S32 pos ) { mScrollbar->setDocPos( pos ); - onScrollChange(mScrollbar->getDocPos(), mScrollbar, this); + onScrollChange(mScrollbar->getDocPos(), mScrollbar); } @@ -3134,12 +3131,9 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac BOOL mouse_wheel_opaque = TRUE; node->getAttributeBOOL("mouse_wheel_opaque", mouse_wheel_opaque); - LLUICtrlCallback callback = NULL; - LLScrollListCtrl* scroll_list = new LLScrollListCtrl( name, rect, - callback, NULL, multi_select, draw_border, @@ -3868,7 +3862,7 @@ void LLScrollListCtrl::onFocusLost() } LLScrollColumnHeader::LLScrollColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) : - LLComboBox(label, rect, label, NULL, NULL), + LLComboBox(label, rect, label), mColumn(column), mOrigLabel(label), mShowSortOptions(FALSE), @@ -3894,11 +3888,14 @@ LLScrollColumnHeader::LLScrollColumnHeader(const std::string& label, const LLRec // resize handles on left and right const S32 RESIZE_BAR_THICKNESS = 3; - mResizeBar = new LLResizeBar( - std::string("resizebar"), - this, - LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), - MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT ); + LLResizeBar::Params p; + p.name = "resizebar"; + p.resizing_view = this; + p.rect = LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0); + p.min_size = MIN_COLUMN_WIDTH; + p.max_size = S32_MAX; + p.side = LLResizeBar::RIGHT; + mResizeBar = LLUICtrlFactory::create(p); addChild(mResizeBar); mResizeBar->setEnabled(FALSE); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 30a8aba11..70f490dcc 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -390,8 +390,7 @@ public: LLScrollListCtrl( const std::string& name, const LLRect& rect, - void (*commit_callback)(LLUICtrl*, void*), - void* callback_userdata, + commit_callback_t commit_callback, BOOL allow_multiple_selection, BOOL draw_border = TRUE, bool draw_heading = false); @@ -594,7 +593,7 @@ public: LLRect getCellRect(S32 row_index, S32 column_index); // Used "internally" by the scroll bar. - static void onScrollChange( S32 new_pos, LLScrollbar* src, void* userdata ); + void onScrollChange( S32 new_pos, LLScrollbar* src); static void onClickColumn(void *userdata); diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp new file mode 100644 index 000000000..a326803e4 --- /dev/null +++ b/indra/llui/llsearcheditor.cpp @@ -0,0 +1,176 @@ +/** + * @file llsearcheditor.cpp + * @brief LLSearchEditor implementation + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Text editor widget to let users enter a single line. + +#include "linden_common.h" + +#include "llsearcheditor.h" + +static LLRegisterWidget r2("search_editor"); + + +LLSearchEditor::LLSearchEditor(const std::string& name, + const LLRect& rect, + S32 max_length_bytes) + : + LLUICtrl(name, rect), + mSearchEditor(NULL), + mClearButton(NULL) +{ + mSearchEditor = new LLLineEditor(std::string("filter edit box"), + getLocalRect(), + LLStringUtil::null, + NULL, + max_length_bytes, + boost::bind(&LLUICtrl::onCommit, this), + boost::bind(&LLSearchEditor::handleKeystroke, this)); + + mSearchEditor->setFollowsAll(); + mSearchEditor->setSelectAllonFocusReceived(TRUE); + mSearchEditor->setRevertOnEsc( FALSE ); + mSearchEditor->setPassDelete(TRUE); + + addChild(mSearchEditor); + + S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor + LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0); + mClearButton = new LLButton(std::string("clear button"), + clear_btn_rect, + std::string("icn_clear_lineeditor.tga"), + std::string("UIImgBtnCloseInactiveUUID"), + LLStringUtil::null, + boost::bind(&LLSearchEditor::onClearButtonClick, this, _2)); + mClearButton->setFollowsRight(); + mClearButton->setFollowsTop(); + mClearButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor")); + mClearButton->setTabStop(FALSE); + mSearchEditor->addChild(mClearButton); + + mSearchEditor->setTextPadding(0, btn_width); +} + +//virtual +void LLSearchEditor::draw() +{ + if (mClearButton) + mClearButton->setVisible(!mSearchEditor->getWText().empty()); + + LLUICtrl::draw(); +} + +//virtual +void LLSearchEditor::setValue(const LLSD& value ) +{ + mSearchEditor->setValue(value); +} + +//virtual +LLSD LLSearchEditor::getValue() const +{ + return mSearchEditor->getValue(); +} + +//virtual +BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) +{ + return mSearchEditor->setTextArg(key, text); +} + +//virtual +BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) +{ + return mSearchEditor->setLabelArg(key, text); +} + +//virtual +void LLSearchEditor::setLabel( const LLStringExplicit &new_label ) +{ + mSearchEditor->setLabel(new_label); +} + +//virtual +void LLSearchEditor::clear() +{ + if (mSearchEditor) + { + mSearchEditor->clear(); + } +} + +//virtual +void LLSearchEditor::setFocus( BOOL b ) +{ + if (mSearchEditor) + { + mSearchEditor->setFocus(b); + } +} + +void LLSearchEditor::onClearButtonClick(const LLSD& data) +{ + setText(LLStringUtil::null); + mSearchEditor->onCommit(); // force keystroke callback +} + +void LLSearchEditor::handleKeystroke() +{ + if (mKeystrokeCallback) + { + mKeystrokeCallback(this, getValue()); + } +} + +// static +LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) +{ + std::string name("search_editor"); + node->getAttributeString("name", name); + + LLRect rect; + createRect(node, rect, parent, LLRect()); + + S32 max_text_length = 128; + node->getAttributeS32("max_length", max_text_length); + + std::string text = node->getValue().substr(0, max_text_length - 1); + + LLSearchEditor* search_editor = new LLSearchEditor(name, + rect, + max_text_length); + + std::string label; + if(node->getAttributeString("label", label)) + { + search_editor->setLabel(label); + } + + search_editor->setText(text); + + search_editor->initFromXML(node, parent); + + return search_editor; +} diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h new file mode 100644 index 000000000..47acfaba9 --- /dev/null +++ b/indra/llui/llsearcheditor.h @@ -0,0 +1,80 @@ +/** + * @file llsearcheditor.h + * @brief Text editor widget that represents a search operation + * + * Features: + * Text entry of a single line (text, delete, left and right arrow, insert, return). + * Callbacks either on every keystroke or just on the return key. + * Focus (allow multiple text entry widgets) + * Clipboard (cut, copy, and paste) + * Horizontal scrolling to allow strings longer than widget size allows + * Pre-validation (limit which keys can be used) + * Optional line history so previous entries can be recalled by CTRL UP/DOWN + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_SEARCHEDITOR_H +#define LL_SEARCHEDITOR_H + +#include "lllineeditor.h" +#include "llbutton.h" + +class LLSearchEditor : public LLUICtrl +{ +public: + LLSearchEditor(const std::string& name, + const LLRect& rect, + S32 max_length_bytes); + + void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } + + virtual ~LLSearchEditor() {} + + /*virtual*/ void draw(); + + static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); + + void setText(const LLStringExplicit &new_text) { mSearchEditor->setText(new_text); } + const std::string& getText() const { return mSearchEditor->getText(); } + + // LLUICtrl interface + virtual void setValue(const LLSD& value ); + virtual LLSD getValue() const; + virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual void setLabel( const LLStringExplicit &new_label ); + virtual void clear(); + virtual void setFocus( BOOL b ); + + void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; } + +protected: + void onClearButtonClick(const LLSD& data); + virtual void handleKeystroke(); + + commit_callback_t mKeystrokeCallback; + LLLineEditor* mSearchEditor; + LLButton* mClearButton; +}; + +#endif //LL_SEARCHEDITOR_H \ No newline at end of file diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index 04e4b8cf2..becc33424 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -49,8 +49,7 @@ static LLRegisterWidget r2("volume_slider"); LLSlider::LLSlider( const std::string& name, const LLRect& rect, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, @@ -58,7 +57,7 @@ LLSlider::LLSlider( BOOL volume, const std::string& control_name) : - LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata, + LLUICtrl( name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP), mValue( initial_value ), mInitialValue( initial_value ), @@ -350,7 +349,6 @@ LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFacto LLSlider* slider = new LLSlider(name, rect, NULL, - NULL, initial_value, min_value, max_value, diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 4596a5874..8d16911f6 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -43,8 +43,7 @@ public: LLSlider( const std::string& name, const LLRect& rect, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 41c4c0560..53f54d75c 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -60,11 +60,10 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, BOOL show_text, BOOL can_edit_text, BOOL volume, - void (*commit_callback)(LLUICtrl*, void*), - void* callback_user_data, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, F32 increment, const std::string& control_which) - : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), + : LLUICtrl(name, rect, TRUE, commit_callback ), mFont(font), mShowText( show_text ), mCanEditText( can_edit_text ), @@ -104,7 +103,7 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, LLRect slider_rect( slider_left, top, slider_right, bottom ); mSlider = new LLSlider(std::string("slider"), slider_rect, - LLSliderCtrl::onSliderCommit, this, + boost::bind(&LLSliderCtrl::onSliderCommit,_1,_2), initial_value, min_value, max_value, increment, volume, control_which ); addChild( mSlider ); @@ -117,7 +116,9 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, mEditor = new LLLineEditor( std::string("SliderCtrl Editor"), text_rect, LLStringUtil::null, font, MAX_STRING_LENGTH, - &LLSliderCtrl::onEditorCommit, NULL, NULL, this, + &LLSliderCtrl::onEditorCommit, + NULL, + NULL, &LLLineEditor::prevalidateFloat ); mEditor->setFollowsLeft(); mEditor->setFollowsBottom(); @@ -209,10 +210,11 @@ void LLSliderCtrl::updateText() } // static -void LLSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) +void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) { - LLSliderCtrl* self = (LLSliderCtrl*) userdata; - llassert( caller == self->mEditor ); + LLSliderCtrl* self = dynamic_cast(ctrl->getParent()); + if (!self) + return; BOOL success = FALSE; F32 val = self->mValue; @@ -250,10 +252,11 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) } // static -void LLSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata ) +void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) { - LLSliderCtrl* self = (LLSliderCtrl*) userdata; - llassert( caller == self->mSlider ); + LLSliderCtrl* self = dynamic_cast(ctrl->getParent()); + if (!self) + return; BOOL success = FALSE; F32 saved_val = self->mValue; @@ -472,8 +475,6 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory } } - LLUICtrlCallback callback = NULL; - if (label.empty()) { label.assign(node->getTextContents()); @@ -488,7 +489,6 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory show_text, can_edit_text, volume, - callback, NULL, initial_value, min_value, diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index f7c321235..bf1b8366e 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -58,8 +58,7 @@ public: BOOL show_text, BOOL can_edit_text, BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG - void (*commit_callback)(LLUICtrl*, void*), - void* callback_userdata, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, F32 increment, const std::string& control_which = LLStringUtil::null ); @@ -114,10 +113,9 @@ public: virtual std::string getControlName() const { return mSlider->getControlName(); } - static void onSliderCommit(LLUICtrl* caller, void* userdata); + static void onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata); - static void onEditorCommit(LLUICtrl* caller, void* userdata); - static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); + static void onEditorCommit(LLUICtrl* ctrl, const LLSD& userdata); private: void updateText(); diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 4db05f0cc..a7950ccbf 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -54,13 +54,12 @@ const U32 MAX_STRING_LENGTH = 32; static LLRegisterWidget r2("spinner"); LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font, - void (*commit_callback)(LLUICtrl*, void*), - void* callback_user_data, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, F32 increment, const std::string& control_name, S32 label_width) : - LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP ), + LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP ), mValue( initial_value ), mInitialValue( initial_value ), mMaxValue( max_value ), @@ -98,10 +97,10 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std:: out_id, in_id, LLStringUtil::null, - &LLSpinCtrl::onUpBtn, this, LLFontGL::getFontSansSerif() ); + boost::bind(&LLSpinCtrl::onUpBtn, this, _2), LLFontGL::getFontSansSerif() ); mUpBtn->setFollowsLeft(); mUpBtn->setFollowsBottom(); - mUpBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onUpBtn,this)); + mUpBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onUpBtn,this, _2)); mUpBtn->setTabStop(FALSE); addChild(mUpBtn); @@ -112,17 +111,17 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std:: out_id, in_id, LLStringUtil::null, - &LLSpinCtrl::onDownBtn, this, LLFontGL::getFontSansSerif() ); + boost::bind(&LLSpinCtrl::onDownBtn, this, _2), LLFontGL::getFontSansSerif() ); mDownBtn->setFollowsLeft(); mDownBtn->setFollowsBottom(); - mDownBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onDownBtn,this)); + mDownBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onDownBtn,this, _2)); mDownBtn->setTabStop(FALSE); addChild(mDownBtn); LLRect editor_rect( btn_right + 1, centered_top, getRect().getWidth(), centered_bottom ); mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font, MAX_STRING_LENGTH, - &LLSpinCtrl::onEditorCommit, NULL, NULL, this, + boost::bind(&LLSpinCtrl::onEditorCommit, this, _2), NULL, NULL, &LLLineEditor::prevalidateASCII ); mEditor->setFollowsLeft(); mEditor->setFollowsBottom(); @@ -186,60 +185,59 @@ F32 get_increment(F32 inc, S32 decimal_precision) //CF: finetune increments // static -void LLSpinCtrl::onUpBtn( void *userdata ) +void LLSpinCtrl::onUpBtn( const LLSD& data ) { - LLSpinCtrl* self = (LLSpinCtrl*) userdata; - if( self->getEnabled() ) + if( getEnabled() ) { // use getValue()/setValue() to force reload from/to control - F32 val = (F32)self->getValue().asReal() + get_increment(self->mIncrement, self->mPrecision); - val = clamp_precision(val, self->mPrecision); - val = llmin( val, self->mMaxValue ); + F32 val = (F32)getValue().asReal() + get_increment(mIncrement, mPrecision); + val = clamp_precision(val, mPrecision); + val = llmin( val, mMaxValue ); + if (val < mMinValue) val = mMinValue; + if (val > mMaxValue) val = mMaxValue; - F32 saved_val = (F32)self->getValue().asReal(); - self->setValue(val); - if( (self->mValidateCallback && !self->mValidateCallback( self, self->mCallbackUserData ) ) || - (self->mValidateSignal && !(*(self->mValidateSignal))( self, val ) )) + F32 saved_val = (F32)getValue().asReal(); + setValue(val); + if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) || + (mValidateSignal && !(*mValidateSignal)( this, val ) )) { - self->setValue( saved_val ); - self->reportInvalidData(); - self->updateEditor(); + setValue( saved_val ); + reportInvalidData(); + updateEditor(); return; } - self->updateEditor(); - self->onCommit(); + updateEditor(); + onCommit(); } } -// static -void LLSpinCtrl::onDownBtn( void *userdata ) + +void LLSpinCtrl::onDownBtn( const LLSD& data ) { - LLSpinCtrl* self = (LLSpinCtrl*) userdata; - - if( self->getEnabled() ) + if( getEnabled() ) { - F32 val = (F32)self->getValue().asReal() - get_increment(self->mIncrement, self->mPrecision); - val = clamp_precision(val, self->mPrecision); - val = llmax( val, self->mMinValue ); + F32 val = (F32)getValue().asReal() - get_increment(mIncrement, mPrecision); + val = clamp_precision(val, mPrecision); + val = llmax( val, mMinValue ); - if (val < self->mMinValue) val = self->mMinValue; - if (val > self->mMaxValue) val = self->mMaxValue; + if (val < mMinValue) val = mMinValue; + if (val > mMaxValue) val = mMaxValue; - F32 saved_val = (F32)self->getValue().asReal(); - self->setValue(val); - if( (self->mValidateCallback && !self->mValidateCallback( self, self->mCallbackUserData ) ) || - (self->mValidateSignal && !(*(self->mValidateSignal))( self, val ) )) + F32 saved_val = (F32)getValue().asReal(); + setValue(val); + if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) || + (mValidateSignal && !(*mValidateSignal)( this, val ) )) { - self->setValue( saved_val ); - self->reportInvalidData(); - self->updateEditor(); + setValue( saved_val ); + reportInvalidData(); + updateEditor(); return; } - self->updateEditor(); - self->onCommit(); + updateEditor(); + onCommit(); } } @@ -278,7 +276,13 @@ void LLSpinCtrl::clear() mbHasBeenSet = FALSE; } - +void LLSpinCtrl::updateLabelColor() +{ + if( mLabelBox ) + { + mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor ); + } +} void LLSpinCtrl::updateEditor() { @@ -297,52 +301,50 @@ void LLSpinCtrl::updateEditor() mEditor->setText( text ); } -void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) +void LLSpinCtrl::onEditorCommit( const LLSD& data ) { BOOL success = FALSE; - LLSpinCtrl* self = (LLSpinCtrl*) userdata; - llassert( caller == self->mEditor ); - - if( self->mEditor->evaluateFloat() ) + if( mEditor->evaluateFloat() ) { - std::string text = self->mEditor->getText(); + std::string text = mEditor->getText(); LLLocale locale(LLLocale::USER_LOCALE); F32 val = (F32) atof(text.c_str()); - if (val < self->mMinValue) val = self->mMinValue; - if (val > self->mMaxValue) val = self->mMaxValue; + if (val < mMinValue) val = mMinValue; + if (val > mMaxValue) val = mMaxValue; - F32 saved_val = self->mValue; - self->mValue = val; + F32 saved_val = mValue; + mValue = val; - if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && - (!self->mValidateSignal || (*(self->mValidateSignal))(self, val))) + if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) && + (!mValidateSignal || (*mValidateSignal)(this, val) )) { success = TRUE; - self->onCommit(); + onCommit(); } else { - self->mValue = saved_val; + mValue = saved_val; } } + updateEditor(); if( success ) { - self->updateEditor(); + updateEditor(); } else { - self->reportInvalidData(); + reportInvalidData(); } } void LLSpinCtrl::forceEditorCommit() { - onEditorCommit(mEditor, this); + onEditorCommit( LLSD() ); } @@ -356,6 +358,7 @@ void LLSpinCtrl::setEnabled(BOOL b) { LLView::setEnabled( b ); mEditor->setEnabled( b ); + updateLabelColor(); } @@ -403,6 +406,7 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label) { llwarns << "Attempting to set label on LLSpinCtrl constructed without one " << getName() << llendl; } + updateLabelColor(); } BOOL LLSpinCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) @@ -434,29 +438,19 @@ void LLSpinCtrl::reportInvalidData() make_ui_sound("UISndBadKeystroke"); } -void LLSpinCtrl::draw() -{ - if( mLabelBox ) - { - mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor ); - } - LLUICtrl::draw(); -} - - BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { if( clicks > 0 ) { while( clicks-- ) { - LLSpinCtrl::onDownBtn(this); + onDownBtn(getValue()); } } else while( clicks++ ) { - LLSpinCtrl::onUpBtn(this); + onUpBtn(getValue()); } return TRUE; @@ -476,12 +470,12 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask) } if(key == KEY_UP) { - LLSpinCtrl::onUpBtn(this); + onUpBtn(getValue()); return TRUE; } if(key == KEY_DOWN) { - LLSpinCtrl::onDownBtn(this); + onDownBtn(getValue()); return TRUE; } if(key == KEY_RETURN) @@ -557,8 +551,6 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * BOOL allow_text_entry = TRUE; node->getAttributeBOOL("allow_text_entry", allow_text_entry); - LLUICtrlCallback callback = NULL; - if(label.empty()) { label.assign( node->getValue() ); @@ -568,7 +560,6 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * rect, label, font, - callback, NULL, initial_value, min_value, diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 9e53c362f..7242296f9 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -56,8 +56,7 @@ public: LLSpinCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font, - void (*commit_callback)(LLUICtrl*, void*), - void* callback_userdata, + commit_callback_t commit_callback, F32 initial_value, F32 min_value, F32 max_value, F32 increment, const std::string& control_name = std::string(), S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH ); @@ -93,8 +92,8 @@ public: virtual F32 getIncrement() { return mIncrement ; } void setLabel(const LLStringExplicit& label); - void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } - void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } + void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } + void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();} void setAllowEdit(BOOL allow_edit); virtual void onTabInto(); @@ -107,17 +106,15 @@ public: virtual BOOL handleScrollWheel(S32 x,S32 y,S32 clicks); virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual void draw(); + void onEditorCommit(const LLSD& data); - static void onEditorCommit(LLUICtrl* caller, void* userdata); - static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); - - static void onUpBtn(void *userdata); - static void onDownBtn(void *userdata); + void onUpBtn(const LLSD& data); + void onDownBtn(const LLSD& data); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); private: + void updateLabelColor(); void updateEditor(); void reportInvalidData(); diff --git a/indra/newview/llstatbar.cpp b/indra/llui/llstatbar.cpp similarity index 93% rename from indra/newview/llstatbar.cpp rename to indra/llui/llstatbar.cpp index 86a790bd6..bed37f2c0 100644 --- a/indra/newview/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -30,7 +30,8 @@ * $/LicenseInfo$ */ -#include "llviewerprecompiledheaders.h" +//#include "llviewerprecompiledheaders.h" +#include "linden_common.h" #include "llstatbar.h" @@ -40,30 +41,31 @@ #include "llfontgl.h" #include "llstat.h" +#include "lluictrlfactory.h" /////////////////////////////////////////////////////////////////////////////////// LLStatBar::LLStatBar(const std::string& name, const LLRect& rect, const std::string& setting, BOOL default_bar, BOOL default_history) : LLView(name, rect, TRUE), - mSetting(setting) + mSetting(setting), + mLabel(name), + mMinBar(0.f), + mMaxBar(50.f), + mStatp(NULL), + mTickSpacing(10.f), + mLabelSpacing(10.f), + mPrecision(0), + mUpdatesPerSec(5), + mPerSec(true), + mDisplayMean(true) { - mMinBar = 0.f; - mMaxBar = 50.f; - mStatp = NULL; - mTickSpacing = 10.f; - mLabelSpacing = 10.f; - mPrecision = 0; - mUpdatesPerSec = 5; - mLabel = name; - mPerSec = TRUE; mValue = 0.f; - mDisplayMean = TRUE; S32 mode = -1; if (mSetting.length() > 0) { - mode = gSavedSettings.getS32(mSetting); + mode = LLUI::sConfigGroup->getS32(mSetting); } @@ -114,7 +116,7 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) mode |= STAT_HISTORY_FLAG; } - gSavedSettings.setS32(mSetting, mode); + LLUI::sConfigGroup->setS32(mSetting, mode); } @@ -294,16 +296,6 @@ void LLStatBar::draw() LLView::draw(); } -const std::string& LLStatBar::getLabel() const -{ - return mLabel; -} - -void LLStatBar::setLabel(const std::string& label) -{ - mLabel = label; -} - void LLStatBar::setUnitLabel(const std::string& unit_label) { mUnitLabel = unit_label; @@ -317,7 +309,7 @@ LLRect LLStatBar::getRequiredRect() { if (mDisplayHistory) { - rect.mTop = 67; + rect.mTop = 35 + mStatp->getNumBins(); } else { diff --git a/indra/newview/llstatbar.h b/indra/llui/llstatbar.h similarity index 94% rename from indra/newview/llstatbar.h rename to indra/llui/llstatbar.h index 517f557b4..8c1ef3ecd 100644 --- a/indra/newview/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -35,7 +35,6 @@ #include "llview.h" #include "llframetimer.h" -#include "llviewercontrol.h" class LLStat; @@ -54,8 +53,6 @@ public: virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - const std::string& getLabel() const; - void setLabel(const std::string& label); void setUnitLabel(const std::string& unit_label); /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. @@ -64,16 +61,16 @@ public: F32 mTickSpacing; F32 mLabelSpacing; U32 mPrecision; + F32 mUpdatesPerSec; BOOL mPerSec; // Use the per sec stats. BOOL mDisplayBar; // Display the bar graph. BOOL mDisplayHistory; BOOL mDisplayMean; // If true, display mean, if false, display current value - F32 mUpdatesPerSec; LLStat *mStatp; private: LLFrameTimer mUpdateTimer; - std::string mLabel; + LLUIString mLabel; std::string mUnitLabel; F32 mValue; std::string mSetting; diff --git a/indra/newview/llstatgraph.cpp b/indra/llui/llstatgraph.cpp similarity index 94% rename from indra/newview/llstatgraph.cpp rename to indra/llui/llstatgraph.cpp index 1249e71b1..2e3be1803 100644 --- a/indra/newview/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -30,7 +30,8 @@ * $/LicenseInfo$ */ -#include "llviewerprecompiledheaders.h" +//#include "llviewerprecompiledheaders.h" +#include "linden_common.h" #include "llstatgraph.h" #include "llrender.h" @@ -40,7 +41,7 @@ #include "llstat.h" #include "llgl.h" #include "llglheaders.h" -#include "llviewercontrol.h" +//#include "llviewercontrol.h" /////////////////////////////////////////////////////////////////////////////////// @@ -109,7 +110,7 @@ void LLStatGraph::draw() // gColors.getColor("ColorDropShadow"), // (S32) gSavedSettings.getF32("DropShadowFloater") ); - static const LLCachedControl menu_default_color(gColors,"MenuDefaultBgColor",LLColor4(0.f,0.f,0.f,1.f)); + static const LLCachedControl menu_default_color(*LLUI::sColorsGroup,"MenuDefaultBgColor",LLColor4(0.f,0.f,0.f,1.f)); color = menu_default_color; gGL.color4fv(color.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE); diff --git a/indra/newview/llstatgraph.h b/indra/llui/llstatgraph.h similarity index 100% rename from indra/newview/llstatgraph.h rename to indra/llui/llstatgraph.h diff --git a/indra/newview/llstatview.cpp b/indra/llui/llstatview.cpp similarity index 66% rename from indra/newview/llstatview.cpp rename to indra/llui/llstatview.cpp index 17c4dcca2..9cd5ceb7e 100644 --- a/indra/newview/llstatview.cpp +++ b/indra/llui/llstatview.cpp @@ -30,7 +30,7 @@ * $/LicenseInfo$ */ -#include "llviewerprecompiledheaders.h" +#include "linden_common.h" #include "llstatview.h" @@ -39,23 +39,21 @@ #include "llfontgl.h" #include "llgl.h" #include "llui.h" +#include "lluictrlfactory.h" #include "llstatbar.h" -#include "llviewercontrol.h" -LLStatView::LLStatView(const std::string& name, const std::string& label, const std::string& setting, const LLRect& rect) - : LLContainerView(name, rect), - mNumStatBars(0), - mSetting(setting) +LLStatView::LLStatView(const LLStatView::Params& p) +: LLContainerView(p), + mNumStatBars(0), + mSetting(p.setting) { - setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - setLabel(label); - BOOL open = FALSE; + BOOL isopen = getDisplayChildren(); if (mSetting.length() > 0) { - open = gSavedSettings.getBOOL(mSetting); + isopen = LLUI::sConfigGroup->getBOOL(mSetting); } - setDisplayChildren(open); /* Flawfinder: ignore */ + setDisplayChildren(isopen); } LLStatView::~LLStatView() @@ -63,8 +61,8 @@ LLStatView::~LLStatView() // Children all cleaned up by default view destructor. if (mSetting.length() > 0) { - BOOL open = getDisplayChildren(); - gSavedSettings.setBOOL(mSetting, open); /* Flawfinder: ignore */ + BOOL isopen = getDisplayChildren(); + LLUI::sConfigGroup->setBOOL(mSetting, isopen); /* Flawfinder: ignore */ } } @@ -74,12 +72,6 @@ LLStatBar *LLStatView::addStat(const std::string& name, LLStat *statp, LLStatBar *stat_barp; LLRect r; -// if (getStatBar(name)) -// { -// llinfos << "LLStatView::addStat - Stat already exists!" << llendl; -// return NULL; -// } - mNumStatBars++; stat_barp = new LLStatBar(name, r, setting, default_bar, default_history); @@ -94,27 +86,10 @@ LLStatBar *LLStatView::addStat(const std::string& name, LLStat *statp, return stat_barp; } -LLStatView *LLStatView::addStatView(const std::string& name, const std::string& label, const std::string& setting, const LLRect& rect) +LLStatView *LLStatView::addStatView(LLStatView::Params& p) { - LLStatView *statview = new LLStatView(name, label, setting, rect); + LLStatView* statview = LLUICtrlFactory::create(p); statview->setVisible(mDisplayChildren); addChildInBack(statview); return statview; -} - - -LLStatBar *LLStatView::getStatBar(const std::string& name) -{ - sb_vector_t::iterator iter; - for(iter = mStatBars.begin(); iter != mStatBars.end(); ++iter) - { - LLStatBar *stat_barp = *iter; - if (stat_barp->getLabel() == name) - { - return stat_barp; - } - } - - // Not found! - return NULL; -} +} \ No newline at end of file diff --git a/indra/newview/llstatview.h b/indra/llui/llstatview.h similarity index 79% rename from indra/newview/llstatview.h rename to indra/llui/llstatview.h index 2ea1eb2cb..397c73ba5 100644 --- a/indra/newview/llstatview.h +++ b/indra/llui/llstatview.h @@ -42,20 +42,25 @@ class LLStatBar; class LLStatView : public LLContainerView { public: - LLStatView(const std::string& name, const std::string& label, const std::string& setting, const LLRect& rect); + struct Params : public LLInitParam::Block + { + Optional setting; + Params() + : setting("setting") + { + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); + } + }; ~LLStatView(); -/* - virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. -*/ +protected: + LLStatView(const Params&); + friend class LLUICtrlFactory; +public: LLStatBar *addStat(const std::string& name, LLStat *statp, const std::string& setting = std::string(), BOOL default_bar = FALSE, BOOL default_history = FALSE); - LLStatBar *getStatBar(const std::string& name); - LLStatView *addStatView(const std::string& name, const std::string& label, const std::string& setting, const LLRect& rect); - + LLStatView *addStatView(LLStatView::Params& p); protected: typedef std::vector sb_vector_t; sb_vector_t mStatBars; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 9a4510690..c0e5b8052 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -318,15 +318,15 @@ void LLTabContainer::draw() if( mIsVertical && has_scroll_arrows ) { // Redraw the arrows so that they appears on top. - gGL.pushMatrix(); - gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f); + gGL.pushUIMatrix(); + gGL.translateUI((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f); mPrevArrowBtn->draw(); - gGL.popMatrix(); + gGL.popUIMatrix(); - gGL.pushMatrix(); - gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f); + gGL.pushUIMatrix(); + gGL.translateUI((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f); mNextArrowBtn->draw(); - gGL.popMatrix(); + gGL.popUIMatrix(); } } @@ -817,7 +817,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, btn_rect.translate(0, -LLBUTTON_V_PAD-2); textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font); - btn = new LLButton(LLStringUtil::null, LLRect(0,0,0,0)); + btn = new LLButton(LLStringUtil::null); } else { @@ -828,7 +828,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, - NULL, NULL, + NULL, font, trimmed_label, trimmed_label); btn->setImages(std::string("tab_left.tga"), std::string("tab_left_selected.tga")); @@ -850,7 +850,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, btn = new LLButton(std::string(child->getName()) + " tab", btn_rect, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, - NULL, NULL, // set userdata below + NULL, // set userdata below font, trimmed_label, trimmed_label ); btn->setVisible( FALSE ); @@ -1646,19 +1646,17 @@ void LLTabContainer::initButtons() out_id = "UIImgBtnScrollUpOutUUID"; in_id = "UIImgBtnScrollUpInUUID"; mPrevArrowBtn = new LLButton(std::string("Up Arrow"), up_arrow_btn_rect, - out_id, in_id, LLStringUtil::null, NULL ); + out_id, in_id, LLStringUtil::null, boost::bind(&LLTabContainer::onPrevBtn,this,_2)); mPrevArrowBtn->setFollowsTop(); mPrevArrowBtn->setFollowsLeft(); - mPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onPrevBtn,this,_2)); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2)); out_id = "UIImgBtnScrollDownOutUUID"; in_id = "UIImgBtnScrollDownInUUID"; mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect, - out_id, in_id, LLStringUtil::null, NULL ); + out_id, in_id, LLStringUtil::null, boost::bind(&LLTabContainer::onNextBtn,this,_2) ); mNextArrowBtn->setFollowsBottom(); mNextArrowBtn->setFollowsLeft(); - mNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onNextBtn,this,_2)); mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2)); } else // Horizontal @@ -1697,17 +1695,14 @@ void LLTabContainer::initButtons() in_id = "UIImgBtnJumpLeftInUUID"; mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect, out_id, in_id, LLStringUtil::null, - NULL, NULL, LLFontGL::getFontSansSerif() ); - mJumpPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onJumpFirstBtn, this, _2)); + boost::bind(&LLTabContainer::onJumpFirstBtn, this, _2), LLFontGL::getFontSansSerif() ); mJumpPrevArrowBtn->setFollowsLeft(); out_id = "UIImgBtnScrollLeftOutUUID"; in_id = "UIImgBtnScrollLeftInUUID"; mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect, out_id, in_id, LLStringUtil::null, - NULL, NULL, LLFontGL::getFontSansSerif() ); - - mPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onPrevBtn, this, _2)); + boost::bind(&LLTabContainer::onPrevBtn, this, _2), LLFontGL::getFontSansSerif() ); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2)); mPrevArrowBtn->setFollowsLeft(); @@ -1715,16 +1710,14 @@ void LLTabContainer::initButtons() in_id = "UIImgBtnJumpRightInUUID"; mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect, out_id, in_id, LLStringUtil::null, - NULL, NULL, LLFontGL::getFontSansSerif()); - mJumpNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onJumpLastBtn, this, _2)); + boost::bind(&LLTabContainer::onJumpLastBtn, this, _2), LLFontGL::getFontSansSerif()); mJumpNextArrowBtn->setFollowsRight(); out_id = "UIImgBtnScrollRightOutUUID"; in_id = "UIImgBtnScrollRightInUUID"; mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect, out_id, in_id, LLStringUtil::null, - NULL, NULL, LLFontGL::getFontSansSerif()); - mNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onNextBtn, this, _2)); + boost::bind(&LLTabContainer::onNextBtn, this, _2), LLFontGL::getFontSansSerif()); mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2)); mNextArrowBtn->setFollowsRight(); diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 8262009b1..4248ecead 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -40,7 +40,7 @@ static LLRegisterWidget r("text"); LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text, const LLFontGL* font, BOOL mouse_opaque) -: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), +: LLUICtrl(name, rect, mouse_opaque, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), mFontGL(font ? font : LLFontGL::getFontSansSerifSmall()) { initDefaults(); @@ -50,7 +50,7 @@ LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::str LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width, const LLFontGL* font, BOOL mouse_opaque) : - LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), + LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(font ? font : LLFontGL::getFontSansSerifSmall()) { initDefaults(); @@ -60,7 +60,7 @@ LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_w } LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) : - LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), + LLUICtrl(name_and_label, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(LLFontGL::getFontSansSerifSmall()) { initDefaults(); @@ -89,7 +89,6 @@ void LLTextBox::initDefaults() mHAlign = LLFontGL::LEFT; mVAlign = LLFontGL::TOP; mClickedCallback = NULL; - mCallbackUserData = NULL; } BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) @@ -140,7 +139,7 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) // If mouseup in the widget, it's been clicked if (mClickedCallback) { - (*mClickedCallback)( mCallbackUserData ); + mClickedCallback(); } } @@ -298,8 +297,7 @@ void LLTextBox::draw() if (mBackgroundVisible) { - LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 ); - gl_rect_2d( r, mBackgroundColor ); + gl_rect_2d( getLocalRect(), mBackgroundColor ); } S32 text_x = 0; diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 12a251622..de3e0c6e5 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -43,6 +43,7 @@ class LLTextBox : public LLUICtrl { public: + typedef boost::function callback_t; // By default, follows top and left and is mouse-opaque. // If no text, text = name. // If no font, uses default system font. @@ -93,7 +94,7 @@ public: void setVPad(S32 pixels) { mVPad = pixels; } void setRightAlign() { mHAlign = LLFontGL::RIGHT; } void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } - void setClickedCallback( void (*cb)(void *data), void* data = NULL ){ mClickedCallback = cb; mCallbackUserData = data; } // mouse down and up within button + void setClickedCallback( callback_t cb ) { mClickedCallback = cb; } const LLFontGL* getFont() const { return mFontGL; } @@ -137,7 +138,7 @@ private: LLFontGL::VAlign mVAlign; std::vector mLineLengthList; - void (*mClickedCallback)(void* data ); + callback_t mClickedCallback; void* mCallbackUserData; }; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 59fbd367b..ed749aabb 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -257,7 +257,7 @@ LLTextEditor::LLTextEditor( const LLFontGL* font, BOOL allow_embedded_items) : - LLUICtrl( name, rect, TRUE, NULL, NULL, FOLLOWS_TOP | FOLLOWS_LEFT ), + LLUICtrl( name, rect, TRUE, NULL, FOLLOWS_TOP | FOLLOWS_LEFT ), mTextIsUpToDate(TRUE), mMaxTextByteLength( max_length ), mPopupMenuHandle(), @@ -331,7 +331,7 @@ LLTextEditor::LLTextEditor( lines_in_doc, 0, page_size, - NULL, this ); + NULL); mScrollbar->setFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); @@ -373,8 +373,6 @@ LLTextEditor::~LLTextEditor() gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() // Scrollbar is deleted by LLView - mHoverSegment = NULL; - std::for_each(mSegments.begin(), mSegments.end(), DeletePointer()); std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); //LLView::deleteViewByHandle(mPopupMenuHandle); @@ -946,10 +944,10 @@ const LLTextSegment* LLTextEditor::getPreviousSegment() const { // find segment index at character to left of cursor (or rightmost edge of selection) S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1); - return idx >= 0 ? mSegments[idx] : NULL; + return idx >= 0 ? mSegments[idx] : LLTextSegmentPtr(); } -void LLTextEditor::getSelectedSegments(std::vector& segments) const +void LLTextEditor::getSelectedSegments(std::vector& segments) const { S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos; S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos; @@ -1527,7 +1525,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) // Check to see if we're over an HTML-style link if( !mSegments.empty() ) { - const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); + LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment ) { if(cur_segment->getStyle()->isLink()) @@ -2128,6 +2126,8 @@ void LLTextEditor::cut() deleteSelection( FALSE ); needsReflow(); + + onKeyStroke(); } BOOL LLTextEditor::canCopy() const @@ -2244,6 +2244,8 @@ void LLTextEditor::pasteHelper(bool is_primary) deselect(); needsReflow(); + + onKeyStroke(); } @@ -2506,6 +2508,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return break; } + if (handled) + { + onKeyStroke(); + } return handled; } @@ -2665,6 +2671,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) deselect(); needsReflow(); + onKeyStroke(); } } @@ -2723,6 +2730,7 @@ void LLTextEditor::doDelete() } needsReflow(); + onKeyStroke(); } //---------------------------------------------------------------------------- @@ -2766,6 +2774,7 @@ void LLTextEditor::undo() setCursorPos(pos); needsReflow(); + onKeyStroke(); } BOOL LLTextEditor::canRedo() const @@ -2808,6 +2817,7 @@ void LLTextEditor::redo() setCursorPos(pos); needsReflow(); + onKeyStroke(); } void LLTextEditor::onFocusReceived() @@ -3635,7 +3645,6 @@ void LLTextEditor::onTabInto() void LLTextEditor::clear() { setText(LLStringUtil::null); - std::for_each(mSegments.begin(), mSegments.end(), DeletePointer()); mSegments.clear(); } @@ -4153,7 +4162,7 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool { S32 segment_start = old_length; S32 segment_end = getLength(); - LLTextSegment* segment = new LLTextSegment(stylep, segment_start, segment_end ); + LLTextSegmentPtr segment = new LLTextSegment(stylep, segment_start, segment_end ); mSegments.push_back(segment); } @@ -4371,13 +4380,12 @@ void LLTextEditor::updateSegments() // Make sure we have at least one segment if (mSegments.size() == 1 && mSegments[0]->getIsDefault()) { - delete mSegments[0]; mSegments.clear(); // create default segment } if (mSegments.empty()) { LLColor4& text_color = ( mReadOnly ? mReadOnlyFgColor : mFgColor ); - LLTextSegment* default_segment = new LLTextSegment( text_color, 0, mWText.length() ); + LLTextSegmentPtr default_segment = new LLTextSegment( text_color, 0, mWText.length() ); default_segment->setIsDefault(TRUE); mSegments.push_back(default_segment); } @@ -4408,7 +4416,6 @@ void LLTextEditor::pruneSegments() { // erase invalid segments ++iter; - std::for_each(iter, mSegments.end(), DeletePointer()); mSegments.erase(iter, mSegments.end()); } else @@ -4420,7 +4427,6 @@ void LLTextEditor::pruneSegments() void LLTextEditor::findEmbeddedItemSegments() { mHoverSegment = NULL; - std::for_each(mSegments.begin(), mSegments.end(), DeletePointer()); mSegments.clear(); BOOL found_embedded_items = FALSE; @@ -4501,18 +4507,18 @@ BOOL LLTextEditor::handleMouseUpOverSegment(S32 x, S32 y, MASK mask) // Finds the text segment (if any) at the give local screen position -const LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y ) const +LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y ) const { // Find the cursor position at the requested local screen position S32 offset = getCursorPosFromLocalCoord( x, y, FALSE ); S32 idx = getSegmentIdxAtOffset(offset); - return idx >= 0 ? mSegments[idx] : NULL; + return idx >= 0 ? mSegments[idx] : LLTextSegmentPtr(); } const LLTextSegment* LLTextEditor::getSegmentAtOffset(S32 offset) const { S32 idx = getSegmentIdxAtOffset(offset); - return idx >= 0 ? mSegments[idx] : NULL; + return idx >= 0 ? mSegments[idx] : LLTextSegmentPtr(); } S32 LLTextEditor::getSegmentIdxAtOffset(S32 offset) const @@ -5068,6 +5074,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, // Update of the preedit should be caused by some key strokes. mKeystrokeTimer.reset(); + onKeyStroke(); } BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const @@ -5226,3 +5233,13 @@ S32 LLTextEditor::getPreeditFontSize() const { return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } + +void LLTextEditor::setKeystrokeCallback(const keystroke_signal_t::slot_type& callback) +{ + mKeystrokeSignal.connect(callback); +} + +void LLTextEditor::onKeyStroke() +{ + mKeystrokeSignal(this); +} diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 136a8528a..91be64e65 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -73,6 +73,10 @@ public: virtual ~LLTextEditor(); + typedef boost::signals2::signal keystroke_signal_t; + + void setKeystrokeCallback(const keystroke_signal_t::slot_type& callback); + virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); void setTextEditorParameters(LLXMLNodePtr node); @@ -289,7 +293,7 @@ public: const LLTextSegment* getCurrentSegment() const { return getSegmentAtOffset(mCursorPos); } const LLTextSegment* getPreviousSegment() const; - void getSelectedSegments(std::vector& segments) const; + void getSelectedSegments(std::vector& segments) const; static bool isPartOfWord(llwchar c) { return ( (c == '_') || (c == '\'') || LLStringOps::isAlnum((char)c)); } @@ -323,7 +327,7 @@ protected: void unindentLineBeforeCloseBrace(); S32 getSegmentIdxAtOffset(S32 offset) const; - const LLTextSegment* getSegmentAtLocalPos(S32 x, S32 y) const; + LLTextSegment* getSegmentAtLocalPos(S32 x, S32 y) const; const LLTextSegment* getSegmentAtOffset(S32 offset) const; void reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); } @@ -458,9 +462,9 @@ protected: BOOL mParseHighlights; std::string mHTML; - typedef std::vector segment_list_t; + typedef std::vector segment_list_t; segment_list_t mSegments; - const LLTextSegment* mHoverSegment; + LLTextSegmentPtr mHoverSegment; // Scrollbar data class LLScrollbar* mScrollbar; @@ -480,6 +484,7 @@ private: // Methods // void pasteHelper(bool is_primary); + void onKeyStroke(); void updateSegments(); void pruneSegments(); @@ -603,11 +608,12 @@ private: BOOL mHandleEditKeysDirectly; LLCoordGL mLastIMEPosition; // Last position of the IME editor + keystroke_signal_t mKeystrokeSignal; }; // end class LLTextEditor -class LLTextSegment +class LLTextSegment : public LLRefCount { public: // for creating a compare value diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp index 13721aa40..fa9550055 100644 --- a/indra/llui/lltrans.cpp +++ b/indra/llui/lltrans.cpp @@ -35,7 +35,6 @@ #include "lltrans.h" #include "llxmlnode.h" #include "lluictrlfactory.h" -#include "llalertdialog.h" #include "llnotificationsutil.h" #include diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 24e57f790..40f43bf54 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -60,14 +60,16 @@ BOOL gShowTextEditCursor = TRUE; std::map gTranslation; std::list gUntranslated; -LLControlGroup* LLUI::sConfigGroup = NULL; -LLControlGroup* LLUI::sIgnoresGroup = NULL; -LLControlGroup* LLUI::sColorsGroup = NULL; -LLUIAudioCallback LLUI::sAudioCallback = NULL; -LLWindow* LLUI::sWindow = NULL; -LLHtmlHelp* LLUI::sHtmlHelp = NULL; -BOOL LLUI::sShowXUINames = FALSE; -BOOL LLUI::sQAMode = FALSE; +/*static*/ LLControlGroup* LLUI::sConfigGroup = NULL; +/*static*/ LLControlGroup* LLUI::sAccountGroup = NULL; +/*static*/ LLControlGroup* LLUI::sIgnoresGroup = NULL; +/*static*/ LLControlGroup* LLUI::sColorsGroup = NULL; +/*static*/ LLUIAudioCallback LLUI::sAudioCallback = NULL; +/*static*/ LLWindow* LLUI::sWindow = NULL; +/*static*/ LLView* LLUI::sRootView = NULL; +/*static*/ LLHtmlHelp* LLUI::sHtmlHelp = NULL; +/*static*/ BOOL LLUI::sShowXUINames = FALSE; +/*static*/ BOOL LLUI::sQAMode = FALSE; // // Functions @@ -115,6 +117,7 @@ bool handleShowXUINamesChanged(const LLSD& newvalue) } void LLUI::initClass(LLControlGroup* config, + LLControlGroup* account, LLControlGroup* ignores, LLControlGroup* colors, LLImageProviderInterface* image_provider, @@ -125,10 +128,12 @@ void LLUI::initClass(LLControlGroup* config, { LLRender2D::initClass(image_provider, scale_factor); sConfigGroup = config; + sAccountGroup = account; sIgnoresGroup = ignores; sColorsGroup = colors; if (sConfigGroup == NULL + || sAccountGroup == NULL || sIgnoresGroup == NULL || sColorsGroup == NULL) { @@ -286,6 +291,20 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom); } + +LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) +{ + if(sConfigGroup->controlExists(controlname)) + return *sConfigGroup; + if(sAccountGroup->controlExists(controlname)) + return *sAccountGroup; + //if(sIgnoresGroup->controlExists(controlname)) //Identical to sConfigGroup currently. + // return *sIgnoresGroup; + if(sColorsGroup->controlExists(controlname)) + return *sColorsGroup; + return *sConfigGroup; +} + // static void LLUI::setHtmlHelp(LLHtmlHelp* html_help) { diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 3123092f9..44cb0d820 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -62,6 +62,7 @@ public: // Methods // static void initClass(LLControlGroup* config, + LLControlGroup* account, LLControlGroup* ignores, LLControlGroup* colors, LLImageProviderInterface* image_provider, @@ -80,6 +81,8 @@ public: static std::string getLanguage(); //helper functions (should probably move free standing rendering helper functions here) + static LLView* getRootView() { return sRootView; } + static void setRootView(LLView* view) { sRootView = view; } static std::string locateSkin(const std::string& filename); static void setMousePositionScreen(S32 x, S32 y); static void getMousePositionScreen(S32 *x, S32 *y); @@ -97,16 +100,20 @@ public: static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); static void screenRectToGL(const LLRect& screen, LLRect *gl); static void glRectToScreen(const LLRect& gl, LLRect *screen); + // Returns the control group containing the control name, or the default group + static LLControlGroup& getControlControlGroup (const std::string& controlname); static void setHtmlHelp(LLHtmlHelp* html_help); // // Data // static LLControlGroup* sConfigGroup; + static LLControlGroup* sAccountGroup; static LLControlGroup* sIgnoresGroup; static LLControlGroup* sColorsGroup; static LLUIAudioCallback sAudioCallback; static LLWindow* sWindow; + static LLView* sRootView; static BOOL sShowXUINames; static LLHtmlHelp* sHtmlHelp; @@ -389,6 +396,24 @@ template LLRegisterWith LLInitClass::sRegister( template LLRegisterWith LLDestroyClass::sRegister(&T::destroyClass); +template +class LLUICachedControl : public LLCachedControl +{ +public: + // This constructor will declare a control if it doesn't exist in the contol group + LLUICachedControl(const std::string& name, + const T& default_value, + const std::string& comment = "Declared In Code") + : LLCachedControl(LLUI::getControlControlGroup(name), name, default_value, comment) + {} + + // This constructor will signal an error if the control doesn't exist in the control group + LLUICachedControl(const std::string& name) + : LLCachedControl(LLUI::getControlControlGroup(name), name) + {} +}; + + template class LLParamBlock { diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 5e388e233..71e226f85 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -54,23 +54,24 @@ LLUICtrl::LLUICtrl() : { } -LLUICtrl::LLUICtrl(const std::string& name, const LLRect& rect, BOOL mouse_opaque, - void (*on_commit_callback)(LLUICtrl*, void*), - void* callback_userdata, +LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque, + commit_callback_t commit_callback, U32 reshape) : // can't make this automatically follow top and left, breaks lots // of buttons in the UI. JC 7/20/2002 LLView( name, rect, mouse_opaque, reshape ), mCommitSignal(NULL), mValidateSignal(NULL), + mCommitCallback(NULL), mViewModel(LLViewModelPtr(new LLViewModel)), - mCommitCallback( on_commit_callback), mValidateCallback( NULL ), - mCallbackUserData( callback_userdata ), + mCallbackUserData( NULL ), mTentative( FALSE ), mTabStop( TRUE ), mIsChrome(FALSE) { + if(commit_callback) + setCommitCallback(commit_callback); } LLUICtrl::~LLUICtrl() diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 1e6146a3f..ed3ea6244 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -54,9 +54,8 @@ public: typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata); LLUICtrl(); - LLUICtrl( const std::string& name, const LLRect& rect, BOOL mouse_opaque, - LLUICtrlCallback callback, - void* callback_userdata, + LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE, + commit_callback_t commit_callback = NULL, U32 reshape=FOLLOWS_NONE); /*virtual*/ ~LLUICtrl(); diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index c1da6e8e5..d1d3ffd46 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -32,6 +32,7 @@ #include "linden_common.h" +#define LLUICTRLFACTORY_CPP #include "lluictrlfactory.h" #include @@ -70,6 +71,10 @@ #include "lluiimage.h" #include "llviewborder.h" +LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION("Widget Construction"); +LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS("Widget InitFromParams"); +LLFastTimer::DeclareTimer FTM_WIDGET_SETUP("Widget Setup"); + const char XML_HEADER[] = "\n"; const S32 HPAD = 4; @@ -83,7 +88,7 @@ std::vector LLUICtrlFactory::sXUIPaths; class LLUICtrlLocate : public LLUICtrl { public: - LLUICtrlLocate() : LLUICtrl(std::string("locate"), LLRect(0,0,0,0), FALSE, NULL, NULL) { setTabStop(FALSE); } + LLUICtrlLocate() : LLUICtrl(std::string("locate"), LLRect(0,0,0,0), FALSE) { setTabStop(FALSE); } virtual void draw() { } virtual LLXMLNodePtr getXML(bool save_children = true) const @@ -110,6 +115,9 @@ public: static LLRegisterWidget r1("locate"); static LLRegisterWidget r2("pad"); +// Build time optimization, generate this once in .cpp file +template class LLUICtrlFactory* LLSingleton::getInstance(); + //----------------------------------------------------------------------------- // LLUICtrlFactory() //----------------------------------------------------------------------------- @@ -556,12 +564,19 @@ LLView* LLUICtrlFactory::createWidget(LLPanel *parent, LLXMLNodePtr node) if (view) { - parent->addChild(view, tab_group); + setCtrlParent(view, parent, tab_group); } return view; } +//static +void LLUICtrlFactory::setCtrlParent(LLView* view, LLView* parent, S32 tab_group) +{ + if (tab_group == S32_MAX) tab_group = parent->getLastTabGroup(); + parent->addChild(view, tab_group); +} + //----------------------------------------------------------------------------- // createFactoryPanel() //----------------------------------------------------------------------------- diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 345d25cad..3fac2bdb5 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -41,17 +41,54 @@ #include "llinitparam.h" class LLView; -class LLPanel; + + +extern LLFastTimer::DeclareTimer FTM_WIDGET_SETUP; +extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION; +extern LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS; + +// Build time optimization, generate this once in .cpp file +#ifndef LLUICTRLFACTORY_CPP +extern template class LLUICtrlFactory* LLSingleton::getInstance(); +#endif class LLUICtrlFactory : public LLSingleton { -public: +private: + friend class LLSingleton; LLUICtrlFactory(); - // do not call! needs to be public so run-time can clean up the singleton - virtual ~LLUICtrlFactory(); + ~LLUICtrlFactory(); + // only partial specialization allowed in inner classes, so use extra dummy parameter + template + class ParamDefaults : public LLSingleton > + { + public: + ParamDefaults() + { + // recursively fill from base class param block + ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults::instance().get()); + } + + const PARAM_BLOCK& get() { return mPrototype; } + + private: + PARAM_BLOCK mPrototype; + }; + + // base case for recursion, there are NO base classes of LLInitParam::BaseBlock + template + class ParamDefaults : public LLSingleton > + { + public: + const LLInitParam::BaseBlock& get() { return mBaseBlock; } + private: + LLInitParam::BaseBlock mBaseBlock; + }; + +public: void setupPaths(); - + void buildFloater(LLFloater* floaterp, const std::string &filename, const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE); void buildFloaterFromBuffer(LLFloater *floaterp, const std::string &buffer, @@ -82,8 +119,22 @@ public: LLPanel* createFactoryPanel(const std::string& name); - virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node); - virtual LLView* createWidget(LLPanel *parent, LLXMLNodePtr node); + LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node); + LLView* createWidget(LLPanel *parent, LLXMLNodePtr node); + + template + static T* create(typename T::Params& params, LLView* parent = NULL) + { + params.fillFrom(ParamDefaults::instance().get()); + + T* widget = createWidgetImpl(params, parent); + if (widget) + { + widget->postBuild(); + } + + return widget; + } static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root); static bool getLayeredXMLNodeFromBuffer(const std::string &buffer, LLXMLNodePtr& root); @@ -93,6 +144,43 @@ public: private: bool getLayeredXMLNodeImpl(const std::string &filename, LLXMLNodePtr& root); + + void buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename, + const LLCallbackMap::map_t *factory_map, BOOL open); + BOOL buildPanelInternal(LLPanel* panelp, LLXMLNodePtr &root, const std::string &filename, + const LLCallbackMap::map_t* factory_map = NULL); + + template + static T* createWidgetImpl(const typename T::Params& params, LLView* parent = NULL) + { + T* widget = NULL; + + if (!params.validateBlock()) + { + llwarns << /*getInstance()->getCurFileName() <<*/ ": Invalid parameter block for " << typeid(T).name() << llendl; + //return NULL; + } + + { LLFastTimer _(FTM_WIDGET_CONSTRUCTION); + widget = new T(params); + } + { LLFastTimer _(FTM_INIT_FROM_PARAMS); + widget->initFromParams(params); + } + + if (parent) + { + S32 tab_group = params.tab_group.isProvided() ? params.tab_group() : S32_MAX; + setCtrlParent(widget, parent, tab_group); + } + return widget; + } + + // this exists to get around dependency on llview + static void setCtrlParent(LLView* view, LLView* parent, S32 tab_group); + + LLPanel* mDummyPanel; + typedef std::map, std::string> built_panel_t; built_panel_t mBuiltPanels; @@ -102,13 +190,6 @@ private: std::deque mFactoryStack; static std::vector sXUIPaths; - - LLPanel* mDummyPanel; - - void buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename, - const LLCallbackMap::map_t *factory_map, BOOL open); - BOOL buildPanelInternal(LLPanel* panelp, LLXMLNodePtr &root, const std::string &filename, - const LLCallbackMap::map_t* factory_map = NULL); }; diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index 0b76b8e81..0332765f1 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -33,31 +33,35 @@ #include "linden_common.h" #include "lluistring.h" #include "llsd.h" +#include "lltrans.h" -const LLStringUtil::format_map_t LLUIString::sNullArgs; +LLFastTimer::DeclareTimer FTM_UI_STRING("UI String"); LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args) - : mOrig(instring), - mArgs(args) +: mOrig(instring), + mArgs(new LLStringUtil::format_map_t(args)) { - format(); + dirty(); } void LLUIString::assign(const std::string& s) { mOrig = s; - format(); + dirty(); } void LLUIString::setArgList(const LLStringUtil::format_map_t& args) + { - mArgs = args; - format(); + getArgs() = args; + dirty(); } void LLUIString::setArgs(const LLSD& sd) { + LLFastTimer timer(FTM_UI_STRING); + if (!sd.isMap()) return; for(LLSD::map_const_iterator sd_it = sd.beginMap(); sd_it != sd.endMap(); @@ -65,40 +69,40 @@ void LLUIString::setArgs(const LLSD& sd) { setArg(sd_it->first, sd_it->second.asString()); } - format(); + dirty(); } void LLUIString::setArg(const std::string& key, const std::string& replacement) { - mArgs[key] = replacement; - format(); + getArgs()[key] = replacement; + dirty(); } void LLUIString::truncate(S32 maxchars) { - if (mWResult.size() > (size_t)maxchars) + if (getUpdatedWResult().size() > (size_t)maxchars) { - LLWStringUtil::truncate(mWResult, maxchars); - mResult = wstring_to_utf8str(mWResult); + LLWStringUtil::truncate(getUpdatedWResult(), maxchars); + mResult = wstring_to_utf8str(getUpdatedWResult()); } } void LLUIString::erase(S32 charidx, S32 len) { - mWResult.erase(charidx, len); - mResult = wstring_to_utf8str(mWResult); + getUpdatedWResult().erase(charidx, len); + mResult = wstring_to_utf8str(getUpdatedWResult()); } void LLUIString::insert(S32 charidx, const LLWString& wchars) { - mWResult.insert(charidx, wchars); - mResult = wstring_to_utf8str(mWResult); + getUpdatedWResult().insert(charidx, wchars); + mResult = wstring_to_utf8str(getUpdatedWResult()); } void LLUIString::replace(S32 charidx, llwchar wc) { - mWResult[charidx] = wc; - mResult = wstring_to_utf8str(mWResult); + getUpdatedWResult()[charidx] = wc; + mResult = wstring_to_utf8str(getUpdatedWResult()); } void LLUIString::clear() @@ -109,9 +113,48 @@ void LLUIString::clear() mWResult.clear(); } -void LLUIString::format() +void LLUIString::dirty() { - mResult = mOrig; - LLStringUtil::format(mResult, mArgs); - mWResult = utf8str_to_wstring(mResult); + mNeedsResult = true; + mNeedsWResult = true; +} + +void LLUIString::updateResult() const +{ + mNeedsResult = false; + + LLFastTimer timer(FTM_UI_STRING); + + // optimize for empty strings (don't attempt string replacement) + if (mOrig.empty()) + { + mResult.clear(); + mWResult.clear(); + return; + } + mResult = mOrig; + + // get the default args + local args + LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs(); + if (mArgs && !mArgs->empty()) + { + combined_args.insert(mArgs->begin(), mArgs->end()); + } + LLStringUtil::format(mResult, combined_args); +} + +void LLUIString::updateWResult() const +{ + mNeedsWResult = false; + + mWResult = utf8str_to_wstring(getUpdatedResult()); +} + +LLStringUtil::format_map_t& LLUIString::getArgs() +{ + if (!mArgs) + { + mArgs = new LLStringUtil::format_map_t; + } + return *mArgs; } diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index aedeca27c..d88c3cd66 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -51,9 +51,9 @@ // llinfos << mMessage.getString() << llendl; // outputs "Welcome Steve to Second Life" // mMessage.setArg("[USERNAME]", "Joe"); // llinfos << mMessage.getString() << llendl; // outputs "Welcome Joe to Second Life" -// mMessage = "Recepci￳n a la [SECONDLIFE] [USERNAME]" +// mMessage = "Bienvenido a la [SECONDLIFE] [USERNAME]" // mMessage.setArg("[SECONDLIFE]", "Segunda Vida"); -// llinfos << mMessage.getString() << llendl; // outputs "Recepci￳n a la Segunda Vida Joe" +// llinfos << mMessage.getString() << llendl; // outputs "Bienvenido a la Segunda Vida Joe" // Implementation Notes: // Attempting to have operator[](const std::string& s) return mArgs[s] fails because we have @@ -64,9 +64,10 @@ class LLUIString public: // These methods all perform appropriate argument substitution // and modify mOrig where appropriate - LLUIString() {} + LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {} LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args); - LLUIString(const std::string& instring) { assign(instring); } + LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); } + ~LLUIString() { delete mArgs; } void assign(const std::string& instring); LLUIString& operator=(const std::string& s) { assign(s); return *this; } @@ -76,34 +77,45 @@ public: void setArgs(const class LLSD& sd); void setArg(const std::string& key, const std::string& replacement); - const std::string& getString() const { return mResult; } - operator std::string() const { return mResult; } + const std::string& getString() const { return getUpdatedResult(); } + operator std::string() const { return getUpdatedResult(); } - const LLWString& getWString() const { return mWResult; } - operator LLWString() const { return mWResult; } + const LLWString& getWString() const { return getUpdatedWResult(); } + operator LLWString() const { return getUpdatedWResult(); } - bool empty() const { return mWResult.empty(); } - S32 length() const { return mWResult.size(); } + bool empty() const { return getUpdatedResult().empty(); } + S32 length() const { return getUpdatedWResult().size(); } void clear(); - void clearArgs() { mArgs.clear(); } - - // These utuilty functions are included for text editing. + void clearArgs() { if (mArgs) mArgs->clear(); } + + // These utility functions are included for text editing. // They do not affect mOrig and do not perform argument substitution void truncate(S32 maxchars); void erase(S32 charidx, S32 len); void insert(S32 charidx, const LLWString& wchars); void replace(S32 charidx, llwchar wc); - - static const LLStringUtil::format_map_t sNullArgs; private: - void format(); - + // something changed, requiring reformatting of strings + void dirty(); + + std::string& getUpdatedResult() const { if (mNeedsResult) { updateResult(); } return mResult; } + LLWString& getUpdatedWResult() const{ if (mNeedsWResult) { updateWResult(); } return mWResult; } + + // do actual work of updating strings (non-inlined) + void updateResult() const; + void updateWResult() const; + LLStringUtil::format_map_t& getArgs(); + std::string mOrig; - std::string mResult; - LLWString mWResult; // for displaying - LLStringUtil::format_map_t mArgs; + mutable std::string mResult; + mutable LLWString mWResult; // for displaying + LLStringUtil::format_map_t* mArgs; + + // controls lazy evaluation + mutable bool mNeedsResult; + mutable bool mNeedsWResult; }; #endif // LL_LLUISTRING_H diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 3674d0f04..7b6202a79 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -146,7 +146,7 @@ void LLView::init(const LLView::Params& p) // create rect first, as this will supply initial follows flags setShape(p.rect); - mReshapeFlags = p.follows.flags; + parseFollowsFlags(p); } LLView::LLView() @@ -1164,7 +1164,7 @@ void LLView::drawChildren() }*/ if (!mChildList.empty()) { - LLView* rootp = getRootView(); + LLView* rootp = LLUI::getRootView(); ++sDepth; for (child_list_const_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend(); ++child_iter) @@ -2409,6 +2409,78 @@ const S32 FLOATER_H_MARGIN = 15; const S32 MIN_WIDGET_HEIGHT = 10; const S32 VPAD = 4; +void LLView::initFromParams(const LLView::Params& params) +{ + LLRect required_rect = getRequiredRect(); + + S32 width = llmax(getRect().getWidth(), required_rect.getWidth()); + S32 height = llmax(getRect().getHeight(), required_rect.getHeight()); + + reshape(width, height); + + // call virtual methods with most recent data + // use getters because these values might not come through parameter block + setEnabled(getEnabled()); + setVisible(getVisible()); + + if (!params.name().empty()) + { + setName(params.name()); + } +} + +void LLView::parseFollowsFlags(const LLView::Params& params) +{ + // preserve follows flags set by code if user did not override + /*if (!params.follows.isProvided()) + { + return; + }*/ + + // interpret either string or bitfield version of follows + if (params.follows.string.isChosen()) + { + setFollows(FOLLOWS_NONE); + + std::string follows = params.follows.string; + + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("|"); + tokenizer tokens(follows, sep); + tokenizer::iterator token_iter = tokens.begin(); + + while(token_iter != tokens.end()) + { + const std::string& token_str = *token_iter; + if (token_str == "left") + { + setFollowsLeft(); + } + else if (token_str == "right") + { + setFollowsRight(); + } + else if (token_str == "top") + { + setFollowsTop(); + } + else if (token_str == "bottom") + { + setFollowsBottom(); + } + else if (token_str == "all") + { + setFollowsAll(); + } + ++token_iter; + } + } + else if (params.follows.flags.isChosen()) + { + setFollows(params.follows.flags); + } +} + // static U32 LLView::createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, const LLRect &required_rect) { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 2ec5ce58c..54c298824 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -307,7 +307,9 @@ public: // remove the specified child from the view, and set it's parent to NULL. virtual void removeChild(LLView* view); - child_tab_order_t getCtrlOrder() const { return mCtrlOrder; } + virtual BOOL postBuild() { return TRUE; } + + const child_tab_order_t& getCtrlOrder() const { return mCtrlOrder; } ctrl_list_t getCtrlList() const; ctrl_list_t getCtrlListSorted() const; @@ -410,6 +412,8 @@ public: virtual void draw(); + void parseFollowsFlags(const LLView::Params& params); + virtual LLXMLNodePtr getXML(bool save_children = true) const; //FIXME: make LLView non-instantiable from XML static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 80a272789..3c5601337 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -2068,7 +2068,7 @@ void LLWindowSDL::initCursors() mSDLCursors[UI_CURSOR_SIZEWE] = makeSDLCursorFromBMP("sizewe.BMP",16,14); mSDLCursors[UI_CURSOR_SIZENS] = makeSDLCursorFromBMP("sizens.BMP",17,16); mSDLCursors[UI_CURSOR_NO] = makeSDLCursorFromBMP("llno.BMP",8,8); - mSDLCursors[UI_CURSOR_WORKING] = makeSDLCursorFromBMP("working.BMP",12,15); + mSDLCursors[UI_CURSOR_WORKING] = makeSDLCursorFromBMP("working.BMP",0,0); mSDLCursors[UI_CURSOR_TOOLGRAB] = makeSDLCursorFromBMP("lltoolgrab.BMP",2,13); mSDLCursors[UI_CURSOR_TOOLLAND] = makeSDLCursorFromBMP("lltoolland.BMP",1,6); mSDLCursors[UI_CURSOR_TOOLFOCUS] = makeSDLCursorFromBMP("lltoolfocus.BMP",8,5); diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index a2fda2bea..5fa9a3430 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -933,9 +933,8 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) { - if(mIncludedFiles.find(filename) != mIncludedFiles.end()) + if(!mIncludedFiles.insert(filename).second) return 0; //Already included this file. - mIncludedFiles.insert(filename); LLSD settings; llifstream infile; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 643d3f17b..2635ad46b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -79,6 +79,7 @@ include_directories( set(viewer_SOURCE_FILES NACLantispam.cpp + aihttpview.cpp aoremotectrl.cpp ascentfloatercontactgroups.cpp ascentkeyword.cpp @@ -91,6 +92,7 @@ set(viewer_SOURCE_FILES floatervoicelicense.cpp generichandlers.cpp hbfloatergrouptitles.cpp + groupchatlistener.cpp hippofloaterxml.cpp hippogridmanager.cpp hippolimits.cpp @@ -118,6 +120,7 @@ set(viewer_SOURCE_FILES llassetuploadresponders.cpp llattachmentsmgr.cpp llaudiosourcevo.cpp + llavataractions.cpp llavatarpropertiesprocessor.cpp llbox.cpp llcallbacklist.cpp @@ -135,7 +138,6 @@ set(viewer_SOURCE_FILES llcompilequeue.cpp llconfirmationmanager.cpp llconsole.cpp - llcontainerview.cpp llcurrencyuimanager.cpp llcylinder.cpp lldaycyclemanager.cpp @@ -272,6 +274,7 @@ set(viewer_SOURCE_FILES llgiveinventory.cpp llgivemoney.cpp llglsandbox.cpp + llgroupactions.cpp llgroupmgr.cpp llgroupnotify.cpp llhomelocationresponder.cpp @@ -335,7 +338,6 @@ set(viewer_SOURCE_FILES llpanelavatar.cpp llpanelclassified.cpp llpanelcontents.cpp - llpaneldebug.cpp llpaneldirbrowser.cpp llpaneldirclassified.cpp llpaneldirevents.cpp @@ -416,12 +418,8 @@ set(viewer_SOURCE_FILES llsky.cpp llspatialpartition.cpp llsprite.cpp - llsrv.cpp llstartup.cpp - llstatbar.cpp - llstatgraph.cpp llstatusbar.cpp - llstatview.cpp llstylemap.cpp llsurface.cpp llsurfacepatch.cpp @@ -581,6 +579,7 @@ set(viewer_HEADER_FILES ViewerInstall.cmake NACLantispam.h + aihttpview.h aoremotectrl.h ascentfloatercontactgroups.h ascentkeyword.h @@ -592,6 +591,7 @@ set(viewer_HEADER_FILES floaterlocalassetbrowse.h floatervoicelicense.h generichandlers.h + groupchatlistener.h hbfloatergrouptitles.h hippofloaterxml.h hippogridmanager.h @@ -621,6 +621,7 @@ set(viewer_HEADER_FILES llassetuploadresponders.h llattachmentsmgr.h llaudiosourcevo.h + llavataractions.h llavatarpropertiesprocessor.h llbox.h llcallbacklist.h @@ -638,7 +639,6 @@ set(viewer_HEADER_FILES llcompilequeue.h llconfirmationmanager.h llconsole.h - llcontainerview.h llcurrencyuimanager.h llcylinder.h lldaycyclemanager.h @@ -775,6 +775,7 @@ set(viewer_HEADER_FILES llgesturemgr.h llgiveinventory.h llgivemoney.h + llgroupactions.h llgroupmgr.h llgroupnotify.h llhomelocationresponder.h @@ -838,7 +839,6 @@ set(viewer_HEADER_FILES llpanelavatar.h llpanelclassified.h llpanelcontents.h - llpaneldebug.h llpaneldirbrowser.h llpaneldirclassified.h llpaneldirevents.h @@ -921,12 +921,8 @@ set(viewer_HEADER_FILES llsky.h llspatialpartition.h llsprite.h - llsrv.h llstartup.h - llstatbar.h - llstatgraph.h llstatusbar.h - llstatview.h llstylemap.h llsurface.h llsurfacepatch.h @@ -1066,7 +1062,6 @@ set(viewer_HEADER_FILES noise.h pipeline.h qtoolalign.h - randgauss.h rlvcommon.h rlvdefines.h rlvextensions.h diff --git a/indra/newview/aihttpview.cpp b/indra/newview/aihttpview.cpp new file mode 100644 index 000000000..caa2fc24d --- /dev/null +++ b/indra/newview/aihttpview.cpp @@ -0,0 +1,311 @@ +/** + * @file aihttpview.cpp + * @brief Definition of class AIHTTPView. + * + * Copyright (c) 2013, Aleric Inglewood. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution. + * + * CHANGELOG + * and additional copyright holders. + * + * 28/05/2013 + * Initial version, written by Aleric Inglewood @ SL + */ + +#include "llviewerprecompiledheaders.h" +#include "aihttpview.h" +#include "llrect.h" +#include "llerror.h" +#include "aicurlperservice.h" +#include "llviewerstats.h" +#include "llfontgl.h" +#include "aihttptimeout.h" + +AIHTTPView* gHttpView = NULL; +static S32 sLineHeight; + +// Forward declaration. +namespace AICurlInterface { + size_t getHTTPBandwidth(void); + U32 getNumHTTPAdded(void); + U32 getMaxHTTPAdded(void); +} // namespace AICurlInterface + +//============================================================================= + + //PerService_crat per_service_r(*service.second); +class AIServiceBar : public LLView +{ + private: + AIHTTPView* mHTTPView; + std::string mName; + AIPerServicePtr mPerService; + + public: + AIServiceBar(AIHTTPView* httpview, AIPerService::instance_map_type::value_type const& service) + : LLView("aiservice bar", LLRect(), FALSE), mHTTPView(httpview), mName(service.first), mPerService(service.second) { } + + /*virtual*/ void draw(void); + /*virtual*/ LLRect getRequiredRect(void); +}; + +int const mc_col = number_of_capability_types; // Maximum connections column. +int const bw_col = number_of_capability_types + 1; // Bandwidth column. + +void AIServiceBar::draw() +{ + LLColor4 text_color = LLColor4::white; + F32 height = getRect().getHeight(); + U32 start = 4; + LLFontGL::getFontMonospace()->renderUTF8(mName, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(mName); + std::string text; + PerService_rat per_service_r(*mPerService); + for (int col = 0; col < number_of_capability_types; ++col) + { + AIPerService::CapabilityType& ct(per_service_r->mCapabilityType[col]); + start = mHTTPView->updateColumn(col, start); + if (col < 2) + { + text = llformat(" | %hu-%hu-%lu,{%hu,%u}/%u", ct.mApprovedRequests, ct.mQueuedCommands, ct.mQueuedRequests.size(), ct.mAdded, ct.mDownloading, ct.mMaxPipelinedRequests); + } + else + { + text = llformat(" | --%hu-%lu,{%hu,%u}", ct.mQueuedCommands, ct.mQueuedRequests.size(), ct.mAdded, ct.mDownloading); + } + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + } + start = mHTTPView->updateColumn(mc_col, start); + text = llformat(" | %d/%d", per_service_r->mTotalAdded, per_service_r->mConcurrectConnections); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + start = mHTTPView->updateColumn(bw_col, start); + size_t bandwidth = per_service_r->bandwidth().truncateData(AIHTTPView::getTime_40ms()); + size_t max_bandwidth = mHTTPView->mMaxBandwidthPerService; + text = " | "; + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + text = llformat("%lu", bandwidth / 125); + LLColor4 color = (bandwidth > max_bandwidth) ? LLColor4::red : ((bandwidth > max_bandwidth * .75f) ? LLColor4::yellow : text_color); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + text = llformat("/%lu", max_bandwidth / 125); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); +} + +LLRect AIServiceBar::getRequiredRect(void) +{ + LLRect rect; + rect.mTop = sLineHeight; + return rect; +} + +//============================================================================= + +static int const number_of_header_lines = 2; + +class AIGLHTTPHeaderBar : public LLView +{ + public: + AIGLHTTPHeaderBar(std::string const& name, AIHTTPView* httpview) : + LLView(name, FALSE), mHTTPView(httpview) + { + sLineHeight = llround(LLFontGL::getFontMonospace()->getLineHeight()); + setRect(LLRect(0, 0, 200, sLineHeight * number_of_header_lines)); + } + + /*virtual*/ void draw(void); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ LLRect getRequiredRect(void); + + private: + AIHTTPView* mHTTPView; +}; + +void AIGLHTTPHeaderBar::draw(void) +{ + S32 const v_offset = -1; // Offset from the bottom. Move header one pixel down. + S32 const h_offset = 4; + + LLGLSUIDefault gls_ui; + + LLColor4 text_color(1.f, 1.f, 1.f, 0.75f); + std::string text; + + // First header line. + F32 height = v_offset + sLineHeight * number_of_header_lines; + text = "HTTP console -- [approved]-commandQ-curlQ,{added,downloading}[/max]"; + LLFontGL::getFontMonospace()->renderUTF8(text, 0, h_offset, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); + text = " | Added/Max"; + U32 start = mHTTPView->updateColumn(mc_col, 100); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, LLColor4::green, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + text = " | Tot/Max BW (kbit/s)"; + start = mHTTPView->updateColumn(bw_col, start); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, LLColor4::green, LLFontGL::LEFT, LLFontGL::TOP); + mHTTPView->setWidth(start + LLFontGL::getFontMonospace()->getWidth(text) + h_offset); + + // Second header line. + height -= sLineHeight; + start = h_offset; + text = "Service (host:port)"; + static char const* caption[number_of_capability_types] = { + " | Textures", " | Inventory", " | Mesh", " | Other" + }; + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, LLColor4::green, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + for (int col = 0; col < number_of_capability_types; ++col) + { + start = mHTTPView->updateColumn(col, start); + text = caption[col]; + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, LLColor4::green, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + } + start = mHTTPView->updateColumn(mc_col, start); + text = llformat(" | %u/%u", AICurlInterface::getNumHTTPAdded(), AICurlInterface::getMaxHTTPAdded()); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + + // This bandwidth is averaged over 1 seconds (in bytes/s). + size_t const bandwidth = AICurlInterface::getHTTPBandwidth(); + size_t const max_bandwidth = AIPerService::getHTTPThrottleBandwidth125(); + mHTTPView->mMaxBandwidthPerService = max_bandwidth * AIPerService::throttleFraction(); + LLColor4 color = (bandwidth > max_bandwidth) ? LLColor4::red : ((bandwidth > max_bandwidth * .75f) ? LLColor4::yellow : text_color); + color[VALPHA] = text_color[VALPHA]; + start = mHTTPView->updateColumn(bw_col, start); + text = " | "; + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, LLColor4::green, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + text = llformat("%lu", bandwidth / 125); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, color, LLFontGL::LEFT, LLFontGL::TOP); + start += LLFontGL::getFontMonospace()->getWidth(text); + text = llformat("/%lu", max_bandwidth / 125); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, start, height, text_color, LLFontGL::LEFT, LLFontGL::TOP); +} + +BOOL AIGLHTTPHeaderBar::handleMouseDown(S32 x, S32 y, MASK mask) +{ + return FALSE; +} + +LLRect AIGLHTTPHeaderBar::getRequiredRect() +{ + LLRect rect; + rect.mTop = sLineHeight * number_of_header_lines; + return rect; +} + +//============================================================================= + +AIHTTPView::AIHTTPView(AIHTTPView::Params const& p) : + LLContainerView(p), mGLHTTPHeaderBar(NULL), mWidth(200) +{ + setVisible(FALSE); + setRectAlpha(0.5); +} + +AIHTTPView::~AIHTTPView() +{ + delete mGLHTTPHeaderBar; + mGLHTTPHeaderBar = NULL; +} + +U32 AIHTTPView::updateColumn(int col, U32 start) +{ + llassert(col <= mStartColumn.size()); + if (col == mStartColumn.size()) + { + mStartColumn.push_back(start); + } + else if (mStartColumn[col] < start) + { + mStartColumn[col] = start; + } + return mStartColumn[col]; +} + +U64 AIHTTPView::sTime_40ms; + +struct KillView +{ + void operator()(LLView* viewp) + { + viewp->getParent()->removeChild(viewp); + viewp->die(); + } +}; + +struct CreateServiceBar +{ + AIHTTPView* mHTTPView; + + CreateServiceBar(AIHTTPView* httpview) : mHTTPView(httpview) { } + + void operator()(AIPerService::instance_map_type::value_type const& service) + { + AIServiceBar* service_bar = new AIServiceBar(mHTTPView, service); + mHTTPView->addChild(service_bar); + mHTTPView->mServiceBars.push_back(service_bar); + } +}; + +void AIHTTPView::draw() +{ + for_each(mServiceBars.begin(), mServiceBars.end(), KillView()); + mServiceBars.clear(); + + if (mGLHTTPHeaderBar) + { + removeChild(mGLHTTPHeaderBar); + mGLHTTPHeaderBar->die(); + } + + CreateServiceBar functor(this); + AIPerService::copy_forEach(functor); + + sTime_40ms = get_clock_count() * AICurlPrivate::curlthread::HTTPTimeout::sClockWidth_40ms; + + mGLHTTPHeaderBar = new AIGLHTTPHeaderBar("gl httpheader bar", this); + addChild(mGLHTTPHeaderBar); + + reshape(mWidth, getRect().getHeight(), TRUE); + + for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) + { + LLView* viewp = *child_iter; + if (viewp->getRect().mBottom < 0) + { + viewp->setVisible(FALSE); + } + } + + LLContainerView::draw(); +} + +BOOL AIHTTPView::handleMouseUp(S32 x, S32 y, MASK mask) +{ + return FALSE; +} + +BOOL AIHTTPView::handleKey(KEY key, MASK mask, BOOL called_from_parent) +{ + return FALSE; +} + diff --git a/indra/newview/aihttpview.h b/indra/newview/aihttpview.h new file mode 100644 index 000000000..f63bc5a61 --- /dev/null +++ b/indra/newview/aihttpview.h @@ -0,0 +1,73 @@ +/** + * @file aihttpview.h + * @brief Declaration for AIHTTPView. + * + * Copyright (c) 2013, Aleric Inglewood. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution. + * + * CHANGELOG + * and additional copyright holders. + * + * 28/05/2013 + * Initial version, written by Aleric Inglewood @ SL + */ + +#ifndef AIHTTPVIEW_H +#define AIHTTPVIEW_H + +#include "llcontainerview.h" +#include + +class AIGLHTTPHeaderBar; +class AIServiceBar; +struct CreateServiceBar; + +class AIHTTPView : public LLContainerView +{ + friend class AIGLHTTPHeaderBar; + friend class AIServiceBar; + friend struct CreateServiceBar; + + public: + AIHTTPView(AIHTTPView::Params const& p); + ~AIHTTPView(); + + /*virtual*/ void draw(void); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + + U32 updateColumn(int col, U32 start); + void setWidth(S32 width) { mWidth = width; } + + private: + AIGLHTTPHeaderBar* mGLHTTPHeaderBar; + std::vector mServiceBars; + std::vector mStartColumn; + size_t mMaxBandwidthPerService; + S32 mWidth; + + static U64 sTime_40ms; + + public: + static U64 getTime_40ms(void) { return sTime_40ms; } +}; + +extern AIHTTPView *gHttpView; + +#endif // AIHTTPVIEW_H diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index d43e54989..e9cd38814 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -885,11 +885,11 @@ return Leave current function or event handler # Comment [one_sided_delimiter .8, .3, .15] // Comment:Non-functional commentary or disabled code -[two_sided_delimiter_esc .8, .3, .15] +[two_sided_delimiter .8, .3, .15] /* */ Comment:Non-functional commentary or disabled code # String literals -[two_sided_delimiter_esc 0, .2, 0] -" " String literal +[double_quotation_marks 0, .2, 0] +" String literal #functions are supplied by the program now diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 98336d37a..5b0beb4e7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9,6 +9,17 @@ settings_rlv.xml + PhoenixIMAnnounceStealFocus + + Comment + Open a new IM tab when another person begins typing to you and announce that they are doing so. + Persist + 1 + Type + Boolean + Value + 0 + UseNewTargetOmegaCode Comment @@ -718,6 +729,17 @@ Found in Advanced->Rendering->Info Displays Value 0 + FloaterUnfocusedBackgroundOpaque + + Comment + Disables floaters going transparent when not in focus, may conflict with some skins, though. + Persist + 1 + Type + Boolean + Value + 0 + InstantMessageLogPathAnyAccount Comment @@ -4352,6 +4374,17 @@ This should be as low as possible, but too low may break functionality Value 0.700 + ConsoleBottomOffset + + Comment + User definable offset between the bottom of the chat console and the bottom of the window; increase to move text in the console up + Persist + 1 + Type + S32 + Value + 0 + ConsoleBufferSize Comment @@ -6853,6 +6886,19 @@ This should be as low as possible, but too low may break functionality Value 0 + RadarUpdateEnabled + + Comment + When false, pauses the radar until further notice, good for banning someone who just left. + Persist + 0 + HideFromEditor + 1 + Type + Boolean + Value + 1 + RadarUpdateRate Comment diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorIntelV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorIntelV.glsl new file mode 100644 index 000000000..cdafbd3e3 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorIntelV.glsl @@ -0,0 +1,42 @@ +/** + * @file solidcolorV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 modelview_projection_matrix; + +uniform vec4 color; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + +void main() +{ + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vertex_color = color; + vary_texcoord0 = texcoord0; +} + diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index bc0a0f5ee..cf60bb715 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -328,6 +328,7 @@ void LLPrefsAscentChat::refreshValues() //Chat UI ----------------------------------------------------------------------------- mWoLfVerticalIMTabs = gSavedSettings.getBOOL("WoLfVerticalIMTabs"); mOtherChatsTornOff = gSavedSettings.getBOOL("OtherChatsTornOff"); + mIMAnnounceStealFocus = gSavedSettings.getBOOL("PhoenixIMAnnounceStealFocus"); mShowLocalChatFloaterBar = gSavedSettings.getBOOL("ShowLocalChatFloaterBar"); mHorizButt = gSavedSettings.getBOOL("ContactsUseHorizontalButtons"); mOneLineIMButt = gSavedSettings.getBOOL("UseConciseIMButtons"); @@ -561,6 +562,7 @@ void LLPrefsAscentChat::cancel() //Chat UI ----------------------------------------------------------------------------- gSavedSettings.setBOOL("WoLfVerticalIMTabs", mWoLfVerticalIMTabs); gSavedSettings.setBOOL("OtherChatsTornOff", mOtherChatsTornOff); + gSavedSettings.setBOOL("PhoenixIMAnnounceStealFocus", mIMAnnounceStealFocus); gSavedSettings.setBOOL("ShowLocalChatFloaterBar", mShowLocalChatFloaterBar); gSavedSettings.setBOOL("ContactsUseHorizontalButtons", mHorizButt); gSavedSettings.setBOOL("UseConciseIMButtons", mOneLineIMButt); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index 700800941..aa0b91d9d 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -80,6 +80,7 @@ protected: //Chat UI ----------------------------------------------------------------------------- bool mWoLfVerticalIMTabs; bool mOtherChatsTornOff; + bool mIMAnnounceStealFocus; bool mShowLocalChatFloaterBar; bool mHorizButt; bool mOneLineIMButt; diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 34273a963..9802144ec 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -191,6 +191,7 @@ void LLPrefsAscentVan::refreshValues() mTurnAround = gSavedSettings.getBOOL("TurnAroundWhenWalkingBackwards"); mAnnounceSnapshots = gSavedSettings.getBOOL("AnnounceSnapshots"); mAnnounceStreamMetadata = gSavedSettings.getBOOL("AnnounceStreamMetadata"); + mUnfocusedFloatersOpaque = gSavedSettings.getBOOL("FloaterUnfocusedBackgroundOpaque"); //Tags\Colors ---------------------------------------------------------------------------- mAscentBroadcastTag = gSavedSettings.getBOOL("AscentBroadcastTag"); @@ -259,6 +260,7 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setBOOL("TurnAroundWhenWalkingBackwards", mTurnAround); gSavedSettings.setBOOL("AnnounceSnapshots", mAnnounceSnapshots); gSavedSettings.setBOOL("AnnounceStreamMetadata", mAnnounceStreamMetadata); + gSavedSettings.setBOOL("FloaterUnfocusedBackgroundOpaque", mUnfocusedFloatersOpaque); //Tags\Colors ---------------------------------------------------------------------------- gSavedSettings.setBOOL("AscentBroadcastTag", mAscentBroadcastTag); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index 25e789697..78984b3c5 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -62,6 +62,7 @@ protected: bool mTurnAround; bool mAnnounceSnapshots; bool mAnnounceStreamMetadata; + bool mUnfocusedFloatersOpaque; //Tags\Colors BOOL mAscentBroadcastTag; std::string mReportClientUUID; diff --git a/indra/newview/groupchatlistener.cpp b/indra/newview/groupchatlistener.cpp new file mode 100644 index 000000000..543032737 --- /dev/null +++ b/indra/newview/groupchatlistener.cpp @@ -0,0 +1,81 @@ +/** + * @file groupchatlistener.cpp + * @author Nat Goodspeed + * @date 2011-04-11 + * @brief Implementation for groupchatlistener. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "groupchatlistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llgroupactions.h" +//#include "llimview.h" + + +namespace { + void startIm_wrapper(LLSD const & event) + { + LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID()); + sendReply(LLSDMap("session_id", LLSD(session_id)), event); + } + + /* Singu TODO + void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id) + { + LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START); + } + */ +} + + +GroupChatListener::GroupChatListener(): + LLEventAPI("GroupChat", + "API to enter, leave, send and intercept group chat messages") +{ + add("startIM", + "Enter a group chat in group with UUID [\"id\"]\n" + "Assumes the logged-in agent is already a member of this group.", + &startIm_wrapper); + add("endIM", + "Leave a group chat in group with UUID [\"id\"]\n" + "Assumes a prior successful startIM request.", + &LLGroupActions::endIM, + LLSDArray("id")); + /* Singu TODO + add("sendIM", + "send a groupchat IM", + &send_message_wrapper, + LLSDArray("text")("session_id")("group_id")); + */ +} +/* + static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id, + const LLUUID& other_participant_id, EInstantMessage dialog); +*/ + diff --git a/indra/newview/groupchatlistener.h b/indra/newview/groupchatlistener.h new file mode 100644 index 000000000..42d6a6adc --- /dev/null +++ b/indra/newview/groupchatlistener.h @@ -0,0 +1,41 @@ +/** + * @file groupchatlistener.h + * @author Nat Goodspeed + * @date 2011-04-11 + * @brief + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if ! defined(LL_GROUPCHATLISTENER_H) +#define LL_GROUPCHATLISTENER_H + +#include "lleventapi.h" + +class GroupChatListener: public LLEventAPI +{ +public: + GroupChatListener(); +}; + +#endif /* ! defined(LL_GROUPCHATLISTENER_H) */ + diff --git a/indra/newview/hbfloatergrouptitles.cpp b/indra/newview/hbfloatergrouptitles.cpp index 9ebdae508..f75211730 100644 --- a/indra/newview/hbfloatergrouptitles.cpp +++ b/indra/newview/hbfloatergrouptitles.cpp @@ -40,6 +40,7 @@ #include "hbfloatergrouptitles.h" #include "llagent.h" +#include "llgroupactions.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -145,19 +146,13 @@ void HBFloaterGroupTitles::onActivate(void* userdata) LLUUID group_id = item->getColumn(LIST_GROUP_ID)->getValue().asUUID(); if (group_id != old_group_id) { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); + LLGroupActions::activate(group_id); } // Set the title LLGroupMgr::getInstance()->sendGroupTitleUpdate(group_id, item->getUUID()); // Force a refresh via the observer - if (group_id == LLUUID::null) + if (group_id.isNull()) { group_id = old_group_id; } diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index 68a75796a..e88081969 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -236,7 +236,7 @@ void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); - msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); + msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE); U32 flags = 0; if ( gSavedSettings.getBOOL("NextOwnerCopy") ) { @@ -718,7 +718,7 @@ void ImportTracker::send_properties(LLSD& prim, int counter) msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); - msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); + msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["next_owner_mask"].asString().c_str()))); *//*msg->sendReliable(gAgent.getRegion()->getHost()); @@ -732,7 +732,7 @@ void ImportTracker::send_properties(LLSD& prim, int counter) msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_GROUP); - msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); + msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["group_mask"].asString().c_str()))); *//*msg->sendReliable(gAgent.getRegion()->getHost()); @@ -746,7 +746,7 @@ void ImportTracker::send_properties(LLSD& prim, int counter) msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_EVERYONE); - msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); + msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["everyone_mask"].asString().c_str()))); msg->sendReliable(gAgent.getRegion()->getHost()); diff --git a/indra/newview/jcfloaterareasearch.cpp b/indra/newview/jcfloaterareasearch.cpp index 8479b9a3b..0c37a1da8 100644 --- a/indra/newview/jcfloaterareasearch.cpp +++ b/indra/newview/jcfloaterareasearch.cpp @@ -38,180 +38,132 @@ #include "llscrolllistctrl.h" #include "llagent.h" +#include "llfiltereditor.h" #include "lltracker.h" #include "llviewerobjectlist.h" #include "llviewercontrol.h" #include "jcfloaterareasearch.h" -JCFloaterAreaSearch* JCFloaterAreaSearch::sInstance = NULL; -LLViewerRegion* JCFloaterAreaSearch::sLastRegion = NULL; -S32 JCFloaterAreaSearch::sRequested = 0; -std::map JCFloaterAreaSearch::sObjectDetails; -std::string JCFloaterAreaSearch::sSearchedName; -std::string JCFloaterAreaSearch::sSearchedDesc; -std::string JCFloaterAreaSearch::sSearchedOwner; -std::string JCFloaterAreaSearch::sSearchedGroup; - const std::string request_string = "JCFloaterAreaSearch::Requested_\xF8\xA7\xB5"; const F32 min_refresh_interval = 0.25f; // Minimum interval between list refreshes in seconds. -JCFloaterAreaSearch::JCFloaterAreaSearch() : -LLFloater(), -mCounterText(0), -mResultList(0) +JCFloaterAreaSearch::JCFloaterAreaSearch(const LLSD& data) : + LLFloater(), + mCounterText(0), + mResultList(0), + mLastRegion(0), + mStopped(false) { - llassert_always(sInstance == NULL); - sInstance = this; mLastUpdateTimer.reset(); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_area_search.xml"); } JCFloaterAreaSearch::~JCFloaterAreaSearch() { - sInstance = NULL; } void JCFloaterAreaSearch::close(bool app) { - if (app) + if (app || mStopped) { LLFloater::close(app); } else { - if (sInstance) - { - sInstance->setVisible(FALSE); - } + setVisible(FALSE); } } BOOL JCFloaterAreaSearch::postBuild() { mResultList = getChild("result_list"); - mResultList->setDoubleClickCallback(onDoubleClick,this); + mResultList->setDoubleClickCallback(boost::bind(&JCFloaterAreaSearch::onDoubleClick,this)); mResultList->sortByColumn("Name", TRUE); mCounterText = getChild("counter"); - childSetAction("Refresh", search, this); - childSetAction("Stop", cancel, this); + getChild("Refresh")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onRefresh,this)); + getChild("Stop")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onStop,this)); - childSetKeystrokeCallback("Name query chunk", onCommitLine, 0); - childSetKeystrokeCallback("Description query chunk", onCommitLine, 0); - childSetKeystrokeCallback("Owner query chunk", onCommitLine, 0); - childSetKeystrokeCallback("Group query chunk", onCommitLine, 0); + getChild("Name query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_NAME)); + getChild("Description query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_DESC)); + getChild("Owner query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_OWNER)); + getChild("Group query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_GROUP)); return TRUE; } -// static -void JCFloaterAreaSearch::checkRegion() +void JCFloaterAreaSearch::onOpen() { - // Check if we changed region, and if we did, clear the object details cache. - LLViewerRegion* region = gAgent.getRegion(); - if (region != sLastRegion) - { - sLastRegion = region; - sRequested = 0; - sObjectDetails.clear(); - if (sInstance) - { - sInstance->mResultList->deleteAllItems(); - sInstance->mCounterText->setText(std::string("Listed/Pending/Total")); - } - } -} - -// static -void JCFloaterAreaSearch::toggle() -{ - if (sInstance) - { - if (sInstance->getVisible()) - { - sInstance->setVisible(FALSE); - } - else - { - checkRegion(); - sInstance->setVisible(TRUE); - } - } - else - { - sInstance = new JCFloaterAreaSearch(); - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_area_search.xml"); - } -} - -// static -void JCFloaterAreaSearch::onDoubleClick(void *userdata) -{ - JCFloaterAreaSearch *self = (JCFloaterAreaSearch*)userdata; - LLScrollListItem *item = self->mResultList->getFirstSelected(); - if (!item) return; - LLUUID object_id = item->getUUID(); - LLViewerObject* objectp = gObjectList.findObject(object_id); - if (objectp) - { - LLTracker::trackLocation(objectp->getPositionGlobal(), sObjectDetails[object_id].name, "", LLTracker::LOCATION_ITEM); - } -} - -// static -void JCFloaterAreaSearch::cancel(void* data) -{ - checkRegion(); - if (sInstance) - { - sInstance->close(TRUE); - } - sSearchedName = ""; - sSearchedDesc = ""; - sSearchedOwner = ""; - sSearchedGroup = ""; -} - -// static -void JCFloaterAreaSearch::search(void* data) -{ - //llinfos << "Clicked search" << llendl; checkRegion(); results(); } -// static -void JCFloaterAreaSearch::onCommitLine(LLLineEditor* line, void* user_data) +void JCFloaterAreaSearch::checkRegion(bool force_clear) { - std::string name = line->getName(); - std::string text = line->getText(); - LLStringUtil::toLower(text); - line->setText(text); - if (name == "Name query chunk") sSearchedName = text; - else if (name == "Description query chunk") sSearchedDesc = text; - else if (name == "Owner query chunk") sSearchedOwner = text; - else if (name == "Group query chunk") sSearchedGroup = text; - //llinfos << "loaded " << name << " with "<< text << llendl; - - if (text.length() > 3) + // Check if we changed region, and if we did, clear the object details cache. + LLViewerRegion* region = gAgent.getRegion(); + if (force_clear || region != mLastRegion) { - checkRegion(); - results(); + mLastRegion = region; + mPendingObjects.clear(); + mCachedObjects.clear(); + mResultList->deleteAllItems(); + mCounterText->setText(std::string("Listed/Pending/Total")); } } -// static -void JCFloaterAreaSearch::requestIfNeeded(LLViewerObject *objectp) +void JCFloaterAreaSearch::onDoubleClick() { - LLUUID object_id = objectp->getID(); - if (sObjectDetails.count(object_id) == 0) + LLScrollListItem *item = mResultList->getFirstSelected(); + if (!item) return; + LLUUID object_id = item->getUUID(); + std::map::iterator it = mCachedObjects.find(object_id); + if(it != mCachedObjects.end()) { + LLViewerObject* objectp = gObjectList.findObject(object_id); + if (objectp) + { + LLTracker::trackLocation(objectp->getPositionGlobal(), it->second.name, "", LLTracker::LOCATION_ITEM); + } + } +} + +void JCFloaterAreaSearch::onStop() +{ + mStopped = true; + mPendingObjects.clear(); + mCounterText->setText(std::string("Stopped")); +} + +void JCFloaterAreaSearch::onRefresh() +{ + //llinfos << "Clicked search" << llendl; + mStopped = false; + checkRegion(true); + results(); +} + +void JCFloaterAreaSearch::onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type) +{ + std::string text = value.asString(); + LLStringUtil::toLower(text); + caller->setValue(text); + mFilterStrings[type] = text; + //llinfos << "loaded " << name << " with "<< text << llendl; + checkRegion(); + results(); +} + +bool JCFloaterAreaSearch::requestIfNeeded(LLUUID object_id) +{ + if (!mCachedObjects.count(object_id) && !mPendingObjects.count(object_id)) + { + if(mStopped) + return true; + //llinfos << "not in list" << llendl; - AObjectDetails* details = &sObjectDetails[object_id]; - details->name = request_string; - details->desc = request_string; - details->owner_id = LLUUID::null; - details->group_id = LLUUID::null; + mPendingObjects.insert(object_id); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); @@ -223,20 +175,20 @@ void JCFloaterAreaSearch::requestIfNeeded(LLViewerObject *objectp) msg->addUUIDFast(_PREHASH_ObjectID, object_id); gAgent.sendReliableMessage(); //llinfos << "Sent data request for object " << object_id << llendl; - sRequested++; + return true; } + return false; } -// static void JCFloaterAreaSearch::results() { - if (!sInstance) return; - if (!(sInstance->getVisible())) return; - if (sRequested > 0 && sInstance->mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; + if (!getVisible()) return; + + if (mPendingObjects.size() > 0 && mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; //llinfos << "results()" << llendl; - uuid_vec_t selected = sInstance->mResultList->getSelectedIDs(); - S32 scrollpos = sInstance->mResultList->getScrollPos(); - sInstance->mResultList->deleteAllItems(); + uuid_vec_t selected = mResultList->getSelectedIDs(); + S32 scrollpos = mResultList->getScrollPos(); + mResultList->deleteAllItems(); S32 i; S32 total = gObjectList.getNumObjects(); @@ -250,23 +202,18 @@ void JCFloaterAreaSearch::results() !objectp->flagTemporary() && !objectp->flagTemporaryOnRez()) { LLUUID object_id = objectp->getID(); - if (sObjectDetails.count(object_id) == 0) + if(!requestIfNeeded(object_id)) { - //llinfos << "not all entries are \"\"" << llendl; - requestIfNeeded(objectp); - } - else - { - //llinfos << "all entries are \"\" or we have data" << llendl; - AObjectDetails* details = &sObjectDetails[object_id]; - std::string object_name = details->name; - std::string object_desc = details->desc; - std::string object_owner; - std::string object_group; - gCacheName->getFullName(details->owner_id, object_owner); - gCacheName->getGroupName(details->group_id, object_group); - if (object_name != request_string) + std::map::iterator it = mCachedObjects.find(object_id); + if(it != mCachedObjects.end()) { + //llinfos << "all entries are \"\" or we have data" << llendl; + std::string object_name = it->second.name; + std::string object_desc = it->second.desc; + std::string object_owner; + std::string object_group; + gCacheName->getFullName(it->second.owner_id, object_owner); + gCacheName->getGroupName(it->second.group_id, object_group); //llinfos << "both names are loaded or aren't needed" << llendl; std::string onU = object_owner; std::string cnU = object_group; @@ -274,62 +221,67 @@ void JCFloaterAreaSearch::results() LLStringUtil::toLower(object_desc); LLStringUtil::toLower(object_owner); LLStringUtil::toLower(object_group); - if ((sSearchedName == "" || object_name.find(sSearchedName) != -1) && - (sSearchedDesc == "" || object_desc.find(sSearchedDesc) != -1) && - (sSearchedOwner == "" || object_owner.find(sSearchedOwner) != -1) && - (sSearchedGroup == "" || object_group.find(sSearchedGroup) != -1)) + if ((mFilterStrings[LIST_OBJECT_NAME].empty() || object_name.find(mFilterStrings[LIST_OBJECT_NAME]) != -1) && + (mFilterStrings[LIST_OBJECT_DESC].empty() || object_desc.find(mFilterStrings[LIST_OBJECT_DESC]) != -1) && + (mFilterStrings[LIST_OBJECT_OWNER].empty() || object_owner.find(mFilterStrings[LIST_OBJECT_OWNER]) != -1) && + (mFilterStrings[LIST_OBJECT_GROUP].empty() || object_group.find(mFilterStrings[LIST_OBJECT_GROUP]) != -1)) { //llinfos << "pass" << llendl; LLSD element; element["id"] = object_id; element["columns"][LIST_OBJECT_NAME]["column"] = "Name"; element["columns"][LIST_OBJECT_NAME]["type"] = "text"; - element["columns"][LIST_OBJECT_NAME]["value"] = details->name; //item->getName();//ai->second//"avatar_icon"; + element["columns"][LIST_OBJECT_NAME]["value"] = it->second.name; element["columns"][LIST_OBJECT_DESC]["column"] = "Description"; element["columns"][LIST_OBJECT_DESC]["type"] = "text"; - element["columns"][LIST_OBJECT_DESC]["value"] = details->desc; //ai->second; + element["columns"][LIST_OBJECT_DESC]["value"] = it->second.desc; element["columns"][LIST_OBJECT_OWNER]["column"] = "Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; - element["columns"][LIST_OBJECT_OWNER]["value"] = onU; //ai->first; + element["columns"][LIST_OBJECT_OWNER]["value"] = onU; element["columns"][LIST_OBJECT_GROUP]["column"] = "Group"; element["columns"][LIST_OBJECT_GROUP]["type"] = "text"; element["columns"][LIST_OBJECT_GROUP]["value"] = cnU; //ai->second; - sInstance->mResultList->addElement(element, ADD_BOTTOM); + mResultList->addElement(element, ADD_BOTTOM); } + } } } } } - sInstance->mResultList->updateSort(); - sInstance->mResultList->selectMultiple(selected); - sInstance->mResultList->setScrollPos(scrollpos); - sInstance->mCounterText->setText(llformat("%d listed/%d pending/%d total", sInstance->mResultList->getItemCount(), sRequested, sObjectDetails.size())); - sInstance->mLastUpdateTimer.reset(); + mResultList->updateSort(); + mResultList->selectMultiple(selected); + mResultList->setScrollPos(scrollpos); + mCounterText->setText(llformat("%d listed/%d pending/%d total", mResultList->getItemCount(), mPendingObjects.size(), mPendingObjects.size()+mCachedObjects.size())); + mLastUpdateTimer.reset(); } // static void JCFloaterAreaSearch::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data) { - checkRegion(); + JCFloaterAreaSearch* floater = findInstance(); + if(!floater) + return; + floater->checkRegion(); LLUUID object_id; msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, object_id); - bool exists = (sObjectDetails.count(object_id) != 0); - AObjectDetails* details = &sObjectDetails[object_id]; - if (!exists || details->name == request_string) - { - // We cache unknown objects (to avoid having to request them later) - // and requested objects. - if (exists && sRequested > 0) sRequested--; - msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, details->owner_id); - msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, details->group_id); - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, details->name); - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, details->desc); - gCacheName->get(details->owner_id, false, boost::bind(&JCFloaterAreaSearch::results)); - gCacheName->get(details->group_id, true, boost::bind(&JCFloaterAreaSearch::results)); - //llinfos << "Got info for " << (exists ? "requested" : "unknown") << " object " << object_id << llendl; - } + std::set::iterator it = floater->mPendingObjects.find(object_id); + if(it != floater->mPendingObjects.end()) + floater->mPendingObjects.erase(it); + //else if(floater->mCachedObjects.count(object_id)) //Let entries update. + // return; + + ObjectData* data = &floater->mCachedObjects[object_id]; + // We cache unknown objects (to avoid having to request them later) + // and requested objects. + msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, data->owner_id); + msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, data->group_id); + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, data->name); + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, data->desc); + gCacheName->get(data->owner_id, false, boost::bind(&JCFloaterAreaSearch::results,floater)); + gCacheName->get(data->group_id, true, boost::bind(&JCFloaterAreaSearch::results,floater)); + //llinfos << "Got info for " << (exists ? "requested" : "unknown") << " object " << object_id << llendl; } diff --git a/indra/newview/jcfloaterareasearch.h b/indra/newview/jcfloaterareasearch.h index 5c9233362..abf2bd592 100644 --- a/indra/newview/jcfloaterareasearch.h +++ b/indra/newview/jcfloaterareasearch.h @@ -40,59 +40,53 @@ class LLTextBox; class LLScrollListCtrl; class LLViewerRegion; -struct AObjectDetails -{ - LLUUID id; - std::string name; - std::string desc; - LLUUID owner_id; - LLUUID group_id; -}; - -class JCFloaterAreaSearch : public LLFloater +class JCFloaterAreaSearch : public LLFloater, public LLFloaterSingleton { public: - JCFloaterAreaSearch(); + JCFloaterAreaSearch(const LLSD& data); virtual ~JCFloaterAreaSearch(); /*virtual*/ BOOL postBuild(); /*virtual*/ void close(bool app = false); + /*virtual*/ void onOpen(); - static void results(); - static void toggle(); - static JCFloaterAreaSearch* getInstance() { return sInstance; } + void results(); static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data); private: - static void checkRegion(); - static void cancel(void* data); - static void search(void* data); - static void onCommitLine(LLLineEditor* line, void* user_data); - static void requestIfNeeded(LLViewerObject *objectp); - static void onDoubleClick(void *userdata); enum OBJECT_COLUMN_ORDER { - LIST_OBJECT_NAME, + LIST_OBJECT_NAME = 0, LIST_OBJECT_DESC, LIST_OBJECT_OWNER, - LIST_OBJECT_GROUP + LIST_OBJECT_GROUP, + LIST_OBJECT_COUNT }; - static JCFloaterAreaSearch* sInstance; - - static S32 sRequested; + void checkRegion(bool force_clear = false); + void onStop(); + void onRefresh(); + void onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type); + bool requestIfNeeded(LLUUID object_id); + void onDoubleClick(); LLTextBox* mCounterText; LLScrollListCtrl* mResultList; LLFrameTimer mLastUpdateTimer; + LLViewerRegion* mLastRegion; + bool mStopped; - static std::map sObjectDetails; + struct ObjectData + { + LLUUID id; + std::string name; + std::string desc; + LLUUID owner_id; + LLUUID group_id; + }; + std::set mPendingObjects; + std::map mCachedObjects; - static std::string sSearchedName; - static std::string sSearchedDesc; - static std::string sSearchedOwner; - static std::string sSearchedGroup; - - static LLViewerRegion* sLastRegion; + std::string mFilterStrings[LIST_OBJECT_COUNT]; }; diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 794f4c952..aa4717388 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -43,6 +43,7 @@ #include "llfirstuse.h" #include "llfloatercamera.h" #include "llfloatertools.h" +#include "llgroupactions.h" #include "llgroupmgr.h" #include "llhomelocationresponder.h" #include "llhudmanager.h" @@ -885,11 +886,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) //----------------------------------------------------------------------------- // getRegion() //----------------------------------------------------------------------------- -LLViewerRegion *LLAgent::getRegion() const -{ - return mRegionp; -} - const LLHost& LLAgent::getRegionHost() const { @@ -3252,7 +3248,7 @@ BOOL LLAgent::downGrabbed() const void update_group_floaters(const LLUUID& group_id) { - LLFloaterGroupInfo::refreshGroup(group_id); + LLGroupActions::refresh(group_id); // update avatar info LLFloaterAvatarInfo* fa = LLFloaterAvatarInfo::getInstance(gAgent.getID()); @@ -3305,7 +3301,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. - LLFloaterGroupInfo::closeGroup(group_id); + LLGroupActions::closeGroup(group_id); // refresh the group panel of the search window, if necessary. LLFloaterDirectory::refreshGroup(group_id); } @@ -3384,7 +3380,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. - LLFloaterGroupInfo::closeGroup(group_id); + LLGroupActions::closeGroup(group_id); // refresh the group panel of the search window, //if necessary. LLFloaterDirectory::refreshGroup(group_id); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 6ae193677..bcc469f5e 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -242,7 +242,7 @@ private: //-------------------------------------------------------------------- public: void setRegion(LLViewerRegion *regionp); - LLViewerRegion *getRegion() const; + LLViewerRegion *getRegion() const { return mRegionp; } const LLHost& getRegionHost() const; BOOL inPrelude(); std::string getSLURL() const; //Return uri for current region diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index ebe13255f..9d4179621 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1493,7 +1493,7 @@ void LLAgentCamera::updateCamera() gAgentAvatarp->mRoot->updateWorldMatrixChildren(); - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + /*for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); //Can be an array. iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; @@ -1502,7 +1502,11 @@ void LLAgentCamera::updateCamera() attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - LLViewerObject *attached_object = (*attachment_iter); + LLViewerObject *attached_object = (*attachment_iter);*/ + std::vector >::iterator attachment_iter = gAgentAvatarp->mAttachedObjectsVector.begin(); + for(;attachment_iter!=gAgentAvatarp->mAttachedObjectsVector.end();++attachment_iter) + {{ + LLViewerObject* attached_object = attachment_iter->first; if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull()) { // clear any existing "early" movements of attachment diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 31088df5c..66d8b81ba 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3921,14 +3921,14 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) bool fUpdateAppearance = false; for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it) { - const LLInventoryItem* linked_item = gInventory.getLinkedItem(*it); - if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(linked_item)) ) + const LLUUID& linked_item_id = gInventory.getLinkedItemID(*it); + if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(gInventory.getItem(linked_item_id))) ) { continue; } fUpdateAppearance = true; - removeCOFItemLinks(linked_item->getUUID()); + removeCOFItemLinks(linked_item_id); } if (fUpdateAppearance) @@ -3948,18 +3948,14 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) { // [RLVa:KB] - Checked: 2013-02-12 (RLVa-1.4.8) - const LLInventoryItem* linked_item = gInventory.getLinkedItem(id_to_remove); - if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(linked_item)) ) + LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove); + if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(gInventory.getItem(linked_item_id))) ) { return; } - - removeCOFItemLinks(linked_item->getUUID()); - updateAppearanceFromCOF(); // [/RLVA:KB] -// LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove); -// removeCOFItemLinks(linked_item_id); -// updateAppearanceFromCOF(); + removeCOFItemLinks(linked_item_id); + updateAppearanceFromCOF(); } bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 07ae74f6b..6cc328c4f 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -53,6 +53,7 @@ #include "llmarketplacenotifications.h" #include "llmd5.h" #include "llmeshrepository.h" +#include "llmodaldialog.h" #include "llpumpio.h" #include "llmimetypes.h" #include "llstartup.h" @@ -688,6 +689,7 @@ bool LLAppViewer::init() // Widget construction depends on LLUI being initialized LLUI::initClass(&gSavedSettings, + &gSavedPerAccountSettings, &gSavedSettings, &gColors, LLUIImageList::getInstance(), diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp new file mode 100644 index 000000000..b48ca89b9 --- /dev/null +++ b/indra/newview/llavataractions.cpp @@ -0,0 +1,734 @@ +/** + * @file llavataractions.cpp + * @brief Friend-related actions (add, remove, offer teleport, etc) + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llavataractions.h" + +#include "llavatarnamecache.h" // IDEVO +#include "llnotificationsutil.h" // for LLNotificationsUtil +#include "roles_constants.h" // for GP_MEMBER_INVITE + +#include "llagent.h" +#include "llcallingcard.h" // LLAvatarTracker +#include "llfloateravatarinfo.h" +#include "llfloatergroupinvite.h" +#include "llfloatergroups.h" +#include "llfloaterworldmap.h" +#include "llgivemoney.h" +#include "llimview.h" // for gIMMgr +#include "llinventoryobserver.h" +#include "llmutelist.h" +#include "lltrans.h" +#include "llvoiceclient.h" +#include "llweb.h" +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h +#include "rlvhandler.h" +// [/RLVa:KB] + +extern const S32 TRANS_GIFT; +void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE, S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null); +void handle_lure(const uuid_vec_t& ids); +void send_improved_im(const LLUUID& to_id, const std::string& name, const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, U32 timestamp = NO_TIMESTAMP, const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET, S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE); + +// static +void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name) +{ + if(id == gAgentID) + { + LLNotificationsUtil::add("AddSelfFriend"); + return; + } + + LLSD args; + args["NAME"] = name; + LLSD payload; + payload["id"] = id; + payload["name"] = name; + + LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); +} + +void on_avatar_name_friendship(const LLUUID& id, const LLAvatarName av_name) +{ + LLAvatarActions::requestFriendshipDialog(id, av_name.getCompleteName()); +} + +// static +void LLAvatarActions::requestFriendshipDialog(const LLUUID& id) +{ + if(id.isNull()) + { + return; + } + + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_friendship, _1, _2)); +} + +// static +void LLAvatarActions::removeFriendDialog(const LLUUID& id) +{ + if (id.isNull()) + return; + + uuid_vec_t ids; + ids.push_back(id); + removeFriendsDialog(ids); +} + +// static +void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids) +{ + if(ids.size() == 0) + return; + + LLSD args; + std::string msgType; + if(ids.size() == 1) + { + LLUUID agent_id = ids[0]; + std::string av_name; + if(LLAvatarNameCache::getPNSName(agent_id, av_name)) + { + args["NAME"] = av_name; + } + + msgType = "RemoveFromFriends"; + } + else + { + msgType = "RemoveMultipleFromFriends"; + } + + LLSD payload; + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + payload["ids"].append(*it); + } + + LLNotificationsUtil::add(msgType, + args, + payload, + &handleRemove); +} + +// static +void LLAvatarActions::offerTeleport(const LLUUID& invitee) +{ + if (invitee.isNull()) + return; + + LLDynamicArray ids; + ids.push_back(invitee); + offerTeleport(ids); +} + +// static +void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) +{ + if (ids.size() == 0) + return; + + handle_lure(ids); +} + +static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(true); + gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id); + make_ui_sound("UISndStartIM"); +} + +// static +void LLAvatarActions::startIM(const LLUUID& id) +{ + if (id.isNull() || gAgentID == id) + return; + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) + { + LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", id/*LLSLURL("agent", id, "completename").getSLURLString()*/)); + return; + } + } +// [/RLVa:KB] + + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) // Bypass expiration, open NOW! + on_avatar_name_cache_start_im(id, av_name); + else + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_cache_start_im, _1, _2)); +} + +// static +void LLAvatarActions::endIM(const LLUUID& id) +{ + if (id.isNull()) + return; + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if (session_id.notNull()) + { + gIMMgr->removeSession(session_id); + } +} + +/* Singu TODO: Voice refactor +static void on_avatar_name_cache_start_call(const LLUUID& agent_id, + const LLAvatarName& av_name) +{ + LLUUID session_id = gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id, true); + if (session_id.notNull()) + { + gIMMgr->startCall(session_id); + } + make_ui_sound("UISndStartIM"); +} + + +// static +void LLAvatarActions::startCall(const LLUUID& id) +{ + if (id.isNull()) + { + return; + } + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) + { + LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", id));//LLSLURL("agent", id, "completename").getSLURLString())); + return; + } + } +// [/RLVa:KB] + + LLAvatarNameCache::get(id, + boost::bind(&on_avatar_name_cache_start_call, _1, _2)); +} + +// static +void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) +{ + if (ids.size() == 0) + { + return; + } + + // convert vector into LLDynamicArray for addSession + LLDynamicArray id_array; + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + const LLUUID& idAgent = *it; + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", idAgent));//LLSLURL("agent", idAgent, "completename").getSLURLString())); + return; + } + id_array.push_back(idAgent); +// [/RLVa:KB] +// id_array.push_back(*it); + } + + // create the new ad hoc voice session + const std::string title = LLTrans::getString("conference-title"); + LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, + ids[0], id_array, true); + if (session_id.isNull()) + { + return; + } + + gIMMgr->autoStartCallOnStartup(session_id); + + make_ui_sound("UISndStartIM"); +} +*/ + +/* AD *TODO: Is this function needed any more? + I fixed it a bit(added check for canCall), but it appears that it is not used + anywhere. Maybe it should be removed? +// static +bool LLAvatarActions::isCalling(const LLUUID &id) +{ + if (id.isNull() || !canCall()) + { + return false; + } + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + return (LLIMModel::getInstance()->findIMSession(session_id) != NULL); +}*/ + +//static +bool LLAvatarActions::canCall() +{ + return LLVoiceClient::getInstance()->voiceEnabled() /*&& LLVoiceClient::getInstance()->isVoiceWorking()*/; +} + +// static +void LLAvatarActions::startConference(const uuid_vec_t& ids) +{ + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + const LLUUID& idAgent = *it; + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", idAgent/*LLSLURL("agent", idAgent, "completename").getSLURLString()*/)); + return; + } +// [/RLVa:KB] + } + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(true); + const std::string title = LLTrans::getString("conference-title"); + gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], ids); + make_ui_sound("UISndStartIM"); +} + +/* Singu TODO: Web Profiles +static const char* get_profile_floater_name(const LLUUID& avatar_id) +{ + // Use different floater XML for our profile to be able to save its rect. + return avatar_id == gAgentID ? "my_profile" : "profile"; +} +*/ + +static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + //if (!gSavedSettings.getBOOL("UseWebProfiles") + //{ + LLFloaterAvatarInfo* floater = LLFloaterAvatarInfo::getInstance(agent_id); + if(!floater) + { + floater = new LLFloaterAvatarInfo(LLTrans::getString("Command_Profile_Label")+" "+av_name.getCompleteName(), agent_id); + floater->center(); + } + + // ...bring that window to front + floater->open(); /*Flawfinder: ignore*/ + //} + /* + else + { + std::string username = av_name.mUsername; + if (username.empty()) + { + username = LLCacheName::buildUsername(av_name.mDisplayName); + } + + llinfos << "opening web profile for " << username << llendl; + std::string url = getProfileURL(username); + + // PROFILES: open in webkit window + LLFloaterWebContent::Params p; + p.url(url). + id(agent_id.asString()); + LLFloaterReg::showInstance(get_profile_floater_name(agent_id), p); + } + */ +} + +// static +void LLAvatarActions::showProfile(const LLUUID& id) +{ + if (id.notNull()) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) // Bypass expiration, open NOW! + on_avatar_name_show_profile(id, av_name); + else + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2)); + } +} + +//static +bool LLAvatarActions::profileVisible(const LLUUID& id) +{ + LLFloater* browser = getProfileFloater(id); + return browser && browser->getVisible(); +} + +//static +LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id) +{ + LLFloater* browser; + //if (!gSavedSettings.getBOOL("UseWebProfiles") + browser = LLFloaterAvatarInfo::getInstance(id); + /*else + browser = dynamic_cast + (LLFloaterReg::findInstance(get_profile_floater_name(id), LLSD().with("id", id))); + */ + return browser; +} + +//static +void LLAvatarActions::hideProfile(const LLUUID& id) +{ + LLFloater* browser = getProfileFloater(id); + if (browser) + { + browser->close(); + } +} + +// static +void LLAvatarActions::showOnMap(const LLUUID& id) +{ + std::string av_name; + if (!LLAvatarNameCache::getPNSName(id, av_name)) + { + LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::showOnMap, id)); + return; + } + + gFloaterWorldMap->trackAvatar(id, av_name); + LLFloaterWorldMap::show(true); +} + +// static +void LLAvatarActions::pay(const LLUUID& id) +{ + LLNotification::Params params("BusyModePay"); + params.functor(boost::bind(&LLAvatarActions::handlePay, _1, _2, id)); + + if (gAgent.getBusy()) + { + // warn users of being in busy mode during a transaction + LLNotifications::instance().add(params); + } + else + { + LLNotifications::instance().forceResponse(params, 1); + } +} + +// static +void LLAvatarActions::kick(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("KickUser", LLSD(), payload, handleKick); +} + +// static +void LLAvatarActions::freeze(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze); +} + +// static +void LLAvatarActions::unfreeze(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, handleUnfreeze); +} + +//static +void LLAvatarActions::csr(const LLUUID& id) +{ + std::string name; + if (!gCacheName->getFullName(id, name)) return; + + std::string url = "http://csr.lindenlab.com/agent/"; + + // slow and stupid, but it's late + S32 len = name.length(); + for (S32 i = 0; i < len; i++) + { + if (name[i] == ' ') + { + url += "%20"; + } + else + { + url += name[i]; + } + } + + LLWeb::loadURL(url); +} + +// Singu TODO: Share inventory code block should live here + +// static +void LLAvatarActions::toggleBlock(const LLUUID& id) +{ + std::string name; + + gCacheName->getFullName(id, name); // needed for mute + LLMute mute(id, name, LLMute::AGENT); + + if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) + { + LLMuteList::getInstance()->remove(mute); + } + else + { + LLMuteList::getInstance()->add(mute); + } +} + +// static +bool LLAvatarActions::canOfferTeleport(const LLUUID& id) +{ + // First use LLAvatarTracker::isBuddy() + // If LLAvatarTracker::instance().isBuddyOnline function only is used + // then for avatars that are online and not a friend it will return false. + // But we should give an ability to offer a teleport for such avatars. + if(LLAvatarTracker::instance().isBuddy(id)) + { + return LLAvatarTracker::instance().isBuddyOnline(id); + } + + return true; +} + +// static +bool LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids) +{ + // We can't send more than 250 lures in a single message, so disable this + // button when there are too many id's selected. + if(ids.size() > 250) return false; + + bool result = true; + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + if(!canOfferTeleport(*it)) + { + result = false; + break; + } + } + return result; +} + +void LLAvatarActions::inviteToGroup(const LLUUID& id) +{ + LLFloaterGroupPicker* widget = LLFloaterGroupPicker::showInstance(LLSD(id)); + if (widget) + { + widget->center(); + widget->setPowersMask(GP_MEMBER_INVITE); + //widget->removeNoneOption(); + widget->setSelectCallback(callback_invite_to_group, (void*)&id); + } +} + +//== private methods ======================================================================================== + +// static +bool LLAvatarActions::handleRemove(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + const LLSD& ids = notification["payload"]["ids"]; + for (LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr) + { + LLUUID id = itr->asUUID(); + const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id); + if (ip) + { + switch (option) + { + case 0: // YES + if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)) + { + LLAvatarTracker::instance().empower(id, FALSE); + LLAvatarTracker::instance().notifyObservers(); + } + LLAvatarTracker::instance().terminateBuddy(id); + LLAvatarTracker::instance().notifyObservers(); + gInventory.addChangedMask(LLInventoryObserver::LABEL | LLInventoryObserver::CALLING_CARD, LLUUID::null); + gInventory.notifyObservers(); + break; + + case 1: // NO + default: + llinfos << "No removal performed." << llendl; + break; + } + } + } + return false; +} + +// static +bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + gAgent.clearBusy(); + } + + LLFloaterPay::payDirectly(&give_money, avatar_id, /*is_group=*/false); + return false; +} + +// static +void LLAvatarActions::callback_invite_to_group(LLUUID group_id, void* id) +{ + uuid_vec_t agent_ids; + agent_ids.push_back(*static_cast(id)); + + LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); +} + + +// static +bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + requestFriendship(notification["payload"]["id"].asUUID(), + notification["payload"]["name"].asString(), + response["message"].asString()); + } + return false; +} + +// static +bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); + msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); + gAgent.sendReliableMessage(); + } + return false; +} +bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); + msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); + gAgent.sendReliableMessage(); + } + return false; +} +bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + std::string text = response["message"].asString(); + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); + msg->addStringFast(_PREHASH_Reason, text ); + gAgent.sendReliableMessage(); + } + return false; +} + +// static +void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) +{ + const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + send_improved_im(target_id, + target_name, + message, + IM_ONLINE, + IM_FRIENDSHIP_OFFERED, + calling_card_folder_id); + + LLSD args; + args["TO_NAME"] = target_name; + + LLSD payload; + payload["from_id"] = target_id; + //payload["SUPPRESS_TOAST"] = true; + LLNotificationsUtil::add("FriendshipOffered", args, payload); +} + +//static +bool LLAvatarActions::isFriend(const LLUUID& id) +{ + return ( NULL != LLAvatarTracker::instance().getBuddyInfo(id) ); +} + +// static +bool LLAvatarActions::isBlocked(const LLUUID& id) +{ + return LLMuteList::getInstance()->isMuted(id); +} + +// static +bool LLAvatarActions::canBlock(const LLUUID& id) +{ + bool is_linden = LLMuteList::getInstance()->isLinden(id); + bool is_self = id == gAgentID; + return !is_self && !is_linden; +} + diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h new file mode 100644 index 000000000..0fc76f3e4 --- /dev/null +++ b/indra/newview/llavataractions.h @@ -0,0 +1,188 @@ +/** + * @file llavataractions.h + * @brief Friend-related actions (add, remove, offer teleport, etc) + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLAVATARACTIONS_H +#define LL_LLAVATARACTIONS_H + +class LLFloater; + +/** + * Friend-related actions (add, remove, offer teleport, etc) + */ +class LLAvatarActions +{ +public: + /** + * Show a dialog explaining what friendship entails, then request friendship. + */ + static void requestFriendshipDialog(const LLUUID& id, const std::string& name); + + /** + * Show a dialog explaining what friendship entails, then request friendship. + */ + static void requestFriendshipDialog(const LLUUID& id); + + /** + * Show a friend removal dialog. + */ + static void removeFriendDialog(const LLUUID& id); + static void removeFriendsDialog(const uuid_vec_t& ids); + + /** + * Show teleport offer dialog. + */ + static void offerTeleport(const LLUUID& invitee); + static void offerTeleport(const uuid_vec_t& ids); + + /** + * Start instant messaging session. + */ + static void startIM(const LLUUID& id); + + /** + * End instant messaging session. + */ + static void endIM(const LLUUID& id); + + /** + * Start an avatar-to-avatar voice call with another user + */ + static void startCall(const LLUUID& id); + + /** + * Start an ad-hoc conference voice call with multiple users + */ + static void startAdhocCall(const uuid_vec_t& ids); + + /** + * Start conference chat with the given avatars. + */ + static void startConference(const uuid_vec_t& ids); + + /** + * Show avatar profile. + */ + static void showProfile(const LLUUID& id); + static void hideProfile(const LLUUID& id); + static bool profileVisible(const LLUUID& id); + static LLFloater* getProfileFloater(const LLUUID& id); + + /** + * Show avatar on world map. + */ + static void showOnMap(const LLUUID& id); + + /** + * Give money to the avatar. + */ + static void pay(const LLUUID& id); + /** + * Block/unblock the avatar. + */ + static void toggleBlock(const LLUUID& id); + + /** + * Return true if avatar with "id" is a friend + */ + static bool isFriend(const LLUUID& id); + + /** + * @return true if the avatar is blocked + */ + static bool isBlocked(const LLUUID& id); + + /** + * @return true if you can block the avatar + */ + static bool canBlock(const LLUUID& id); + + /** + * Return true if the avatar is in a P2P voice call with a given user + */ + /* AD *TODO: Is this function needed any more? + I fixed it a bit(added check for canCall), but it appears that it is not used + anywhere. Maybe it should be removed? + static bool isCalling(const LLUUID &id);*/ + + /** + * @return true if call to the resident can be made + */ + + static bool canCall(); + /** + * Invite avatar to a group. + */ + static void inviteToGroup(const LLUUID& id); + + /** + * Kick avatar off grid + */ + static void kick(const LLUUID& id); + + /** + * Freeze avatar + */ + static void freeze(const LLUUID& id); + + /** + * Unfreeze avatar + */ + static void unfreeze(const LLUUID& id); + + /** + * Open csr page for avatar + */ + static void csr(const LLUUID& id); + + /** + * Checks whether we can offer a teleport to the avatar, only offline friends + * cannot be offered a teleport. + * + * @return false if avatar is a friend and not visibly online + */ + static bool canOfferTeleport(const LLUUID& id); + + /** + * @return false if any one of the specified avatars a friend and not visibly online + */ + static bool canOfferTeleport(const uuid_vec_t& ids); + +private: + static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); + static bool handleRemove(const LLSD& notification, const LLSD& response); + static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id); + static bool handleKick(const LLSD& notification, const LLSD& response); + static bool handleFreeze(const LLSD& notification, const LLSD& response); + static bool handleUnfreeze(const LLSD& notification, const LLSD& response); + static void callback_invite_to_group(LLUUID group_id, void* id); + +public: + // Just request friendship, no dialog. + static void requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message); +}; + +#endif // LL_LLAVATARACTIONS_H + diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index bce3853d2..b8fa0a1bf 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -87,7 +87,7 @@ const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds LLChatBar *gChatBar = NULL; // legacy calllback glue -void toggleChatHistory(LLUICtrl*, const LLSD&); +void toggleChatHistory(); //void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); @@ -138,7 +138,7 @@ LLChatBar::~LLChatBar() BOOL LLChatBar::postBuild() { if (LLUICtrl* history_ctrl = findChild("History")) - history_ctrl->setCommitCallback(toggleChatHistory); + history_ctrl->setCommitCallback(boost::bind(&toggleChatHistory)); if (LLUICtrl* say_ctrl = getChild("Say")) say_ctrl->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1)); @@ -149,8 +149,7 @@ BOOL LLChatBar::postBuild() mInputEditor = findChild("Chat Editor"); if (mInputEditor) { - mInputEditor->setCallbackUserData(this); - mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke); + mInputEditor->setKeystrokeCallback(boost::bind(&LLChatBar::onInputEditorKeystroke,this)); mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost)); mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus)); mInputEditor->setCommitOnFocusLost( FALSE ); @@ -545,13 +544,10 @@ void LLChatBar::stopChat() gSavedSettings.setBOOL("ChatVisible", FALSE); } -// static -void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) +void LLChatBar::onInputEditorKeystroke() { - LLChatBar* self = (LLChatBar *)userdata; - LLWString raw_text; - if (self->mInputEditor) raw_text = self->mInputEditor->getWText(); + if (mInputEditor) raw_text = mInputEditor->getWText(); // Can't trim the end, because that will cause autocompletion // to eat trailing spaces that might be part of a gesture. @@ -580,8 +576,8 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // the selection will already be deleted, but we need to trim // off the character before std::string new_text = raw_text.substr(0, length-1); - self->mInputEditor->setText( new_text ); - self->mInputEditor->setCursorToEnd(); + mInputEditor->setText( new_text ); + mInputEditor->setCursorToEnd(); length = length - 1; } */ @@ -600,15 +596,15 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str)) { - if (self->mInputEditor) + if (mInputEditor) { std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); - self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part - S32 outlength = self->mInputEditor->getLength(); // in characters + mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part + S32 outlength = mInputEditor->getLength(); // in characters // Select to end of line, starting from the character // after the last one the user typed. - self->mInputEditor->setSelection(length, outlength); + mInputEditor->setSelection(length, outlength); } } @@ -890,7 +886,7 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl) } } -void toggleChatHistory(LLUICtrl* ctrl, const LLSD&) +void toggleChatHistory() { LLFloaterChat::toggleInstance(LLSD()); } diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index c4fed67d9..4ab866f8c 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -85,7 +85,7 @@ public: void onClickSay(LLUICtrl* ctrl); static void onTabClick( void* userdata ); - static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); + void onInputEditorKeystroke(); static void onInputEditorFocusLost(); static void onInputEditorGainFocus(); diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 8b349c9cc..5c044a496 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -53,37 +53,8 @@ static LLRegisterWidget r("color_swatch"); -LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, - void (*commit_callback)(LLUICtrl* ctrl, void* userdata), - void* userdata ) -: LLUICtrl(name, rect, TRUE, commit_callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), - mValid( TRUE ), - mColor( color ), - mBorderColor( gColors.getColor("DefaultHighlightLight") ), - mCanApplyImmediately(FALSE), - mOnCancelCallback(NULL), - mOnSelectCallback(NULL) -{ - mCaption = new LLTextBox( name, - LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), - name, - LLFontGL::getFontSansSerifSmall() ); - mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); - addChild( mCaption ); - - // Scalable UI made this off-by-one, I don't know why. JC - LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); - border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); - addChild(mBorder); - - mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); -} - -LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color, - void (*commit_callback)(LLUICtrl* ctrl, void* userdata), - void* userdata ) -: LLUICtrl(name, rect, TRUE, commit_callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), +LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color) +: LLUICtrl(name, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mValid( TRUE ), mColor( color ), mBorderColor( gColors.getColor("DefaultHighlightLight") ), @@ -217,26 +188,34 @@ void LLColorSwatchCtrl::draw() // Check state if ( mValid ) { - // Draw the color swatch - gl_rect_2d_checkerboard( calcScreenRect(), interior ); - gl_rect_2d(interior, mColor, TRUE); - LLColor4 opaque_color = mColor; - opaque_color.mV[VALPHA] = 1.f; - gGL.color4fv(opaque_color.mV); - if (mAlphaGradientImage.notNull()) + if (!mColor.isOpaque()) { - gGL.pushMatrix(); + gl_rect_2d_checkerboard( calcScreenRect(), interior ); + // Draw the color swatch + } + + gl_rect_2d(interior, mColor, TRUE); + if (!mColor.isOpaque()) + { + LLColor4 opaque_color = mColor; + opaque_color.mV[VALPHA] = 1.f; + gGL.color4fv(opaque_color.mV); + if (mAlphaGradientImage.notNull()) { - mAlphaGradientImage->draw(interior, mColor); + gGL.pushMatrix(); + { + mAlphaGradientImage->draw(interior, mColor); + } + gGL.popMatrix(); } - gGL.popMatrix(); } } else { if (!mFallbackImageName.empty()) { - LLPointer fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName); + LLPointer fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, TRUE, + LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if( fallback_image->getComponents() == 4 ) { gl_rect_2d_checkerboard( calcScreenRect(), interior ); @@ -388,8 +367,6 @@ LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa BOOL can_apply_immediately = FALSE; node->getAttributeBOOL("can_apply_immediately", can_apply_immediately); - LLUICtrlCallback callback = NULL; - if (label.empty()) { label.assign(node->getValue()); @@ -399,9 +376,7 @@ LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa name, rect, label, - color, - callback, - NULL ); + color ); color_swatch->setCanApplyImmediately(can_apply_immediately); color_swatch->initFromXML(node, parent); diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index 4d4b42bfe..d406e6a9c 100644 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -56,12 +56,7 @@ public: COLOR_CANCEL } EColorPickOp; - LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata); - LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata); + LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color); ~LLColorSwatchCtrl (); diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp index 80a70a152..e2cc5a153 100644 --- a/indra/newview/llcurrencyuimanager.cpp +++ b/indra/newview/llcurrencyuimanager.cpp @@ -113,7 +113,7 @@ public: bool considerUpdateCurrency(); // return true if update needed void currencyKey(S32); - static void onCurrencyKey(LLLineEditor* caller, void* data); + void onCurrencyKey(LLLineEditor* caller); void prepare(); void updateUI(); @@ -337,13 +337,9 @@ void LLCurrencyUIManager::Impl::currencyKey(S32 value) mCurrencyChanged = true; } -// static -void LLCurrencyUIManager::Impl::onCurrencyKey( - LLLineEditor* caller, void* data) +void LLCurrencyUIManager::Impl::onCurrencyKey(LLLineEditor* caller) { - S32 value = atoi(caller->getText().c_str()); - LLCurrencyUIManager::Impl* self = (LLCurrencyUIManager::Impl*)data; - self->currencyKey(value); + currencyKey(caller->getValue().asInteger()); } void LLCurrencyUIManager::Impl::prepare() @@ -352,8 +348,7 @@ void LLCurrencyUIManager::Impl::prepare() if (lindenAmount) { lindenAmount->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); - lindenAmount->setKeystrokeCallback(onCurrencyKey); - lindenAmount->setCallbackUserData(this); + lindenAmount->setKeystrokeCallback(boost::bind(&LLCurrencyUIManager::Impl::onCurrencyKey,this,_1)); } } diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index ab5ddf18b..527344bf4 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -56,25 +56,25 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy switch(var_type) { case VAR_TYPE_F32: - mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, *((F32*)var), -100.f, 100.f, 0.1f, LLStringUtil::null); + mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, *((F32*)var), -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider1->setPrecision(3); addChild(mSlider1); mSlider2 = NULL; mSlider3 = NULL; break; case VAR_TYPE_S32: - mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, LLStringUtil::null); + mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, LLStringUtil::null); mSlider1->setPrecision(0); addChild(mSlider1); mSlider2 = NULL; mSlider3 = NULL; break; case VAR_TYPE_VEC3: - mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), std::string("x: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, LLStringUtil::null); + mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), std::string("x: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider1->setPrecision(3); - mSlider2 = new LLSliderCtrl(std::string("slider 2"), LLRect(20,100,190,80), std::string("y: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, LLStringUtil::null); + mSlider2 = new LLSliderCtrl(std::string("slider 2"), LLRect(20,100,190,80), std::string("y: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider2->setPrecision(3); - mSlider3 = new LLSliderCtrl(std::string("slider 3"), LLRect(20,70,190,50), std::string("z: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, LLStringUtil::null); + mSlider3 = new LLSliderCtrl(std::string("slider 3"), LLRect(20,70,190,50), std::string("z: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider3->setPrecision(3); addChild(mSlider1); addChild(mSlider2); @@ -85,7 +85,7 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy break; } - mAnimateButton = new LLButton(std::string("Animate"), LLRect(20, 45, 180, 25), LLStringUtil::null, onAnimateClicked, this); + mAnimateButton = new LLButton(std::string("Animate"), LLRect(20, 45, 180, 25), LLStringUtil::null, boost::bind(&LLDebugVarMessageBox::onAnimateClicked, this)); addChild(mAnimateButton); mText = new LLTextBox(std::string("value"), LLRect(20,20,190,0)); @@ -113,7 +113,6 @@ void LLDebugVarMessageBox::show(const std::string& title, F32 *var, F32 max_valu box->mSlider1->setValue(*var); } box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::slider_changed,_1,box)); - box->mSlider1->setCallbackUserData(box); #endif } @@ -200,11 +199,10 @@ void LLDebugVarMessageBox::slider_changed(LLUICtrl* ctrl, void* user_data) } } -void LLDebugVarMessageBox::onAnimateClicked(void* user_data) +void LLDebugVarMessageBox::onAnimateClicked() { - LLDebugVarMessageBox* msg_boxp = (LLDebugVarMessageBox*)user_data; - msg_boxp->mAnimate = !msg_boxp->mAnimate; - msg_boxp->mAnimateButton->setToggleState(msg_boxp->mAnimate); + mAnimate = !mAnimate; + mAnimateButton->setToggleState(mAnimate); } void LLDebugVarMessageBox::onClose(bool app_quitting) diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h index 07062218a..6da5b6b1c 100644 --- a/indra/newview/lldebugmessagebox.h +++ b/indra/newview/lldebugmessagebox.h @@ -67,7 +67,7 @@ protected: static LLDebugVarMessageBox* show(const std::string& title, EDebugVarType var_type, void *var); static void slider_changed(LLUICtrl* ctrl, void* user_data); - static void onAnimateClicked(void* user_data); + void onAnimateClicked(); public: static void show(const std::string& title, F32 *var, F32 max_value = 100.f, F32 increment = 0.1f); diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 92ed63027..e1451a411 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -39,11 +39,13 @@ #include "llfasttimerview.h" #include "llconsole.h" #include "lltextureview.h" +#include "aihttpview.h" #include "llresmgr.h" #include "imageids.h" #include "llvelocitybar.h" #include "llviewerwindow.h" #include "llfloaterstats.h" +#include "lluictrlfactory.h" // // Globals @@ -84,29 +86,40 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect) addChild(mFastTimerView); r.set(150, rect.getHeight() - 50, 870, 100); - gTextureView = new LLTextureView("gTextureView", r); - gTextureView->setRect(r); - gTextureView->setFollowsBottom(); - gTextureView->setFollowsLeft(); + LLTextureView::Params tvp; + tvp.name("gTextureView"); + tvp.rect(r); + tvp.visible(false); + gTextureView = LLUICtrlFactory::create(tvp); addChild(gTextureView); //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); + r.set(150, rect.getHeight() - 50, 870, 100); + AIHTTPView::Params hvp; + hvp.name("gHttpView"); + hvp.rect(r); + hvp.visible(false); + gHttpView = LLUICtrlFactory::create(hvp); + //gHttpView->setFollowsBottom(); + //gHttpView->setFollowsLeft(); + addChild(gHttpView); + if(gAuditTexture) { r.set(150, rect.getHeight() - 50, 900 + LLImageGL::sTextureLoadedCounter.size() * 30, 100); - gTextureSizeView = new LLTextureSizeView("gTextureSizeView"); - gTextureSizeView->setRect(r); - gTextureSizeView->setFollowsBottom(); - gTextureSizeView->setFollowsLeft(); - gTextureSizeView->setType(LLTextureSizeView::TEXTURE_MEM_OVER_SIZE) ; + LLTextureSizeView::Params tsvp; + tsvp.name = "gTextureSizeView"; + tsvp.rect = r; + tsvp.type = LLTextureSizeView::TEXTURE_MEM_OVER_SIZE; + gTextureSizeView = LLUICtrlFactory::create(tsvp); addChild(gTextureSizeView); r.set(150, rect.getHeight() - 50, 900 + LLImageGL::sTextureMemByCategory.size() * 30, 100); - gTextureCategoryView = new LLTextureSizeView("gTextureCategoryView"); - gTextureCategoryView->setRect(r); - gTextureCategoryView->setFollowsBottom(); - gTextureCategoryView->setFollowsLeft(); - gTextureCategoryView->setType(LLTextureSizeView::TEXTURE_MEM_OVER_CATEGORY); + LLTextureSizeView::Params tscp; + tscp.name = "gTextureCategoryView"; + tscp.rect = r; + tscp.type = LLTextureSizeView::TEXTURE_MEM_OVER_CATEGORY; + gTextureSizeView = LLUICtrlFactory::create(tscp); addChild(gTextureCategoryView); } @@ -127,6 +140,7 @@ LLDebugView::~LLDebugView() // These have already been deleted. Fix the globals appropriately. gDebugView = NULL; gTextureView = NULL; + gHttpView = NULL; gTextureSizeView = NULL; gTextureCategoryView = NULL; } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 81cc087cc..8d0f3e971 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -546,16 +546,31 @@ F32 LLDrawable::updateXform(BOOL undamped) } } - if ((mCurrentScale != target_scale) || - (!isRoot() && - (dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED || - !mVObjp->getAngularVelocity().isExactlyZero() || - target_pos != mXform.getPosition() || - target_rot != mXform.getRotation()))) - { //child prim moving or scale change requires immediate rebuild + LLVector3 vec = mCurrentScale-target_scale; + + if (vec*vec > MIN_INTERPOLATE_DISTANCE_SQUARED) + { //scale change requires immediate rebuild mCurrentScale = target_scale; gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE); } + else if (!isRoot() && + (!mVObjp->getAngularVelocity().isExactlyZero() || + dist_squared > 0.f)) + { //child prim moving relative to parent, tag as needing to be rendered atomically and rebuild + dist_squared = 1.f; //keep this object on the move list + if (!isState(LLDrawable::ANIMATED_CHILD)) + { + setState(LLDrawable::ANIMATED_CHILD); + gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE); + mVObjp->dirtySpatialGroup(); + } + } + else if (!isRoot() && ( + dist_vec_squared(old_pos, target_pos) > 0.f + || old_rot != target_rot )) + { //fix for BUG-860, MAINT-2275, MAINT-1742, MAINT-2247 + gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE); + } else if (!getVOVolume() && !isAvatar()) { movePartition(); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 8b1f2a564..95245b8f0 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1066,6 +1066,10 @@ bool LLFace::canRenderAsMask() } const LLTextureEntry* te = getTextureEntry(); + if( !te || !getViewerObject() || !getTexture() ) + { + return false; + } static const LLCachedControl use_rmse_auto_mask("SHUseRMSEAutoMask",false); static const LLCachedControl auto_mask_max_rmse("SHAutoMaskMaxRMSE",.09f); @@ -1168,6 +1172,15 @@ static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_BINORMAL("Binormal"); + +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK("Face Feedback"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_POSITION("Feedback Position"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_NORMAL("Feedback Normal"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_TEXTURE("Feedback Texture"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_COLOR("Feedback Color"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_EMISSIVE("Feedback Emissive"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_BINORMAL("Feedback Binormal"); + static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX_TAIL("Tail"); static LLFastTimer::DeclareTimer FTM_FACE_POSITION_STORE("Pos"); @@ -1375,7 +1388,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, !rebuild_weights && //TODO: add support for weights !volume.isUnique()) //source volume is NOT flexi { //use transform feedback to pack vertex buffer - + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK); + LLGLEnable discard(GL_RASTERIZER_DISCARD); LLVertexBuffer* buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); if (vf.mVertexBuffer.isNull() || buff->getNumVerts() != vf.mNumVertices) @@ -1392,7 +1406,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_pos) { - LLFastTimer t(FTM_FACE_GEOM_POSITION); + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_POSITION); gTransformPositionProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_VERTEX, mGeomIndex, mGeomCount); @@ -1417,7 +1431,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_color) { - LLFastTimer t(FTM_FACE_GEOM_COLOR); + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_COLOR); gTransformColorProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_COLOR, mGeomIndex, mGeomCount); @@ -1433,7 +1447,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_emissive) { - LLFastTimer t(FTM_FACE_GEOM_EMISSIVE); + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_EMISSIVE); gTransformColorProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_EMISSIVE, mGeomIndex, mGeomCount); @@ -1454,7 +1468,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_normal) { - LLFastTimer t(FTM_FACE_GEOM_NORMAL); + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_NORMAL); gTransformNormalProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_NORMAL, mGeomIndex, mGeomCount); @@ -1467,7 +1481,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_binormal) { - LLFastTimer t(FTM_FACE_GEOM_BINORMAL); + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_BINORMAL); gTransformBinormalProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_BINORMAL, mGeomIndex, mGeomCount); @@ -1480,7 +1494,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tcoord) { - LLFastTimer t(FTM_FACE_GEOM_TEXTURE); + LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_TEXTURE); gTransformTexCoordProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD0, mGeomIndex, mGeomCount); diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 839769e27..ebae098e8 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -36,27 +36,24 @@ #include "llagent.h" #include "llappviewer.h" -#include "llimview.h" -#include "llsdutil.h" -#include "llfloateravatarinfo.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llscrolllistctrl.h" +#include "llavataractions.h" #include "llbutton.h" -#include "lltextbox.h" -#include "llmutelist.h" -#include "llviewerobjectlist.h" -#include "llvoavatar.h" #include "llimpanel.h" // LLVoiceChannel +#include "llimview.h" +#include "llmutelist.h" +#include "llscrolllistctrl.h" +#include "llsdutil.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewerobjectlist.h" #include "llviewerwindow.h" +#include "llvoavatar.h" #include "llworld.h" // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] -#include "llavatarname.h" - class AIHTTPTimeoutPolicy; extern AIHTTPTimeoutPolicy muteVoiceResponder_timeout; extern AIHTTPTimeoutPolicy muteTextResponder_timeout; @@ -770,32 +767,14 @@ void LLPanelActiveSpeakers::onClickProfile(void* user_data) // [/RLVa:KB] LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; - LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); - - LLFloaterAvatarInfo::showFromDirectory(speaker_id); + LLAvatarActions::showProfile(panelp->mSpeakerList->getValue().asUUID()); } //static void LLPanelActiveSpeakers::onDoubleClickSpeaker(void* user_data) { -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return; - } -// [/RLVa:KB] - LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; - LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); - - LLPointer speakerp = panelp->mSpeakerMgr->findSpeaker(speaker_id); - - if (speaker_id != gAgent.getID() && speakerp.notNull() && !speakerp->mLegacyName.empty()) - { - // Changed for display name support - //gIMMgr->addSession(speakerp->mDisplayName, IM_NOTHING_SPECIAL, speaker_id); - gIMMgr->addSession(speakerp->mLegacyName, IM_NOTHING_SPECIAL, speaker_id); - } + LLAvatarActions::startIM(panelp->mSpeakerList->getValue().asUUID()); } //static diff --git a/indra/newview/llfloateravatarinfo.cpp b/indra/newview/llfloateravatarinfo.cpp index c9e5ba9cc..4a6883ecf 100644 --- a/indra/newview/llfloateravatarinfo.cpp +++ b/indra/newview/llfloateravatarinfo.cpp @@ -35,95 +35,26 @@ #include "llviewerprecompiledheaders.h" #include "llfloateravatarinfo.h" -#include "llavatarnamecache.h" - -// viewer project includes -#include "llagentdata.h" -#include "llcommandhandler.h" #include "llpanelavatar.h" #include "lluictrlfactory.h" -#include "llweb.h" - -// linden library includes -#include "llinventory.h" -#include "lluuid.h" -#include "message.h" - - -const char FLOATER_TITLE[] = "Profile"; -const LLRect FAI_RECT(0, 530, 420, 0); - -//----------------------------------------------------------------------------- -// Globals -//----------------------------------------------------------------------------- - -class LLAgentHandler : public LLCommandHandler -{ -public: - // requires trusted browser to trigger - LLAgentHandler() : LLCommandHandler("agent", true) { } - - bool handle(const LLSD& params, const LLSD& query_map, - LLMediaCtrl* web) - { - if (params.size() < 2) return false; - LLUUID agent_id; - if (!agent_id.set(params[0], FALSE)) - { - return false; - } - - if (params[1].asString() == "about") - { - LLFloaterAvatarInfo::show(agent_id); - return true; - } - return false; - } -}; -LLAgentHandler gAgentHandler; - -//----------------------------------------------------------------------------- -// Member functions -//----------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- void* LLFloaterAvatarInfo::createPanelAvatar(void* data) { LLFloaterAvatarInfo* self = (LLFloaterAvatarInfo*)data; self->mPanelAvatarp = new LLPanelAvatar("PanelAv", LLRect(), TRUE); // allow edit self + self->mPanelAvatarp->setAvatarID(self->mAvatarID); return self->mPanelAvatarp; } -//---------------------------------------------------------------------------- - - -BOOL LLFloaterAvatarInfo::postBuild() +LLFloaterAvatarInfo::LLFloaterAvatarInfo(const std::string& name, const LLUUID &avatar_id) +: LLFloater(name), LLInstanceTracker(avatar_id), + mAvatarID(avatar_id) { - return TRUE; -} - -LLFloaterAvatarInfo::LLFloaterAvatarInfo(const std::string& name, const LLRect &rect, const LLUUID &avatar_id) -: LLPreview(name, rect, FLOATER_TITLE, LLUUID::null, LLUUID::null), LLInstanceTracker(avatar_id), - mAvatarID( avatar_id ), - mSuggestedOnlineStatus(ONLINE_STATUS_NO) -{ - setAutoFocus(TRUE); + setAutoFocus(true); LLCallbackMap::map_t factory_map; - factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_profile.xml", &factory_map); - - if(mPanelAvatarp) - { - mPanelAvatarp->selectTab(0); - } - - //gCacheName->get(avatar_id, FALSE, callbackLoadAvatarName); - LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterAvatarInfo::callbackLoadAvatarName, this, _1, _2)); } // virtual @@ -133,131 +64,11 @@ LLFloaterAvatarInfo::~LLFloaterAvatarInfo() void LLFloaterAvatarInfo::resetGroupList() { - // only get these updates asynchronously via the group floater, which works on the agent only - if (mAvatarID != gAgentID) - { - return; - } - mPanelAvatarp->resetGroupList(); } -// static -LLFloaterAvatarInfo* LLFloaterAvatarInfo::show(const LLUUID &avatar_id) -{ - if (avatar_id.isNull()) - { - return NULL; - } - - LLFloaterAvatarInfo *floater = LLFloaterAvatarInfo::getInstance(avatar_id); - if(!floater) - { - floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, avatar_id ); - floater->center(); - } - - // ...bring that window to front - floater->open(); /*Flawfinder: ignore*/ - return floater; -} - -// Open profile to a certain tab. -// static -void LLFloaterAvatarInfo::showFromObject(const LLUUID& avatar_id,std::string tab_name) -{ - LLFloaterAvatarInfo *floater = show(avatar_id); - if (floater) - { - floater->mPanelAvatarp->setAvatarID(avatar_id, LLStringUtil::null, ONLINE_STATUS_NO); - floater->mPanelAvatarp->selectTabByName(tab_name); - } -} - -// static -void LLFloaterAvatarInfo::showFromDirectory(const LLUUID &avatar_id) -{ - LLFloaterAvatarInfo *floater = show(avatar_id); - if (floater) - { - floater->mPanelAvatarp->setAvatarID(avatar_id, LLStringUtil::null, ONLINE_STATUS_NO); - } -} - - -// static -void LLFloaterAvatarInfo::showFromFriend(const LLUUID& agent_id, BOOL online) -{ - LLFloaterAvatarInfo *floater = show(agent_id); - if (floater) - { - floater->mSuggestedOnlineStatus = online ? ONLINE_STATUS_YES : ONLINE_STATUS_NO; - } -} - - -// static -void LLFloaterAvatarInfo::showFromProfile(const LLUUID &avatar_id, LLRect rect) -{ - if (avatar_id.isNull()) - { - return; - } - - LLFloaterAvatarInfo *floater = LLFloaterAvatarInfo::getInstance(avatar_id); - if(!floater) - { - floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, avatar_id); - floater->translate(rect.mLeft - floater->getRect().mLeft + 16, - rect.mTop - floater->getRect().mTop - 16); - floater->mPanelAvatarp->setAvatarID(avatar_id, LLStringUtil::null, ONLINE_STATUS_NO); - } - floater->open(); -} - -void LLFloaterAvatarInfo::showProfileCallback(S32 option, void *userdata) -{ - if (option == 0) - { - showFromObject(gAgentID); - } -} - -void LLFloaterAvatarInfo::callbackLoadAvatarName(const LLUUID& id, const LLAvatarName& av_name) -{ - // Build a new title including the avatar name. - std::ostringstream title; - //title << first << " " << last << " - " << floater->getTitle(); - title << av_name.getCompleteName()<< " - " << getTitle(); - setTitle(title.str()); -} - -//// virtual -void LLFloaterAvatarInfo::draw() -{ - // skip LLPreview::draw() - LLFloater::draw(); -} - // virtual BOOL LLFloaterAvatarInfo::canClose() { return mPanelAvatarp && mPanelAvatarp->canClose(); } - -void LLFloaterAvatarInfo::loadAsset() -{ - if (mPanelAvatarp) { - mPanelAvatarp->setAvatarID(mAvatarID, LLStringUtil::null, mSuggestedOnlineStatus); - mAssetStatus = PREVIEW_ASSET_LOADING; - } -} - -LLPreview::EAssetStatus LLFloaterAvatarInfo::getAssetStatus() -{ - if (mPanelAvatarp && mPanelAvatarp->haveData()) - { - mAssetStatus = PREVIEW_ASSET_LOADED; - } - return mAssetStatus; -} diff --git a/indra/newview/llfloateravatarinfo.h b/indra/newview/llfloateravatarinfo.h index b9682b308..b95bd14d1 100644 --- a/indra/newview/llfloateravatarinfo.h +++ b/indra/newview/llfloateravatarinfo.h @@ -40,66 +40,24 @@ #define LL_LLFLOATERAVATARINFO_H #include "llfloater.h" -#include "llpreview.h" -#include "lluuid.h" -#include "llpanelavatar.h" #include "llinstancetracker.h" -class LLAvatarName; -class LLButton; -class LLCheckBoxCtrl; -class LLInventoryItem; -class LLLineEditor; -class LLMessageSystem; -class LLScrollListCtrl; -class LLTabContainer; -class LLTextBox; -class LLTextEditor; -class LLTextureCtrl; -class LLUICtrl; -class LLViewerTexture; -class LLViewerObject; +class LLPanelAvatar; class LLFloaterAvatarInfo -: public LLPreview, public LLInstanceTracker +: public LLFloater, public LLInstanceTracker { public: static void* createPanelAvatar(void* data); - virtual BOOL postBuild(); - - LLFloaterAvatarInfo(const std::string& name, const LLRect &rect, const LLUUID &avatar_id ); + LLFloaterAvatarInfo(const std::string& name, const LLUUID &avatar_id); /*virtual*/ ~LLFloaterAvatarInfo(); - - /*virtual*/ void draw(); - /*virtual*/ BOOL canClose(); - - /*virtual*/ void loadAsset(); - /*virtual*/ EAssetStatus getAssetStatus(); - - static LLFloaterAvatarInfo* show(const LLUUID& avatar_id); - // Core method, doesn't do anything funny with online status or - // tab selection. - - static void showFromObject(const LLUUID &avatar_id, std::string tab_name = std::string()); - - static void showFromDirectory(const LLUUID &avatar_id); - - static void showFromFriend(const LLUUID &agent_id, BOOL online); - - static void showFromProfile(const LLUUID &avatar_id, LLRect rect); - - static void showProfileCallback(S32 option, void *userdata); - void callbackLoadAvatarName(const LLUUID& agent_id, const LLAvatarName& av_name); void resetGroupList(); private: LLUUID mAvatarID; // for which avatar is this window? LLPanelAvatar* mPanelAvatarp; - EOnlineStatus mSuggestedOnlineStatus; }; -std::string getProfileURL(const std::string& agent_name); - #endif diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 8491aa192..c41e7f1db 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -25,21 +25,17 @@ #include "llwindow.h" #include "llscrolllistctrl.h" #include "llradiogroup.h" -#include "llviewercontrol.h" #include "llnotificationsutil.h" #include "llvoavatar.h" #include "llimview.h" -#include "llfloateravatarinfo.h" -#include "llregionflags.h" #include "llfloaterreporter.h" #include "llagent.h" #include "llagentcamera.h" +#include "llavataractions.h" #include "llfloaterregioninfo.h" #include "llviewerregion.h" #include "lltracker.h" -#include "llviewerstats.h" -#include "llerror.h" #include "llchat.h" #include "llfloaterchat.h" #include "llviewermessage.h" @@ -315,7 +311,7 @@ const LLAvatarListEntry::ACTIVITY_TYPE LLAvatarListEntry::getActivity() LLFloaterAvatarList::LLFloaterAvatarList() : LLFloater(std::string("radar")), mTracking(false), - mUpdate(true), + mUpdate("RadarUpdateEnabled"), mDirtyAvatarSorting(false), mUpdateRate(gSavedSettings.getU32("RadarUpdateRate") * 3 + 3), mAvatarList(NULL) @@ -415,12 +411,12 @@ BOOL LLFloaterAvatarList::postBuild() getChild("update_rate")->setSelectedIndex(gSavedSettings.getU32("RadarUpdateRate")); getChild("update_rate")->setCommitCallback(boost::bind(&LLFloaterAvatarList::onCommitUpdateRate, this)); - getChild("hide_mark")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); - getChild("hide_pos")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); - getChild("hide_alt")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); - getChild("hide_act")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); - getChild("hide_age")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); - getChild("hide_time")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnMarkHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnPositionHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnAltitudeHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnActivityHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnAgeHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnTimeHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); // Get a pointer to the scroll list from the interface mAvatarList = getChild("avatar_list"); @@ -438,7 +434,7 @@ BOOL LLFloaterAvatarList::postBuild() if(gHippoGridManager->getConnectedGrid()->isSecondLife()) childSetVisible("hide_client", false); else - getChild("hide_client")->setCommitCallback(boost::bind(&LLFloaterAvatarList::assessColumns, this)); + gSavedSettings.getControl("RadarColumnClientHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); return TRUE; } @@ -529,17 +525,11 @@ void LLFloaterAvatarList::updateAvatarList() //llinfos << "radar refresh: updating map" << llendl; // Check whether updates are enabled - LLCheckboxCtrl* check = getChild("update_enabled_cb"); - if (check && !check->getValue()) + if (!mUpdate) { - mUpdate = FALSE; refreshTracker(); return; } - else - { - mUpdate = TRUE; - } //moved to pipeline to prevent a crash //gPipeline.forAllVisibleDrawables(updateParticleActivity); @@ -888,7 +878,7 @@ void LLFloaterAvatarList::refreshAvatarList() name_color = ascent_estate_owner_color; } //without these dots, SL would suck. - else if(is_agent_friend(av_id)) + else if(LLAvatarActions::isFriend(av_id)) { static const LLCachedControl ascent_friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); name_color = ascent_friend_color; @@ -1148,22 +1138,12 @@ void LLFloaterAvatarList::onClickIM() if (ids.size() == 1) { // Single avatar - LLUUID agent_id = ids[0]; - - std::string avatar_name; - if (gCacheName->getFullName(agent_id, avatar_name)) - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(avatar_name,IM_NOTHING_SPECIAL,agent_id); - } + LLAvatarActions::startIM(ids[0]); } else { // Group IM - LLUUID session_id; - session_id.generate(); - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); + LLAvatarActions::startConference(ids); } } } @@ -1248,19 +1228,18 @@ LLAvatarListEntry * LLFloaterAvatarList::getAvatarEntry(LLUUID avatar) BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask) { - LLFloaterAvatarList* self = getInstance(); - LLScrollListItem* item = self->mAvatarList->getFirstSelected(); + LLScrollListItem* item = mAvatarList->getFirstSelected(); if(item) { LLUUID agent_id = item->getUUID(); if (( KEY_RETURN == key ) && (MASK_NONE == mask)) { - self->setFocusAvatar(agent_id); + setFocusAvatar(agent_id); return TRUE; } else if (( KEY_RETURN == key ) && (MASK_CONTROL == mask)) { - LLAvatarListEntry* entry = self->getAvatarEntry(agent_id); + const LLAvatarListEntry* entry = getAvatarEntry(agent_id); if (entry) { // llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl; @@ -1272,30 +1251,7 @@ BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask) if (( KEY_RETURN == key ) && (MASK_SHIFT == mask)) { - uuid_vec_t ids = self->mAvatarList->getSelectedIDs(); - if (ids.size() > 0) - { - if (ids.size() == 1) - { - // Single avatar - LLUUID agent_id = ids[0]; - - std::string avatar_name; - if (gCacheName->getFullName(agent_id, avatar_name)) - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(avatar_name,IM_NOTHING_SPECIAL,agent_id); - } - } - else - { - // Group IM - LLUUID session_id; - session_id.generate(); - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); - } - } + onClickIM(); } return LLPanel::handleKeyHere(key, mask); } @@ -1414,11 +1370,11 @@ void LLFloaterAvatarList::sendKeys() std::ostringstream ids; int num_ids = 0; - for (int i = 0; i < regionp->mMapAvatarIDs.count(); i++) + for (int i = 0; i < regionp->mMapAvatarIDs.count(); ++i) { const LLUUID &id = regionp->mMapAvatarIDs.get(i); - ids << "," << id.asString(); + ids << "," << id; ++num_ids; @@ -1560,7 +1516,7 @@ static void cmd_append_names(const LLAvatarListEntry* entry, std::string &str, s { if(!str.empty())str.append(sep);str.append(entry->getName()); } static void cmd_toggle_mark(LLAvatarListEntry* entry) { entry->toggleMark(); } static void cmd_ar(const LLAvatarListEntry* entry) { LLFloaterReporter::showFromObject(entry->getID()); } -static void cmd_profile(const LLAvatarListEntry* entry) { LLFloaterAvatarInfo::showFromDirectory(entry->getID()); } +static void cmd_profile(const LLAvatarListEntry* entry) { LLAvatarActions::showProfile(entry->getID()); } static void cmd_teleport(const LLAvatarListEntry* entry) { gAgent.teleportViaLocation(entry->getPosition()); } static void cmd_freeze(const LLAvatarListEntry* entry) { send_freeze(entry->getID(), true); } static void cmd_unfreeze(const LLAvatarListEntry* entry) { send_freeze(entry->getID(), false); } diff --git a/indra/newview/llfloateravatarlist.h b/indra/newview/llfloateravatarlist.h index 3bcf4ea67..2ad3de090 100644 --- a/indra/newview/llfloateravatarlist.h +++ b/indra/newview/llfloateravatarlist.h @@ -354,7 +354,7 @@ private: /** * @brief TRUE when Updating */ - bool mUpdate; + const LLCachedControl mUpdate; /** * @brief Update rate (if min frames per update) diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 04042c864..a9e6bf4b6 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -92,8 +92,8 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker() : BOOL LLFloaterAvatarPicker::postBuild() { - childSetKeystrokeCallback("Edit", &LLFloaterAvatarPicker::editKeystroke, (void*)this); - childSetKeystrokeCallback("EditUUID", &LLFloaterAvatarPicker::editKeystroke, (void*)this); + getChild("Edit")->setKeystrokeCallback(boost::bind(&LLFloaterAvatarPicker::editKeystroke,this,_1)); + getChild("EditUUID")->setKeystrokeCallback(boost::bind(&LLFloaterAvatarPicker::editKeystroke, this,_1)); childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this)); getChildView("Find")->setEnabled(FALSE); @@ -557,7 +557,10 @@ BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, std::string avatar_name = selection->getColumn(0)->getValue().asString(); if (dest_agent_id.notNull() && dest_agent_id != gAgentID) { - if (drop) +// if (drop) +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (drop) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStartIM(dest_agent_id)) ) ) +// [/RLVa:KB] { // Start up IM before give the item session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id); @@ -716,14 +719,12 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& search_results->setFocus(TRUE); } -//static -void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data) +void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller) { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)user_data; if(caller->getName() == "Edit") - self->getChildView("Find")->setEnabled(caller->getText().size() >= 3); + getChildView("Find")->setEnabled(caller->getText().size() >= 3); else - self->childSetEnabled("Select", caller->getValue().asUUID().notNull()); + childSetEnabled("Select", caller->getValue().asUUID().notNull()); } // virtual diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 7e38611f1..799d28790 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -65,7 +65,7 @@ public: void openFriendsTab(); private: - static void editKeystroke(class LLLineEditor* caller, void* user_data); + void editKeystroke(class LLLineEditor* caller); void onBtnFind(); void onBtnSelect(); diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 7f598ac5b..0314b7fff 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -41,7 +41,6 @@ #include "llfloaterbuy.h" #include "llagent.h" // for agent id -#include "llalertdialog.h" #include "llinventorymodel.h" // for gInventory #include "llinventorydefines.h" #include "llinventoryicon.h" diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index ced2258fc..a5eb65b01 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -265,7 +265,7 @@ BOOL LLFloaterBvhPreview::postBuild() mPlayButton = getChild( "play_btn"); if (!mPlayButton) { - mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0)); + mPlayButton = new LLButton("play_btn"); } mPlayButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPlay,this)); @@ -280,7 +280,7 @@ BOOL LLFloaterBvhPreview::postBuild() mStopButton = getChild( "stop_btn"); if (!mStopButton) { - mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0)); + mStopButton = new LLButton("stop_btn"); } mStopButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnStop, this)); @@ -748,16 +748,15 @@ void LLFloaterBvhPreview::onMouseCaptureLost() //----------------------------------------------------------------------------- // onBtnPlay() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onBtnPlay(void* user_data) +void LLFloaterBvhPreview::onBtnPlay() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)user_data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; - if (previewp->mMotionID.notNull()) + if (mMotionID.notNull()) { LLVOAvatar* avatarp; - if (previewp->mInWorld) + if (mInWorld) { if (!gAgentAvatarp) { @@ -767,27 +766,27 @@ void LLFloaterBvhPreview::onBtnPlay(void* user_data) } else { - if (!previewp->mAnimPreview) + if (!mAnimPreview) { return; } - avatarp = previewp->mAnimPreview->getDummyAvatar(); + avatarp = mAnimPreview->getDummyAvatar(); } - if(!avatarp->isMotionActive(previewp->mMotionID)) + if(!avatarp->isMotionActive(mMotionID)) { - previewp->resetMotion(); - previewp->mPauseRequest = NULL; + resetMotion(); + mPauseRequest = NULL; } else { if (avatarp->areAnimationsPaused()) { - previewp->mPauseRequest = NULL; + mPauseRequest = NULL; } else { - previewp->mPauseRequest = avatarp->requestPause(); + mPauseRequest = avatarp->requestPause(); } } } @@ -796,16 +795,15 @@ void LLFloaterBvhPreview::onBtnPlay(void* user_data) //----------------------------------------------------------------------------- // onBtnStop() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onBtnStop(void* user_data) +void LLFloaterBvhPreview::onBtnStop() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)user_data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; - if (previewp->mMotionID.notNull()) + if (mMotionID.notNull()) { LLVOAvatar* avatarp; - if (previewp->mInWorld) + if (mInWorld) { if (!gAgentAvatarp) { @@ -815,14 +813,14 @@ void LLFloaterBvhPreview::onBtnStop(void* user_data) } else { - if (!previewp->mAnimPreview) + if (!mAnimPreview) { return; } - avatarp = previewp->mAnimPreview->getDummyAvatar(); + avatarp = mAnimPreview->getDummyAvatar(); } - previewp->resetMotion(); - previewp->mPauseRequest = avatarp->requestPause(); + resetMotion(); + mPauseRequest = avatarp->requestPause(); } } diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index 6a6adaa30..78b9db6a0 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -90,8 +90,8 @@ public: void refresh(); - static void onBtnPlay(void*); - static void onBtnStop(void*); + void onBtnPlay(); + void onBtnStop(); static void setUploadAmount(S32 amount) { sUploadAmount = amount; } static void onSliderMove(LLUICtrl*, void*); static void onCommitBaseAnim(LLUICtrl*, void*); diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index c61d05f74..712965961 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -559,8 +559,8 @@ const S32 HEADER_HEIGHT = 3 * (LINE_HEIGHT + LLFLOATER_VPAD) + (2 * LLPANEL_BORD void LLFloaterCustomize::initScrollingPanelList() { - LLScrollableContainerView* scroll_container = - getChild("panel_container"); + LLScrollContainer* scroll_container = + getChild("panel_container"); // LLScrollingPanelList's do not import correctly // mScrollingPanelList = LLUICtrlFactory::getScrollingPanelList(this, "panel_list"); mScrollingPanelList = new LLScrollingPanelList(std::string("panel_list"), LLRect()); diff --git a/indra/newview/llfloatercustomize.h b/indra/newview/llfloatercustomize.h index 39bc8ec67..34eee55fe 100644 --- a/indra/newview/llfloatercustomize.h +++ b/indra/newview/llfloatercustomize.h @@ -54,7 +54,7 @@ class LLJoint; class LLLineEditor; class LLMakeOutfitDialog; class LLRadioGroup; -class LLScrollableContainerView; +class LLScrollContainer; class LLScrollingPanelList; class LLTabContainer; class LLTextBox; @@ -142,7 +142,7 @@ private: LLWearableType::EType mCurrentWearableType; LLScrollingPanelList* mScrollingPanelList; - LLScrollableContainerView* mScrollContainer; + LLScrollContainer* mScrollContainer; LLPointer mResetParams; LLInventoryObserver* mInventoryObserver; diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 0bd358d4c..552406479 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -389,9 +389,7 @@ void* LLFloaterDirectory::createEventDetail(void* userdata) void* LLFloaterDirectory::createGroupDetail(void* userdata) { LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; - self->mPanelGroupp = new LLPanelGroup("panel_group.xml", - "PanelGroup", - gAgent.getGroupID()); + self->mPanelGroupp = new LLPanelGroup(gAgent.getGroupID()); self->mPanelGroupp->setAllowEdit(FALSE || gAgent.isGodlike()); // Gods can always edit panels self->mPanelGroupp->setVisible(FALSE); return self->mPanelGroupp; diff --git a/indra/newview/llfloatereditui.cpp b/indra/newview/llfloatereditui.cpp index fbef26b18..0bc8fcc15 100644 --- a/indra/newview/llfloatereditui.cpp +++ b/indra/newview/llfloatereditui.cpp @@ -44,7 +44,7 @@ LLFloaterEditUI* LLFloaterEditUI::sInstance = NULL; -void LLFloaterEditUI::navigateHierarchyButtonPressed(void* data) +void LLFloaterEditUI::navigateHierarchyButtonPressed(S32 i) { LLView* view = LLView::sEditingUIView; if( !view ) return; @@ -62,7 +62,7 @@ void LLFloaterEditUI::navigateHierarchyButtonPressed(void* data) for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){ if((*itor)==view)break; } - switch((intptr_t)data) + switch(i) { case 0 ://up view = view->getParent(); @@ -142,10 +142,7 @@ LLFloaterEditUI::LLFloaterEditUI() LLStringUtil::null, NULL, 254, - onCommitLabel, - NULL, - NULL, - this); + boost::bind(&LLFloaterEditUI::onCommitLabel,_1)); addChild(line); mLabelLine = line; @@ -154,8 +151,7 @@ LLFloaterEditUI::LLFloaterEditUI() spin = new LLSpinCtrl(std::string("height_spin"), LLRect(x, y+20, x+100, y), std::string("Height:"), LLFontGL::getFontSansSerifSmall(), - onCommitHeight, - this, + boost::bind(&LLFloaterEditUI::onCommitHeight,_1), 0.f, 2.f, 1000.f, @@ -168,8 +164,7 @@ LLFloaterEditUI::LLFloaterEditUI() spin = new LLSpinCtrl(std::string("width_spin"), LLRect(x, y+20, x+100, y), std::string("Width:"), LLFontGL::getFontSansSerifSmall(), - onCommitWidth, - this, + boost::bind(&LLFloaterEditUI::onCommitHeight,_1), 0.f, 2.f, 1000.f, @@ -190,28 +185,22 @@ LLFloaterEditUI::LLFloaterEditUI() y -= VPAD + 20; x += 40; - button = new LLButton(std::string("up"),LLRect(x, y+16, x+32, y)); + button = new LLButton(std::string("up"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,0)); addChild(button); x -= 40; y -= VPAD + 20; - button = new LLButton(std::string("<<"),LLRect(x, y+16, x+32, y)); + button = new LLButton(std::string("<<"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,2)); addChild(button); x += 40; - button = new LLButton(std::string("rfrsh"),LLRect(x, y+16, x+32, y)); + button = new LLButton(std::string("rfrsh"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,4)); addChild(button); x += 40; - button = new LLButton(std::string(">>"),LLRect(x, y+16, x+32, y)); + button = new LLButton(std::string(">>"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,3)); addChild(button); x -= 40; y -= VPAD + 20; - button = new LLButton(std::string("dn"),LLRect(x, y+16, x+32, y)); + button = new LLButton(std::string("dn"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,1)); addChild(button); - - childSetAction("up",navigateHierarchyButtonPressed,(void*)0); - childSetAction("dn",navigateHierarchyButtonPressed,(void*)1); - childSetAction("<<",navigateHierarchyButtonPressed,(void*)2); - childSetAction(">>",navigateHierarchyButtonPressed,(void*)3); - childSetAction("rfrsh",navigateHierarchyButtonPressed,(void*)4); sInstance = this; } @@ -380,7 +369,7 @@ BOOL LLFloaterEditUI::processKeystroke(KEY key, MASK mask) } // static -void LLFloaterEditUI::onCommitLabel(LLUICtrl* ctrl, void* data) +void LLFloaterEditUI::onCommitLabel(LLUICtrl* ctrl) { LLView* view = LLView::sEditingUIView; if (!view) return; @@ -396,7 +385,7 @@ void LLFloaterEditUI::onCommitLabel(LLUICtrl* ctrl, void* data) } // static -void LLFloaterEditUI::onCommitHeight(LLUICtrl* ctrl, void* data) +void LLFloaterEditUI::onCommitHeight(LLUICtrl* ctrl) { LLView* view = LLView::sEditingUIView; if (!view) return; @@ -410,7 +399,7 @@ void LLFloaterEditUI::onCommitHeight(LLUICtrl* ctrl, void* data) } // static -void LLFloaterEditUI::onCommitWidth(LLUICtrl* ctrl, void* data) +void LLFloaterEditUI::onCommitWidth(LLUICtrl* ctrl) { LLView* view = LLView::sEditingUIView; if (!view) return; diff --git a/indra/newview/llfloatereditui.h b/indra/newview/llfloatereditui.h index b69a1f1e6..6277543dd 100644 --- a/indra/newview/llfloatereditui.h +++ b/indra/newview/llfloatereditui.h @@ -51,14 +51,14 @@ public: void refreshView(LLView* view); void refreshButton(LLView* view); - static void navigateHierarchyButtonPressed(void* data); + static void navigateHierarchyButtonPressed(S32 i); static void show(void* unused = NULL); static BOOL processKeystroke(KEY key, MASK mask); - static void onCommitLabel(LLUICtrl* ctrl, void* data); - static void onCommitHeight(LLUICtrl* ctrl, void* data); - static void onCommitWidth(LLUICtrl* ctrl, void* data); + static void onCommitLabel(LLUICtrl* ctrl); + static void onCommitHeight(LLUICtrl* ctrl); + static void onCommitWidth(LLUICtrl* ctrl); protected: LLView* mLastView; diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index e0ac0a06e..e6017e50e 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -37,45 +37,31 @@ #include "llfloaterfriends.h" -#include - -#include "lldir.h" #include "llagent.h" -#include "llappviewer.h" // for gLastVersionChannel - +#include "llavataractions.h" #include "llavatarnamecache.h" - -#include "llfloateravatarpicker.h" -#include "llviewerwindow.h" #include "llbutton.h" -#include "llfloateravatarinfo.h" -#include "llinventorymodel.h" +#include "lldir.h" +#include "lleventtimer.h" +#include "llfiltereditor.h" +#include "llfloateravatarpicker.h" #include "llnamelistctrl.h" #include "llnotificationsutil.h" -#include "llresmgr.h" -#include "llimview.h" -#include "lluictrlfactory.h" -#include "llmenucommands.h" -#include "llviewercontrol.h" -#include "llviewermessage.h" -#include "lleventtimer.h" +#include "llsdserialize.h" #include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewerwindow.h" #include "llvoiceclient.h" -#include "llsdserialize.h" #include "statemachine/aifilepicker.h" -#include "llviewermenufile.h" -#include "llviewermenu.h" -#include "llviewernetwork.h" #include "hippogridmanager.h" -#include "llchat.h" -#include "llfloaterchat.h" - // stuff for Contact groups //#include "ascentfloatercontactgroups.h" +//#include "llchat.h" +//#include "llfloaterchat.h" #define DEFAULT_PERIOD 5.0 #define RIGHTS_CHANGE_TIMEOUT 5.0 @@ -353,14 +339,9 @@ void LLPanelFriends::filterContacts(const std::string& search_name) mLastContactSearch = search_name; } -//static -void LLPanelFriends::onContactSearchEdit(const std::string& search_string, void* user_data) +void LLPanelFriends::onContactFilterEdit(const std::string& search_string) { - LLPanelFriends* panelp = (LLPanelFriends*)user_data; - if (panelp) - { - panelp->filterContacts(search_string); - } + filterContacts(search_string); } /*void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data) @@ -387,10 +368,10 @@ BOOL LLPanelFriends::postBuild() // // Contact search and group system. // 09/05/2010 - Charley Levenque - LLSearchEditor* contact = getChild("buddy_search_lineedit"); + LLFilterEditor* contact = getChild("buddy_search_lineedit"); if (contact) { - contact->setSearchCallback(&onContactSearchEdit, this); + contact->setCommitCallback(boost::bind(&LLPanelFriends::onContactFilterEdit, this, _2)); } getChild("s_num")->setValue("0"); @@ -403,10 +384,10 @@ BOOL LLPanelFriends::postBuild() //childSetAction("assign_btn", onClickAssign, this); childSetAction("expand_collapse_btn", onClickExpand, this); childSetAction("profile_btn", onClickProfile, this); - childSetAction("offer_teleport_btn", onClickOfferTeleport, this); + getChild("offer_teleport_btn")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); childSetAction("pay_btn", onClickPay, this); childSetAction("add_btn", onClickAddFriend, this); - childSetAction("remove_btn", onClickRemove, this); + getChild("remove_btn")->setCommitCallback(boost::bind(LLAvatarActions::removeFriendsDialog, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); //childSetAction("export_btn", onClickExport, this); Making Dummy View -HgB //childSetAction("import_btn", onClickImport, this); Making Dummy View -HgB @@ -689,7 +670,6 @@ BOOL LLPanelFriends::refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_b BOOL LLPanelFriends::refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies) { - std::vector items = mFriendsList->getAllData(); std::sort(items.begin(), items.end(), SortFriendsByID()); @@ -788,10 +768,7 @@ void LLPanelFriends::onClickProfile(void* user_data) const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); if(!ids.empty()) { - LLUUID agent_id = ids[0]; - BOOL online; - online = LLAvatarTracker::instance().isBuddyOnline(agent_id); - LLFloaterAvatarInfo::showFromFriend(agent_id, online); + LLAvatarActions::showProfile(ids[0]); } } @@ -855,103 +832,24 @@ void LLPanelFriends::onClickIM(void* user_data) const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); if(!ids.empty()) { - static LLCachedControl tear_off("OtherChatsTornOff"); - if(!tear_off) gIMMgr->setFloaterOpen(TRUE); if(ids.size() == 1) { - LLUUID agent_id = ids[0]; - const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id); - std::string fullname; - if(info && gCacheName->getFullName(agent_id, fullname)) - { - gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); - } + LLAvatarActions::startIM(ids[0]); } else { - gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); + LLAvatarActions::startConference(ids); } - make_ui_sound("UISndStartIM"); } } -// static -void LLPanelFriends::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) -{ - LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); - send_improved_im(target_id, - target_name, - message, - IM_ONLINE, - IM_FRIENDSHIP_OFFERED, - calling_card_folder_id); -} - -// static -bool LLPanelFriends::callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) - { - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - response["message"].asString()); - } - return false; -} - -bool LLPanelFriends::callbackAddFriend(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) - { - // Servers older than 1.25 require the text of the message to be the - // calling card folder ID for the offering user. JC - LLUUID calling_card_folder_id = - gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); - std::string message = calling_card_folder_id.asString(); - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - message); - } - return false; -} - // static void LLPanelFriends::onPickAvatar( const uuid_vec_t& ids, const std::vector& names ) { if (names.empty()) return; if (ids.empty()) return; - requestFriendshipDialog(ids[0], names[0].getCompleteName()); -} - -// static -void LLPanelFriends::requestFriendshipDialog(const LLUUID& id, - const std::string& name) -{ - if(id == gAgentID) - { - LLNotificationsUtil::add("AddSelfFriend"); - return; - } - - LLSD args; - args["NAME"] = name; - LLSD payload; - payload["id"] = id; - payload["name"] = name; - // Look for server versions like: Second Life Server 1.24.4.95600 - if (gLastVersionChannel.find(" 1.24.") != std::string::npos) - { - // Old and busted server version, doesn't support friend - // requests with messages. - LLNotificationsUtil::add("AddFriend", args, payload, &callbackAddFriend); - } - else - { - LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); - } + LLAvatarActions::requestFriendshipDialog(ids[0], names[0].getCompleteName()); } // static @@ -966,44 +864,6 @@ void LLPanelFriends::onClickAddFriend(void* user_data) } } -// static -void LLPanelFriends::onClickRemove(void* user_data) -{ - LLPanelFriends* panelp = (LLPanelFriends*)user_data; - - //llinfos << "LLPanelFriends::onClickRemove()" << llendl; - const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); - LLSD args; - if(!ids.empty()) - { - std::string msgType = "RemoveFromFriends"; - if(ids.size() == 1) - { - LLUUID agent_id = ids[0]; - std::string fullname; - if (LLAvatarNameCache::getPNSName(agent_id, fullname)) - args["NAME"] = fullname; - } - else - { - msgType = "RemoveMultipleFromFriends"; - } - LLSD payload; - - for (uuid_vec_t::const_iterator it = ids.begin(); - it != ids.end(); - ++it) - { - payload["ids"].append(*it); - } - - LLNotifications::instance().add(msgType, - args, - payload, - &handleRemove); - } -} - void LLPanelFriends::onClickExport(void* user_data) { std::string agn; @@ -1054,7 +914,6 @@ void LLPanelFriends::onClickExport_continued(void* user_data, AIFilePicker* file export_file.close(); } -bool LLPanelFriends::merging; void LLPanelFriends::onClickImport(void* user_data) { @@ -1095,6 +954,7 @@ void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker LLSD importstatellsd; LLSDSerialize::fromXMLDocument(importstatellsd, stateload); + static bool merging; //LLMessageSystem* msg = gMessageSystem; LLSD newdata; @@ -1112,10 +972,10 @@ void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what we've already requested from another list import and have not got a reply yet std::string agent_name = content["name"]; - if(!is_agent_friend(agent_id))//dont need to request what we have + if(!LLAvatarActions::isFriend(agent_id))//dont need to request what we have { if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE - requestFriendship(agent_id, agent_name, "Imported from "+file); + LLAvatarActions::requestFriendship(agent_id, agent_name, "Imported from "+file); newdata[iter->first] = iter->second; }else { @@ -1159,7 +1019,7 @@ void LLPanelFriends::FriendImportState(LLUUID id, bool accepted) if(can_map)rights |= LLRelationship::GRANT_MAP_LOCATION; if(can_mod)rights |= LLRelationship::GRANT_MODIFY_OBJECTS; if(see_online)rights |= LLRelationship::GRANT_ONLINE_STATUS; - if(is_agent_friend(id))//is this legit shit yo + if(LLAvatarActions::isFriend(id))//is this legit shit yo { const LLRelationship* friend_status = LLAvatarTracker::instance().getBuddyInfo(id); if(friend_status) @@ -1189,18 +1049,6 @@ void LLPanelFriends::FriendImportState(LLUUID id, bool accepted) } } -// static -void LLPanelFriends::onClickOfferTeleport(void* user_data) -{ - LLPanelFriends* panelp = (LLPanelFriends*)user_data; - - const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); - if(!ids.empty()) - { - handle_lure(ids); - } -} - // static void LLPanelFriends::onClickPay(void* user_data) { @@ -1209,58 +1057,52 @@ void LLPanelFriends::onClickPay(void* user_data) const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); if(!ids.empty()) { - handle_pay_by_id(ids[0]); + LLAvatarActions::pay(ids[0]); } } -void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command) +void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke command) { - if (ids.empty()) return; + if (rights.empty()) return; - LLSD args; - if(!ids.empty()) + // for single friend, show their name + if (rights.size() == 1) { - rights_map_t* rights = new rights_map_t(ids); + LLSD args; + std::string fullname; + if (LLAvatarNameCache::getPNSName(rights.begin()->first, fullname)) + args["NAME"] = fullname; - // for single friend, show their name - if(ids.size() == 1) + if (command == GRANT) { - LLUUID agent_id = ids.begin()->first; - std::string fullname; - if (LLAvatarNameCache::getPNSName(agent_id, fullname)) - args["NAME"] = fullname; - - if (command == GRANT) - { - LLNotificationsUtil::add("GrantModifyRights", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } - else - { - LLNotificationsUtil::add("RevokeModifyRights", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } + LLNotificationsUtil::add("GrantModifyRights", + args, + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); } else { - if (command == GRANT) - { - LLNotificationsUtil::add("GrantModifyRightsMultiple", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } - else - { - LLNotificationsUtil::add("RevokeModifyRightsMultiple", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } + LLNotificationsUtil::add("RevokeModifyRights", + args, + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); + } + } + else + { + if (command == GRANT) + { + LLNotificationsUtil::add("GrantModifyRightsMultiple", + LLSD(), + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); + } + else + { + LLNotificationsUtil::add("RevokeModifyRightsMultiple", + LLSD(), + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); } } } @@ -1407,42 +1249,3 @@ void LLPanelFriends::sendRightsGrant(rights_map_t& ids) mNumRightsChanged = ids.size(); gAgent.sendReliableMessage(); } - - - -// static -bool LLPanelFriends::handleRemove(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - const LLSD& ids = notification["payload"]["ids"]; - for(LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr) - { - LLUUID id = itr->asUUID(); - const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id); - if(ip) - { - switch(option) - { - case 0: // YES - if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)) - { - LLAvatarTracker::instance().empower(id, FALSE); - LLAvatarTracker::instance().notifyObservers(); - } - LLAvatarTracker::instance().terminateBuddy(id); - LLAvatarTracker::instance().notifyObservers(); - gInventory.addChangedMask(LLInventoryObserver::LABEL | LLInventoryObserver::CALLING_CARD, LLUUID::null); - gInventory.notifyObservers(); - break; - - case 1: // NO - default: - llinfos << "No removal performed." << llendl; - break; - } - } - - } - return false; -} diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index 94bfe17b0..c82db7886 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -76,15 +76,6 @@ public: virtual BOOL postBuild(); - // Show a dialog explaining what friendship entails, then request - // friendship. JC - static void requestFriendshipDialog(const LLUUID& target_id, - const std::string& target_name); - - // Just request friendship, no dialog. - static void requestFriendship(const LLUUID& target_id, - const std::string& target_name, const std::string& message); - void populateContactGroupSelect(); private: @@ -130,17 +121,14 @@ private: // callback methods static void onSelectName(LLUICtrl* ctrl, void* user_data); static void onChangeContactGroup(LLUICtrl* ctrl, void* user_data); - static bool callbackAddFriend(const LLSD& notification, const LLSD& response); - static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static void onPickAvatar(const uuid_vec_t& ids, const std::vector& names ); - static void onContactSearchEdit(const std::string& search_string, void* user_data); + void onContactFilterEdit(const std::string& search_string); static void onClickIM(void* user_data); static void onClickAssign(void* user_data); static void onClickExpand(void* user_data); static void updateColumns(void* user_data); static void onClickProfile(void* user_data); static void onClickAddFriend(void* user_data); - static void onClickRemove(void* user_data); static void onClickExport(void* user_data); static void onClickExport_continued(void* user_data, AIFilePicker* filepicker); static void onClickImport(void* user_data); @@ -148,12 +136,9 @@ private: public: static void FriendImportState(LLUUID id, bool accepted); private: - static void onClickOfferTeleport(void* user_data); static void onClickPay(void* user_data); static void onClickModifyStatus(LLUICtrl* ctrl, void* user_data); - - static bool handleRemove(const LLSD& notification, const LLSD& response); bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights); private: @@ -168,7 +153,6 @@ private: S32 mNumRightsChanged; S32 mNumOnline; std::string mLastContactSearch; - static bool merging; }; diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index f7b27c18b..4a146a4e2 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -186,6 +186,12 @@ void LLFloaterGesture::toggleVisibility() } } +// static +bool LLFloaterGesture::instanceVisible() +{ + return sInstance && sInstance->getVisible(); +} + // static void LLFloaterGesture::refreshAll() { diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h index ba4da14f2..0ded59467 100644 --- a/indra/newview/llfloatergesture.h +++ b/indra/newview/llfloatergesture.h @@ -41,7 +41,7 @@ #include "lldarray.h" -class LLScrollableContainerView; +class LLScrollContainer; class LLView; class LLButton; class LLLineEditor; @@ -64,6 +64,7 @@ public: static void show(); static void toggleVisibility(); static void refreshAll(); + static bool instanceVisible(); protected: // Reads from the gesture manager's list of active gestures diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 873108ee0..d4d21f352 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -40,7 +40,6 @@ #include "message.h" #include "llagent.h" -#include "llalertdialog.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" @@ -448,9 +447,10 @@ LLPanelRegionTools::LLPanelRegionTools(const std::string& title) BOOL LLPanelRegionTools::postBuild() { - getChild("region name")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetKeystrokeCallback("region name", onChangeSimName, this); - childSetPrevalidate("region name", &LLLineEditor::prevalidatePrintableNotPipe); + LLLineEditor* region_name = getChild("region name"); + region_name->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + region_name->setKeystrokeCallback(boost::bind(&LLPanelRegionTools::onChangeSimName, this)); + region_name->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); getChild("check prelude")->setCommitCallback(boost::bind(&LLPanelRegionTools:: onChangePrelude, this)); getChild("check fixed sun")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); @@ -470,36 +470,42 @@ BOOL LLPanelRegionTools::postBuild() childSetAction("Revert Terrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this)); childSetAction("Swap Terrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this)); - getChild("estate")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetPrevalidate("estate", &LLLineEditor::prevalidatePositiveS32); + LLLineEditor* estate = getChild("estate name"); + estate->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + estate->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - getChild("parentestate")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetPrevalidate("parentestate", &LLLineEditor::prevalidatePositiveS32); - childDisable("parentestate"); + LLLineEditor* parentestate = getChild("parentestate"); + parentestate->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + parentestate->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + parentestate->setEnabled(false); - getChild("gridposx")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetPrevalidate("gridposx", &LLLineEditor::prevalidatePositiveS32); - childDisable("gridposx"); + LLLineEditor* gridposx = getChild("gridposx"); + gridposx->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + gridposx->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + gridposx->setEnabled(false); - getChild("gridposy")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetPrevalidate("gridposy", &LLLineEditor::prevalidatePositiveS32); - childDisable("gridposy"); + LLLineEditor* gridposy = getChild("gridposy"); + gridposy->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + gridposy->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + gridposy->setEnabled(false); - getChild("redirectx")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetPrevalidate("redirectx", &LLLineEditor::prevalidatePositiveS32); + LLLineEditor* redirectx = getChild("redirectx"); + redirectx->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + redirectx->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - getChild("redirecty")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetPrevalidate("redirecty", &LLLineEditor::prevalidatePositiveS32); + LLLineEditor* redirecty = getChild("redirecty"); + redirecty->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + redirecty->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); getChild("billable factor")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild("land cost")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - childSetAction("Refresh", boost::bind(&LLPanelRegionTools::onRefresh, this)); - childSetAction("Apply", boost::bind(&LLPanelRegionTools::onApplyChanges, this)); + getChild("Refresh")->setClickedCallback(boost::bind(&LLPanelRegionTools::onRefresh, this)); + getChild("Apply")->setClickedCallback(boost::bind(&LLPanelRegionTools::onApplyChanges, this)); - childSetAction("Select Region", boost::bind(&LLPanelRegionTools::onSelectRegion, this)); - childSetAction("Autosave now", boost::bind(onSaveState, this)); + getChild("Select Region")->setClickedCallback(boost::bind(&LLPanelRegionTools::onSelectRegion, this)); + getChild("Autosave now")->setClickedCallback(boost::bind(&LLPanelRegionTools::onSaveState,(void*)NULL)); return TRUE; } @@ -586,7 +592,8 @@ void LLPanelRegionTools::enableAllWidgets() getChildView("Autosave now")->setEnabled(TRUE); } -void LLPanelRegionTools::onSaveState(void* userdata) +//static +void LLPanelRegionTools::onSaveState(void*) { if (gAgent.isGodlike()) { @@ -820,13 +827,11 @@ void LLPanelRegionTools::onChangePrelude() onChangeAnything(); } -// static -void LLPanelRegionTools::onChangeSimName(LLLineEditor* caller, void* userdata ) +void LLPanelRegionTools::onChangeSimName() { - if (userdata && gAgent.isGodlike()) + if ( gAgent.isGodlike()) { - LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata; - region_tools->getChildView("Apply")->setEnabled(TRUE); + getChildView("Apply")->setEnabled(TRUE); } } diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index 6e6d271b7..ecfdd98b4 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -135,8 +135,8 @@ public: /*virtual*/ void refresh(); - static void onSaveState(void* userdata); - static void onChangeSimName(LLLineEditor* caller, void* userdata); + static void onSaveState(void*); + void onChangeSimName(); void onChangeAnything(); void onChangePrelude(); diff --git a/indra/newview/llfloatergroupinfo.cpp b/indra/newview/llfloatergroupinfo.cpp index 67e2ebe05..cbe1636ea 100644 --- a/indra/newview/llfloatergroupinfo.cpp +++ b/indra/newview/llfloatergroupinfo.cpp @@ -36,96 +36,30 @@ #include "llfloatergroupinfo.h" -#include "llagent.h" -#include "llcommandhandler.h" -#include "llfloaterchatterbox.h" -#include "llpanelgroup.h" -#include "llviewermessage.h" // for inventory_offer_callback -//#include "llviewerwindow.h" -#include "llnotifications.h" - #include "llcachename.h" +#include "llpanelgroup.h" const char FLOATER_TITLE[] = "Group Information"; -const LLRect FGI_RECT(0, 530, 420, 0); - -// -// Globals -// -std::map LLFloaterGroupInfo::sInstances; - -class LLGroupHandler : public LLCommandHandler -{ -public: - // requires trusted browser to trigger - LLGroupHandler() : LLCommandHandler("group", true) { } - bool handle(const LLSD& tokens, const LLSD& query_map, - LLMediaCtrl* web) - { - if (tokens.size() < 1) - { - return false; - } - - if (tokens[0].asString() == "create") - { - LLFloaterGroupInfo::showCreateGroup(NULL); - return true; - } - - if (tokens.size() < 2) - { - return false; - } - - if (tokens[0].asString() == "list") - { - if (tokens[1].asString() == "show") - { - // CP_TODO: get the value we pass in via the XUI name - // of the tab instead of using a literal like this - LLFloaterMyFriends::showInstance( 1 ); - - return true; - } - return false; - } - - LLUUID group_id; - if (!group_id.set(tokens[0], FALSE)) - { - return false; - } - - if (tokens[1].asString() == "about") - { - LLFloaterGroupInfo::showFromUUID(group_id); - return true; - } - return false; - } -}; -LLGroupHandler gGroupHandler; //----------------------------------------------------------------------------- // Implementation //----------------------------------------------------------------------------- -LLFloaterGroupInfo::LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id, const std::string& tab_name) -: LLFloater(name, rect, title), - mGroupID( group_id ) +LLFloaterGroupInfo::LLFloaterGroupInfo(const LLUUID& group_id) +: LLFloater(FLOATER_TITLE, LLRect(0, 530, 420, 0), FLOATER_TITLE), LLInstanceTracker(group_id) { // Construct the filename of the group panel xml definition file. - mPanelGroupp = new LLPanelGroup("panel_group.xml", - "PanelGroup", - group_id, - tab_name); + mPanelGroupp = new LLPanelGroup(group_id); addChild(mPanelGroupp); + if (group_id.notNull()) + { + // Look up the group name. The callback will insert it into the title. + gCacheName->get(group_id, true, boost::bind(&LLFloaterGroupInfo::callbackLoadGroupName, this, _2)); + } } // virtual LLFloaterGroupInfo::~LLFloaterGroupInfo() { - sInstances.erase(mGroupID); } BOOL LLFloaterGroupInfo::canClose() @@ -143,125 +77,11 @@ void LLFloaterGroupInfo::selectTabByName(std::string tab_name) mPanelGroupp->selectTab(tab_name); } -// static -void LLFloaterGroupInfo::showMyGroupInfo(void *) +void LLFloaterGroupInfo::callbackLoadGroupName(const std::string& full_name) { - showFromUUID( gAgent.getGroupID() ); + // Build a new title including the group name. + std::ostringstream title; + title << full_name << " - " << FLOATER_TITLE; + setTitle(title.str()); } -// static -void LLFloaterGroupInfo::showCreateGroup(void *) -{ - showFromUUID(LLUUID::null, "general_tab"); -} - -// static -void LLFloaterGroupInfo::closeGroup(const LLUUID& group_id) -{ - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (fgi) - { - if (fgi->mPanelGroupp) - { - fgi->mPanelGroupp->close(); - } - } -} - -// static -void LLFloaterGroupInfo::closeCreateGroup() -{ - closeGroup(LLUUID::null); -} - -// static -void LLFloaterGroupInfo::refreshGroup(const LLUUID& group_id) -{ - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (fgi) - { - if (fgi->mPanelGroupp) - { - fgi->mPanelGroupp->refreshData(); - } - } -} - -// static -void LLFloaterGroupInfo::callbackLoadGroupName(const LLUUID& id, const std::string& full_name, bool is_group) -{ - LLFloaterGroupInfo *fgi = get_if_there(sInstances, id, (LLFloaterGroupInfo*)NULL); - - if (fgi) - { - // Build a new title including the group name. - std::ostringstream title; - title << full_name << " - " << FLOATER_TITLE; - fgi->setTitle(title.str()); - } -} - -// static -void LLFloaterGroupInfo::showFromUUID(const LLUUID& group_id, - const std::string& tab_name) -{ - // If we don't have a floater for this group, create one. - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (!fgi) - { - fgi = new LLFloaterGroupInfo("groupinfo", - FGI_RECT, - FLOATER_TITLE, - group_id, - tab_name); - - sInstances[group_id] = fgi; - - if (group_id.notNull()) - { - // Look up the group name. - // The callback will insert it into the title. - gCacheName->get(group_id, true, boost::bind(&callbackLoadGroupName, _1, _2, _3)); - } - } - - fgi->selectTabByName(tab_name); - - fgi->center(); - fgi->open(); /*Flawfinder: ignore*/ -} - -// static -void LLFloaterGroupInfo::showNotice(const std::string& subject, - const std::string& message, - const LLUUID& group_id, - const bool& has_inventory, - const std::string& inventory_name, - LLOfferInfo* inventory_offer) -{ - llinfos << "LLFloaterGroupInfo::showNotice : " << subject << llendl; - - if (group_id.isNull()) - { - // We need to clean up that inventory offer. - if (inventory_offer) - { - inventory_offer->forceResponse(IOR_DECLINE); - } - return; - } - - // If we don't have a floater for this group, drop this packet on the floor. - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (!fgi) - { - // We need to clean up that inventory offer. - if (inventory_offer) - { - inventory_offer->forceResponse(IOR_DECLINE); - } - return; - } - - fgi->mPanelGroupp->showNotice(subject,message,has_inventory,inventory_name,inventory_offer); -} diff --git a/indra/newview/llfloatergroupinfo.h b/indra/newview/llfloatergroupinfo.h index ac1beecd2..fda3c348a 100644 --- a/indra/newview/llfloatergroupinfo.h +++ b/indra/newview/llfloatergroupinfo.h @@ -39,48 +39,29 @@ #define LL_LLFLOATERGROUPINFO_H #include "llfloater.h" -#include "lluuid.h" +#include "llinstancetracker.h" class LLPanelGroup; -struct LLOfferInfo; class LLFloaterGroupInfo -: public LLFloater +: public LLFloater, public LLInstanceTracker { public: + LLFloaterGroupInfo(const LLUUID& group_id); virtual ~LLFloaterGroupInfo(); - static void showCreateGroup(void *); - static void showMyGroupInfo(void *); - static void showFromUUID(const LLUUID &group_id, - const std::string& tab_name = std::string()); - static void closeCreateGroup(); - static void closeGroup(const LLUUID& group_id); - static void refreshGroup(const LLUUID& group_id); - - static void showNotice(const std::string& subject, - const std::string& message, - const LLUUID& group_id, - const bool& has_inventory, - const std::string& inventory_name, - LLOfferInfo* inventory_offer); - - LLUUID getGroupID() { return mGroupID;} - void selectTabByName(std::string tab_name); - // This allow us to block the user from closing the floater - // if there is information that needs to be applied. + // This allows us to block the user from closing the floater if there is information that needs to be applied. virtual BOOL canClose(); + protected: - LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id = LLUUID::null, const std::string& tab_name = std::string()); + friend class LLGroupActions; + LLPanelGroup* mPanelGroupp; private: - static void callbackLoadGroupName(const LLUUID& id, const std::string& full_name, bool is_group); - static std::map sInstances; - - LLUUID mGroupID; - LLPanelGroup* mPanelGroupp; + void callbackLoadGroupName(const std::string& full_name); }; #endif + diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index eff6d409b..1f5a9cf24 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -51,7 +51,7 @@ #include "llfloatergroupinfo.h" #include "llfloaterdirectory.h" #include "llfocusmgr.h" -#include "llalertdialog.h" +#include "llgroupactions.h" #include "llselectmgr.h" #include "llscrolllistctrl.h" #include "llnotificationsutil.h" @@ -219,23 +219,23 @@ BOOL LLPanelGroups::postBuild() init_group_list(group_list, gAgent.getGroupID(), none_text); group_list->setCommitCallback(boost::bind(&LLPanelGroups::onGroupList,this)); group_list->setSortChangedCallback(boost::bind(&LLPanelGroups::onGroupSortChanged,this)); //Force 'none' to always be first entry. - group_list->setDoubleClickCallback(boost::bind(&LLPanelGroups::onBtnIM,this)); + group_list->setDoubleClickCallback(boost::bind(LLGroupActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Activate", onBtnActivate, this); + getChild("Activate")->setCommitCallback(boost::bind(LLGroupActions::activate, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Info", onBtnInfo, this); + getChild("Info")->setCommitCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("IM", onBtnIM, this); + getChild("IM")->setCommitCallback(boost::bind(LLGroupActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Leave", onBtnLeave, this); + getChild("Leave")->setCommitCallback(boost::bind(LLGroupActions::leave, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Create", onBtnCreate, this); + getChild("Create")->setCommitCallback(boost::bind(LLGroupActions::createGroup)); - childSetAction("Search...", onBtnSearch, this); + getChild("Search...")->setCommitCallback(boost::bind(LLGroupActions::search)); childSetAction("Invite...", onBtnInvite, this); - childSetAction("Titles...", onBtnTitles, this); + getChild("Titles...")->setCommitCallback(boost::bind(HBFloaterGroupTitles::toggle)); setDefaultBtn("IM"); @@ -292,148 +292,12 @@ void LLPanelGroups::enableButtons() } -void LLPanelGroups::onBtnCreate(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->create(); -} - void LLPanelGroups::onBtnInvite(void* userdata) { LLPanelGroups* self = (LLPanelGroups*)userdata; if(self) self->invite(); } -void LLPanelGroups::onBtnActivate(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->activate(); -} - -void LLPanelGroups::onBtnInfo(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->info(); -} - -void LLPanelGroups::onBtnIM(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->startIM(); -} - -void LLPanelGroups::onBtnLeave(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->leave(); -} - -void LLPanelGroups::onBtnSearch(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->search(); -} - -void LLPanelGroups::onBtnTitles(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->titles(); -} - -void LLPanelGroups::create() -{ - llinfos << "LLPanelGroups::create" << llendl; - LLFloaterGroupInfo::showCreateGroup(NULL); -} - -void LLPanelGroups::activate() -{ - llinfos << "LLPanelGroups::activate" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - if (group_list) - { - group_id = group_list->getCurrentID(); - } - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); -} - -void LLPanelGroups::info() -{ - llinfos << "LLPanelGroups::info" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - if (group_list && (group_id = group_list->getCurrentID()).notNull()) - { - LLFloaterGroupInfo::showFromUUID(group_id); - } -} - -void LLPanelGroups::startIM() -{ - //llinfos << "LLPanelFriends::onClickIM()" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - - if (group_list && (group_id = group_list->getCurrentID()).notNull()) - { - LLGroupData group_data; - if (gAgent.getGroupData(group_id, group_data)) - { - static LLCachedControl tear_off("OtherChatsTornOff"); - if (!tear_off) - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession( - group_data.mName, - IM_SESSION_GROUP_START, - group_id); - make_ui_sound("UISndStartIM"); - } - else - { - // this should never happen, as starting a group IM session - // relies on you belonging to the group and hence having the group data - make_ui_sound("UISndInvalidOp"); - } - } -} - -void LLPanelGroups::leave() -{ - llinfos << "LLPanelGroups::leave" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - if (group_list && (group_id = group_list->getCurrentID()).notNull()) - { - S32 count = gAgent.mGroups.count(); - S32 i; - for(i = 0; i < count; ++i) - { - if(gAgent.mGroups.get(i).mID == group_id) - break; - } - if(i < count) - { - LLSD args; - args["GROUP"] = gAgent.mGroups.get(i).mName; - LLSD payload; - payload["group_id"] = group_id; - LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, callbackLeaveGroup); - } - } -} - -void LLPanelGroups::search() -{ - LLFloaterDirectory::showGroups(); -} - void LLPanelGroups::invite() { LLCtrlListInterface *group_list = childGetListInterface("group list"); @@ -449,31 +313,6 @@ void LLPanelGroups::invite() LLFloaterGroupInvite::showForGroup(group_id); } -void LLPanelGroups::titles() -{ - HBFloaterGroupTitles::toggle(); -} - - -// static -bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - LLUUID group_id = notification["payload"]["group_id"].asUUID(); - if(option == 0) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_LeaveGroupRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_GroupData); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); - } - return false; -} - void LLPanelGroups::onGroupSortChanged() { LLScrollListCtrl *group_list = getChild("group list"); diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index ebf37acd7..b262b3f4a 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -52,7 +52,6 @@ class LLUICtrl; class LLTextBox; class LLScrollListCtrl; class LLButton; -class LLFloaterGroupPicker; class LLFloaterGroupPicker : public LLFloater, public LLUIFactory > { @@ -105,29 +104,8 @@ protected: void onGroupSortChanged(); void onGroupList(); - static void onBtnCreate(void* userdata); - static void onBtnActivate(void* userdata); - static void onBtnInfo(void* userdata); - static void onBtnIM(void* userdata); - static void onBtnLeave(void* userdata); - static void onBtnSearch(void* userdata); - static void onBtnVote(void* userdata); static void onBtnInvite(void* userdata); - static void onBtnTitles(void* userdata); - static void onDoubleClickGroup(void* userdata); - - void create(); - void activate(); - void info(); - void startIM(); - void leave(); - void search(); - void callVote(); void invite(); - void titles(); - - static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response); - }; diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index 33fbec1d4..cb8071588 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -37,7 +37,6 @@ // Viewer libs #include "llviewercontrol.h" #include "llmediactrl.h" -#include "llalertdialog.h" // Linden libs #include "llnotificationsutil.h" diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 72e46f09c..a46790763 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -721,6 +721,8 @@ BOOL LLImagePreviewAvatar::render() mNeedsUpdate = FALSE; LLVOAvatar* avatarp = mDummyAvatar; + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); @@ -785,6 +787,7 @@ BOOL LLImagePreviewAvatar::render() } } + gGL.popUIMatrix(); gGL.color4f(1,1,1,1); return TRUE; } diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 007a4670d..33d735f42 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -31,7 +31,8 @@ */ #include "llviewerprecompiledheaders.h" -#include "llfloateravatarinfo.h" + +#include "llavataractions.h" #include "llfloaterinspect.h" #include "llfloatertools.h" #include "llcachename.h" @@ -39,7 +40,6 @@ #include "llselectmgr.h" #include "lltoolcomp.h" #include "lltoolmgr.h" -#include "llviewercontrol.h" #include "llviewerobject.h" #include "lluictrlfactory.h" @@ -123,7 +123,7 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl) LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func); if(node) { - LLFloaterAvatarInfo::showFromDirectory(node->mPermissions->getCreator()); + LLAvatarActions::showProfile(node->mPermissions->getCreator()); } } } @@ -153,10 +153,10 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLAvatarActions::showProfile(owner_id); } // [/RLVa:KB] -// LLFloaterAvatarInfo::showFromDirectory(owner_id); +// LLAvatarActions::showProfile(owner_id); } } } diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 88fbc64e8..c067b78a7 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -99,8 +99,13 @@ BOOL LLFloaterJoystick::postBuild() rect = LLRect(350, r.mTop, r.mRight + 200, 0); } - mAxisStatsView = new LLStatView("axis values", joystick, "", rect); - mAxisStatsView->setDisplayChildren(TRUE); + + LLStatView::Params params; + params.name("axis values"); + params.rect(rect); + params.show_label(true); + params.label(joystick); + mAxisStatsView = LLUICtrlFactory::create(params); for (U32 i = 0; i < 6; i++) { diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 154acc65e..e6f077863 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -47,17 +47,18 @@ #include "llagent.h" #include "llagentaccess.h" +#include "llavataractions.h" #include "llavatarconstants.h" //For new Online check - HgB #include "llbutton.h" #include "llcheckboxctrl.h" #include "llradiogroup.h" #include "llcombobox.h" #include "llfloaterauction.h" -#include "llfloateravatarinfo.h" #include "llfloateravatarpicker.h" #include "llfloatergroups.h" #include "llfloatergroupinfo.h" #include "llfloaterscriptlimits.h" +#include "llgroupactions.h" #include "lllineeditor.h" #include "llnamelistctrl.h" #include "llnotify.h" @@ -848,8 +849,7 @@ void LLPanelLandGeneral::onClickInfoGroup(void* userdata) LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)userdata; LLParcel* parcel = panelp->mParcel->getParcel(); if (!parcel) return; - LLUUID id = parcel->getGroupID(); - if(id.notNull())LLFloaterGroupInfo::showFromUUID(parcel->getGroupID()); + LLGroupActions::show(parcel->getGroupID()); } void LLPanelLandGeneral::onClickProfile() @@ -859,13 +859,11 @@ void LLPanelLandGeneral::onClickProfile() if (parcel->getIsGroupOwned()) { - const LLUUID& group_id = parcel->getGroupID(); - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(parcel->getGroupID()); } else { - const LLUUID& avatar_id = parcel->getOwnerID(); - LLFloaterAvatarInfo::showFromObject(avatar_id); + LLAvatarActions::showProfile(parcel->getOwnerID()); } } @@ -1129,11 +1127,10 @@ BOOL LLPanelLandObjects::postBuild() mCleanOtherObjectsTime = getChild("clean other time"); mCleanOtherObjectsTime->setFocusLostCallback(boost::bind(&LLPanelLandObjects::onLostFocus, _1, this)); - mCleanOtherObjectsTime->setCommitCallback(onCommitClean); + mCleanOtherObjectsTime->setCommitCallback(onCommitClean, this); + + mCleanOtherObjectsTime->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); - childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32); - childSetUserData("clean other time", this); - mBtnRefresh = getChild("Refresh List"); mBtnRefresh->setClickedCallback(onClickRefresh, this); @@ -1180,11 +1177,11 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata) BOOL is_group = cell->getValue().asString() == OWNER_GROUP; if (is_group) { - LLFloaterGroupInfo::showFromUUID(owner_id); + LLGroupActions::show(owner_id); } else { - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLAvatarActions::showProfile(owner_id); } } } diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index b60aab459..4949678c1 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -42,8 +42,8 @@ #include "llagent.h" #include "llbutton.h" -#include "llfloatergroupinfo.h" #include "llfloaterworldmap.h" +#include "llgroupactions.h" #include "llproductinforequest.h" #include "llscrolllistctrl.h" #include "llstatusbar.h" @@ -103,7 +103,7 @@ BOOL LLFloaterLandHoldings::postBuild() LLScrollListCtrl *grant_list = getChild("grant list"); // Grant list - grant_list->setDoubleClickCallback(boost::bind(&LLFloaterLandHoldings::onGrantList,this)); + grant_list->setDoubleClickCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, grant_list))); LLCtrlListInterface *list = grant_list->getListInterface(); if (!list) return TRUE; @@ -323,19 +323,6 @@ void LLFloaterLandHoldings::onClickMap(void* data) self->buttonCore(1); } -// static -void LLFloaterLandHoldings::onGrantList(void* data) -{ - LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data; - LLCtrlSelectionInterface *list = self->childGetSelectionInterface("grant list"); - if (!list) return; - LLUUID group_id = list->getCurrentID(); - if (group_id.notNull()) - { - LLFloaterGroupInfo::showFromUUID(group_id); - } -} - void LLFloaterLandHoldings::refreshAggregates() { S32 allowed_area = gStatusBar->getSquareMetersCredit(); diff --git a/indra/newview/llfloaterlandholdings.h b/indra/newview/llfloaterlandholdings.h index def77cf2a..447ebeb82 100644 --- a/indra/newview/llfloaterlandholdings.h +++ b/indra/newview/llfloaterlandholdings.h @@ -60,8 +60,6 @@ public: static void onClickMap(void*); static void onClickLandmark(void*); - static void onGrantList(void* data); - protected: LLFloaterLandHoldings(); virtual ~LLFloaterLandHoldings(); diff --git a/indra/newview/llfloaterlandmark.cpp b/indra/newview/llfloaterlandmark.cpp index 2f39ac963..885e9dded 100644 --- a/indra/newview/llfloaterlandmark.cpp +++ b/indra/newview/llfloaterlandmark.cpp @@ -37,16 +37,18 @@ #include "llagent.h" #include "llagentui.h" #include "llcheckboxctrl.h" -#include "llviewerparcelmgr.h" +#include "llfiltereditor.h" #include "llfolderview.h" #include "llfoldervieweventlistener.h" #include "llinventory.h" #include "llinventoryfunctions.h" #include "llinventorypanel.h" -#include "llviewerinventory.h" +#include "llparcel.h" #include "llpermissions.h" #include "llsaleinfo.h" -#include "llparcel.h" +#include "llviewerinventory.h" +#include "llviewerparcelmgr.h" + #include "llnotificationsutil.h" #include "llviewerwindow.h" // alertXml @@ -67,21 +69,26 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data) mResolutionLabel(NULL), mIsDirty( FALSE ), mActive( TRUE ), - mSearchEdit(NULL), - mContextConeOpacity(0.f) + mFilterEdit(NULL), + mContextConeOpacity(0.f), + mInventoryPanel(NULL), + mSavedFolderState(NULL), + mNoCopyLandmarkSelected( FALSE ) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_landmark_ctrl.xml"); - +} +BOOL LLFloaterLandmark::postBuild() +{ mTentativeLabel = getChild("Multiple"); mResolutionLabel = getChild("unknown"); - - childSetCommitCallback("show_folders_check", onShowFolders, this); - childSetVisible("show_folders_check", FALSE); + LLUICtrl* show_folders_check = getChild("show_folders_check"); + show_folders_check->setCommitCallback(boost::bind(&LLFloaterLandmark::onShowFolders,this, _1)); + show_folders_check->setVisible(FALSE); - mSearchEdit = getChild("inventory search editor"); - mSearchEdit->setSearchCallback(onSearchEdit, this); + mFilterEdit = getChild("inventory search editor"); + mFilterEdit->setCommitCallback(boost::bind(&LLFloaterLandmark::onFilterEdit, this, _2)); mInventoryPanel = getChild("inventory panel"); @@ -93,7 +100,7 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data) mInventoryPanel->setFilterTypes(filter_types); //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. - mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterLandmark::onSelectionChange, _1, _2, (void*)this)); + mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterLandmark::onSelectionChange, this, _1, _2)); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); mInventoryPanel->setAllowMultiSelect(FALSE); @@ -110,17 +117,19 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data) mSavedFolderState = new LLSaveFolderState(); mNoCopyLandmarkSelected = FALSE; - - childSetAction("Close", LLFloaterLandmark::onBtnClose,this); - childSetAction("New", LLFloaterLandmark::onBtnNew,this); - childSetAction("NewFolder", LLFloaterLandmark::onBtnNewFolder,this); - childSetAction("Edit", LLFloaterLandmark::onBtnEdit,this); - childSetAction("Rename", LLFloaterLandmark::onBtnRename,this); - childSetAction("Delete", LLFloaterLandmark::onBtnDelete,this); + + getChild("Close")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnClose,this)); + getChild("New")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnNew,this)); + getChild("NewFolder")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnNewFolder,this)); + getChild("Edit")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnEdit,this)); + getChild("Rename")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnRename,this)); + getChild("Delete")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnDelete,this)); setCanMinimize(FALSE); mSavedFolderState->setApply(FALSE); + + return true; } LLFloaterLandmark::~LLFloaterLandmark() @@ -185,9 +194,9 @@ BOOL LLFloaterLandmark::handleKeyHere(KEY key, MASK mask) { LLFolderView* root_folder = mInventoryPanel->getRootFolder(); - if (root_folder && mSearchEdit) + if (root_folder && mFilterEdit) { - if (mSearchEdit->hasFocus() && + if (mFilterEdit->hasFocus() && (key == KEY_RETURN || key == KEY_DOWN) && mask == MASK_NONE) { @@ -209,7 +218,7 @@ BOOL LLFloaterLandmark::handleKeyHere(KEY key, MASK mask) if (root_folder->hasFocus() && key == KEY_UP) { - mSearchEdit->focusFirstItem(TRUE); + mFilterEdit->focusFirstItem(TRUE); } } @@ -261,27 +270,23 @@ const LLUUID& LLFloaterLandmark::findItemID(const LLUUID& asset_id, BOOL copyabl return LLUUID::null; } -// static -void LLFloaterLandmark::onBtnClose(void* userdata) +void LLFloaterLandmark::onBtnClose() { - LLFloaterLandmark* self = (LLFloaterLandmark*) userdata; - self->mIsDirty = FALSE; - self->close(); + mIsDirty = FALSE; + close(); } -// static -void LLFloaterLandmark::onBtnEdit(void* userdata) +void LLFloaterLandmark::onBtnEdit() { - LLFloaterLandmark* self = (LLFloaterLandmark*) userdata; // There isn't one, so make a new preview - LLViewerInventoryItem* itemp = gInventory.getItem(self->mImageAssetID); + LLViewerInventoryItem* itemp = gInventory.getItem(mImageAssetID); if(itemp) { open_landmark(itemp, itemp->getName(), TRUE); } } -// static -void LLFloaterLandmark::onBtnNew(void* userdata) + +void LLFloaterLandmark::onBtnNew() { LLViewerRegion* agent_region = gAgent.getRegion(); if(!agent_region) @@ -316,17 +321,15 @@ void LLFloaterLandmark::onBtnNew(void* userdata) NOT_WEARABLE, PERM_ALL, NULL); } -// static -void LLFloaterLandmark::onBtnNewFolder(void* userdata) + +void LLFloaterLandmark::onBtnNewFolder() { } -// static -void LLFloaterLandmark::onBtnDelete(void* userdata) -{ - LLFloaterLandmark* self = (LLFloaterLandmark*)userdata; - LLViewerInventoryItem* item = gInventory.getItem(self->mImageAssetID); +void LLFloaterLandmark::onBtnDelete() +{ + LLViewerInventoryItem* item = gInventory.getItem(mImageAssetID); if(item) { // Move the item to the trash @@ -360,82 +363,75 @@ void LLFloaterLandmark::onBtnDelete(void* userdata) } -// static -void LLFloaterLandmark::onBtnRename(void* userdata) +void LLFloaterLandmark::onBtnRename() { } -// static -void LLFloaterLandmark::onSelectionChange(const std::deque &items, BOOL user_action, void* data) +void LLFloaterLandmark::onSelectionChange(const std::deque &items, BOOL user_action) { - LLFloaterLandmark* self = (LLFloaterLandmark*)data; if (items.size()) { LLFolderViewItem* first_item = items.front(); LLInventoryItem* itemp = gInventory.getItem(first_item->getListener()->getUUID()); - self->mNoCopyLandmarkSelected = FALSE; + mNoCopyLandmarkSelected = FALSE; if (itemp) { if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) { - self->mNoCopyLandmarkSelected = TRUE; + mNoCopyLandmarkSelected = TRUE; } - self->mImageAssetID = itemp->getUUID(); - self->mIsDirty = TRUE; + mImageAssetID = itemp->getUUID(); + mIsDirty = TRUE; } } } -// static -void LLFloaterLandmark::onShowFolders(LLUICtrl* ctrl, void *user_data) +void LLFloaterLandmark::onShowFolders(LLUICtrl* ctrl) { LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; - LLFloaterLandmark* picker = (LLFloaterLandmark*)user_data; if (check_box->get()) { - picker->mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); } else { - picker->mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NO_FOLDERS); + mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NO_FOLDERS); } } -void LLFloaterLandmark::onSearchEdit(const std::string& search_string, void* user_data ) +void LLFloaterLandmark::onFilterEdit(const LLSD& value ) { - LLFloaterLandmark* picker = (LLFloaterLandmark*)user_data; - - std::string upper_case_search_string = search_string; + std::string upper_case_search_string = value.asString(); LLStringUtil::toUpper(upper_case_search_string); if (upper_case_search_string.empty()) { - if (picker->mInventoryPanel->getFilterSubString().empty()) + if (mInventoryPanel->getFilterSubString().empty()) { // current filter and new filter empty, do nothing return; } - picker->mSavedFolderState->setApply(TRUE); - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(*picker->mSavedFolderState); + mSavedFolderState->setApply(TRUE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); // add folder with current item to list of previously opened folders LLOpenFoldersWithSelection opener; - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); - picker->mInventoryPanel->getRootFolder()->scrollToShowSelection(); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); + mInventoryPanel->getRootFolder()->scrollToShowSelection(); } - else if (picker->mInventoryPanel->getFilterSubString().empty()) + else if (mInventoryPanel->getFilterSubString().empty()) { // first letter in search term, save existing folder open state - if (!picker->mInventoryPanel->getRootFolder()->isFilterModified()) + if (!mInventoryPanel->getRootFolder()->isFilterModified()) { - picker->mSavedFolderState->setApply(FALSE); - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(*picker->mSavedFolderState); + mSavedFolderState->setApply(FALSE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); } } - picker->mInventoryPanel->setFilterSubString(upper_case_search_string); + mInventoryPanel->setFilterSubString(upper_case_search_string); } diff --git a/indra/newview/llfloaterlandmark.h b/indra/newview/llfloaterlandmark.h index 56ac41832..668590c33 100644 --- a/indra/newview/llfloaterlandmark.h +++ b/indra/newview/llfloaterlandmark.h @@ -47,6 +47,7 @@ class LLSearchEditor; class LLInventoryPanel; class LLSaveFolderState; class LLViewerTexture; +class LLFilterEditor; // used for setting drag & drop callbacks. typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*); @@ -61,6 +62,8 @@ public: LLFloaterLandmark(const LLSD& data); virtual ~LLFloaterLandmark(); + BOOL postBuild(); + // LLView overrides virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, @@ -78,15 +81,15 @@ public: BOOL isDirty() const { return mIsDirty; } void setActive( BOOL active ); - static void onBtnClose( void* userdata ); - static void onBtnNew( void* userdata ); - static void onBtnEdit( void* userdata ); - static void onBtnDelete( void* userdata ); - static void onBtnNewFolder( void* userdata ); - static void onBtnRename( void* userdata ); - static void onSelectionChange(const std::deque &items, BOOL user_action, void* data); - static void onShowFolders(LLUICtrl* ctrl, void* userdata); - static void onSearchEdit(const std::string& search_string, void* user_data ); + void onBtnClose(); + void onBtnNew(); + void onBtnEdit(); + void onBtnDelete(); + void onBtnNewFolder(); + void onBtnRename(); + void onSelectionChange(const std::deque &items, BOOL user_action); + void onShowFolders(LLUICtrl* ctrl); + void onFilterEdit(const LLSD& value); protected: LLPointer mLandmarkp; @@ -104,7 +107,7 @@ protected: BOOL mIsDirty; BOOL mActive; - LLSearchEditor* mSearchEdit; + LLFilterEditor* mFilterEdit; LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mNonImmediateFilterPermMask; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 5bba956c3..6c22653a3 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -39,7 +39,6 @@ #pragma warning (disable : 4263) #pragma warning (disable : 4264) #endif -#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Woverloaded-virtual" #include "dae.h" //#include "dom.h" @@ -62,7 +61,6 @@ #include "dom/domScale.h" #include "dom/domTranslate.h" #include "dom/domVisual_scene.h" -#pragma GCC diagnostic pop #if LL_MSVC #pragma warning (pop) #endif diff --git a/indra/newview/llfloaterobjectiminfo.cpp b/indra/newview/llfloaterobjectiminfo.cpp index 3ecc140b7..af4650d0c 100644 --- a/indra/newview/llfloaterobjectiminfo.cpp +++ b/indra/newview/llfloaterobjectiminfo.cpp @@ -35,17 +35,16 @@ #include "llfloaterobjectiminfo.h" #include "llagentdata.h" +#include "llavataractions.h" #include "llcachename.h" #include "llcommandhandler.h" -#include "llfloater.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" #include "llfloatermute.h" +#include "llgroupactions.h" #include "llmutelist.h" #include "llsdutil.h" #include "lluictrlfactory.h" #include "llurldispatcher.h" -#include "llviewercontrol.h" // [RLVa:KB] - Version: 1.23.4 #include "rlvhandler.h" @@ -147,14 +146,14 @@ void LLFloaterObjectIMInfo::onClickOwner(void* data) LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; if (self->mOwnerIsGroup) { - LLFloaterGroupInfo::showFromUUID(self->mOwnerID); + LLGroupActions::show(self->mOwnerID); } // else // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g else if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (!RlvUtil::isNearbyAgent(self->mOwnerID)) ) // [/RLVa:KB] { - LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + LLAvatarActions::showProfile(self->mOwnerID); } } diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index ae60a6a9b..6cea68f66 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -45,7 +45,6 @@ #include "lltextbox.h" #include "llagent.h" // for agent id -#include "llalertdialog.h" #include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventorymodel.h" diff --git a/indra/newview/llfloaterpermissionsmgr.cpp b/indra/newview/llfloaterpermissionsmgr.cpp index 560b3612d..750cd8bfd 100644 --- a/indra/newview/llfloaterpermissionsmgr.cpp +++ b/indra/newview/llfloaterpermissionsmgr.cpp @@ -81,7 +81,7 @@ LLFloaterPermissionsMgr::LLFloaterPermissionsMgr() : LLRect scrollable_container_rect(0, y, getRect().getWidth(), 0); LLRect permissions_rect(0, 0, getRect().getWidth() - HPAD - HPAD, 0); mPermissions = new LLPermissionsView(permissions_rect); - mScroller = new LLScrollableContainerView( + mScroller = new LLScrollContainer( std::string("permissions container"), scrollable_container_rect, mPermissions @@ -107,15 +107,11 @@ LLPermissionsView::LLPermissionsView(const LLRect &rect) : LLView(std::string("p void LLPermissionsView::clearPermissionsData() { deleteAllChildren(); - std::for_each(mPermData.begin(), mPermData.end(), DeletePairedPointer()); - mPermData.clear(); } void LLPermissionsView::addPermissionsData(const std::string& object_name, const LLUUID& object_id, U32 permissions_flags) { // grow to make room for new element - LLPermissionsData* perm_datap = new LLPermissionsData(object_id, permissions_flags); - reshape(getRect().getWidth(), getRect().getHeight() + LINE + VPAD + BTN_HEIGHT + VPAD); S32 y = getRect().getHeight() - LINE - VPAD; LLRect label_rect(HPAD, y + LINE, getRect().getWidth(), y); @@ -126,39 +122,33 @@ void LLPermissionsView::addPermissionsData(const std::string& object_name, const y -= LINE + VPAD; LLRect btn_rect(HPAD, y + BTN_HEIGHT, 120, y); - LLButton* button = new LLButton(std::string("Revoke permissions"), btn_rect, LLStringUtil::null, revokePermissions, (void*)perm_datap); + LLButton* button = new LLButton(std::string("Revoke permissions"), btn_rect, LLStringUtil::null, boost::bind(&LLPermissionsView::revokePermissions, object_id, permissions_flags)); button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM); addChild(button); - btn_rect.set(HPAD + 120 + HPAD, y + BTN_HEIGHT, HPAD + 120 + HPAD + 120, y); - button = new LLButton(std::string("Find in world"), btn_rect, LLStringUtil::null, findObject, (void*)perm_datap); + /*btn_rect.set(HPAD + 120 + HPAD, y + BTN_HEIGHT, HPAD + 120 + HPAD + 120, y); + button = new LLButton(std::string("Find in world"), btn_rect, LLStringUtil::null, boost::bind(&LLPermissionsView::findObject, object_id, permissions_flags)); button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM); - addChild(button); - - mPermData.insert(std::make_pair(object_id, perm_datap)); + addChild(button);*/ } -void LLPermissionsView::revokePermissions(void *userdata) +void LLPermissionsView::revokePermissions(const LLUUID& object_id, U32 permission_flags) { - LLPermissionsData* perm_data = (LLPermissionsData*)userdata; - if (perm_data) + LLViewerObject* objectp = gObjectList.findObject(object_id); + if (objectp) { - LLViewerObject* objectp = gObjectList.findObject(perm_data->mObjectID); - if (objectp) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RevokePermissions); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Data); - msg->addUUIDFast(_PREHASH_ObjectID, perm_data->mObjectID); - msg->addU32Fast(_PREHASH_ObjectPermissions, perm_data->mPermFlags); - msg->sendReliable(objectp->getRegion()->getHost()); - } + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RevokePermissions); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Data); + msg->addUUIDFast(_PREHASH_ObjectID, object_id); + msg->addU32Fast(_PREHASH_ObjectPermissions, permission_flags); + msg->sendReliable(objectp->getRegion()->getHost()); } } -void LLPermissionsView::findObject(void *userdata) +/*void LLPermissionsView::findObject(const LLUUID& object_id, U32 permission_flags) { -} +}*/ diff --git a/indra/newview/llfloaterpermissionsmgr.h b/indra/newview/llfloaterpermissionsmgr.h index 993e77184..ac933e3f1 100644 --- a/indra/newview/llfloaterpermissionsmgr.h +++ b/indra/newview/llfloaterpermissionsmgr.h @@ -36,7 +36,7 @@ #include "llfloater.h" #include -class LLScrollableContainerView; +class LLScrollContainer; class LLPermissionsView; class LLFloaterPermissionsMgr @@ -59,20 +59,11 @@ public: LLPermissionsView* mPermissions; protected: - LLScrollableContainerView* mScroller; + LLScrollContainer* mScroller; static LLFloaterPermissionsMgr* sInstance; }; -class LLPermissionsData -{ -public: - LLPermissionsData(const LLUUID& object_id, U32 permission_flags) : mObjectID(object_id), mPermFlags(permission_flags) {}; - - LLUUID mObjectID; - U32 mPermFlags; -}; - class LLPermissionsView : public LLView { public: @@ -83,11 +74,8 @@ public: void clearPermissionsData(); void addPermissionsData(const std::string& object_name, const LLUUID& object_id, U32 permissions_flags); - static void revokePermissions(void *userdata); - static void findObject(void *userdata); - -protected: - std::map mPermData; + static void revokePermissions(const LLUUID& object_id, U32 permission_flags); + //static void findObject(const LLUUID& object_id, U32 permission_flags); }; diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 9a094ad58..a85abb1a6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -33,7 +33,6 @@ #include "llviewerprecompiledheaders.h" #include "lfsimfeaturehandler.h" -#include "llalertdialog.h" #include "llcheckboxctrl.h" #include "llfloaterperms.h" #include "llnotificationsutil.h" diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5648e0296..ed0b07be4 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -54,7 +54,6 @@ #include "llpanelnetwork.h" #include "llpanelaudioprefs.h" #include "llpaneldisplay.h" -#include "llpaneldebug.h" #include "llpanelgeneral.h" #include "llpanelinput.h" #include "llpanellogin.h" diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c55afa92b..387c20ccc 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -46,7 +46,6 @@ class LLPanelGeneral; class LLPanelInput; class LLPanelDisplay; class LLPanelAudioPrefs; -class LLPanelDebug; class LLPanelNetwork; class LLPanelWeb; class LLMessageSystem; @@ -90,7 +89,6 @@ private: LLPanelNetwork *mNetworkPanel; LLPanelDisplay *mDisplayPanel; LLPanelAudioPrefs *mAudioPanel; -// LLPanelDebug *mDebugPanel; LLPrefsChat *mPrefsChat; LLPrefsVoice *mPrefsVoice; LLPrefsIM *mPrefsIM; diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index cbd42ac0b..5fcdc8bbf 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -41,18 +41,19 @@ #include "llinventorydefines.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llfloateravatarinfo.h" -#include "llfloatergroupinfo.h" +#include "llgroupactions.h" #include "llinventorymodel.h" +#include "llinventoryobserver.h" #include "lllineeditor.h" #include "llradiogroup.h" #include "llresmgr.h" #include "roles_constants.h" #include "llselectmgr.h" #include "lltextbox.h" -#include "lluiconstants.h" +#include "lltrans.h" #include "llviewerinventory.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" @@ -83,7 +84,8 @@ bool can_set_export(const U32& base, const U32& own, const U32& next); class LLPropertiesObserver : public LLInventoryObserver { public: - LLPropertiesObserver() + LLPropertiesObserver(LLFloaterProperties* floater) + : mFloater(floater) { gInventory.addObserver(this); } @@ -92,6 +94,8 @@ public: gInventory.removeObserver(this); } virtual void changed(U32 mask); +private: + LLFloaterProperties* mFloater; }; void LLPropertiesObserver::changed(U32 mask) @@ -99,7 +103,7 @@ void LLPropertiesObserver::changed(U32 mask) // if there's a change we're interested in. if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0) { - LLFloaterProperties::dirtyAll(); + mFloater->dirty(); } } @@ -109,25 +113,10 @@ void LLPropertiesObserver::changed(U32 mask) /// Class LLFloaterProperties ///---------------------------------------------------------------------------- -// static -LLFloaterProperties::instance_map LLFloaterProperties::sInstances; -LLPropertiesObserver* LLFloaterProperties::sPropertiesObserver = NULL; -S32 LLFloaterProperties::sPropertiesObserverCount = 0; - -// static -LLFloaterProperties* LLFloaterProperties::find(const LLUUID& item_id, - const LLUUID& object_id) +//static +LLFloaterProperties* LLFloaterProperties::find(const LLUUID& item_id, const LLUUID &object_id) { - // for simplicity's sake, we key the properties window with a - // single uuid. However, the items are keyed by item and object - // (obj == null -> agent inventory). So, we xor the two ids, and - // use that as a lookup key - instance_map::iterator it = sInstances.find(item_id ^ object_id); - if(it != sInstances.end()) - { - return (*it).second; - } - return NULL; + return getInstance(item_id ^ object_id); } // static @@ -150,87 +139,71 @@ LLFloaterProperties* LLFloaterProperties::show(const LLUUID& item_id, return instance; } -void LLFloaterProperties::dirtyAll() -{ - // ...this is more clear. Possibly more correct, because the - // refresh method may delete the object. - for(instance_map::iterator it = sInstances.begin(); it!=sInstances.end(); ) - { - (*it++).second->dirty(); - } -} - // Default constructor LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id) : - LLFloater(name, rect, title), + LLFloater(name, rect, title), LLInstanceTracker(object_id ^ item_id), mItemID(item_id), mObjectID(object_id), mDirty(TRUE) { + mPropertiesObserver = new LLPropertiesObserver(this); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); - - if (!sPropertiesObserver) - { - sPropertiesObserver = new LLPropertiesObserver; - } - sPropertiesObserverCount++; - - childSetTextArg("TextPrice", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); - - // add the object to the static structure - LLUUID key = mItemID ^ mObjectID; - sInstances.insert(instance_map::value_type(key, this)); - // build the UI - // item name & description - childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); - childSetCommitCallback("LabelItemName",onCommitName,this); - childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe); - childSetCommitCallback("LabelItemDesc", onCommitDescription, this); - // Creator information - childSetAction("BtnCreator",onClickCreator,this); - // owner information - childSetAction("BtnOwner",onClickOwner,this); - // acquired date - // owner permissions - // Permissions debug text - // group permissions - childSetCommitCallback("CheckGroupCopy",&onCommitPermissions, this); - childSetCommitCallback("CheckGroupMod",&onCommitPermissions, this); - childSetCommitCallback("CheckGroupMove",&onCommitPermissions, this); - // everyone permissions - childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this); - childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this); - childSetCommitCallback("CheckExport", &onCommitPermissions, this); - if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) - LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLFloaterProperties::refresh, this)); - // next owner permissions - childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this); - childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this); - childSetCommitCallback("CheckNextOwnerTransfer",&onCommitPermissions, this); - // Mark for sale or not, and sale info - childSetCommitCallback("CheckPurchase",&onCommitSaleInfo, this); - childSetCommitCallback("RadioSaleType",&onCommitSaleType, this); - // "Price" label for edit - childSetCommitCallback("EditPrice",&onCommitSaleInfo, this); - // The UI has been built, now fill in all the values - refresh(); } // Destroys the object LLFloaterProperties::~LLFloaterProperties() { - // clean up the static data. - instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); - if(it != sInstances.end()) - { - sInstances.erase(it); - } - sPropertiesObserverCount--; - if (!sPropertiesObserverCount) - { - delete sPropertiesObserver; - sPropertiesObserver = NULL; - } + delete mPropertiesObserver; + mPropertiesObserver = NULL; +} + +// virtual +BOOL LLFloaterProperties::postBuild() +{ + + childSetTextArg("TextPrice", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); + // build the UI + // item name & description + getChild("LabelItemName")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); + getChild("LabelItemName")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitName,this)); + getChild("LabelItemDesc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); + getChild("LabelItemDesc")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitDescription,this)); + // Creator information + getChild("BtnCreator")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickCreator,this)); + // owner information + getChild("BtnOwner")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickOwner,this)); + // acquired date + // owner permissions + // Permissions debug text + // group permissions + getChild("CheckGroupCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild("CheckGroupMod")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild("CheckGroupMove")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + // everyone permissions + getChild("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild("CheckEveryoneMove")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild("CheckExport")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLFloaterProperties::refresh, this)); + // next owner permissions + getChild("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + // Mark for sale or not, and sale info + getChild("CheckPurchase")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleInfo, this)); + getChild("RadioSaleType")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleType, this)); + // "Price" label for edit + getChild("Edit Cost")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleInfo, this)); + // The UI has been built, now fill in all the values + refresh(); + + return TRUE; +} + +// virtual +void LLFloaterProperties::onOpen() +{ + refresh(); } void LLFloaterProperties::refresh() @@ -269,11 +242,11 @@ void LLFloaterProperties::refresh() "CheckNextOwnerTransfer", "CheckPurchase", "RadioSaleType", - "EditPrice" + "Edit Cost" }; for(size_t t=0; tsetEnabled(false); } const char* hideNames[]={ "BaseMaskDebug", @@ -284,7 +257,7 @@ void LLFloaterProperties::refresh() }; for(size_t t=0; tsetVisible(false); } } } @@ -309,14 +282,16 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) // do not enable the UI for incomplete items. LLViewerInventoryItem* i = (LLViewerInventoryItem*)item; - BOOL is_complete = i->isComplete(); - + BOOL is_complete = i->isFinished(); + const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(i->getInventoryType()); + const BOOL is_calling_card = (i->getInventoryType() == LLInventoryType::IT_CALLINGCARD); const LLPermissions& perm = item->getPermissions(); - BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, - GP_OBJECT_MANIPULATE); - BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, - GP_OBJECT_SET_SALE); - BOOL is_link = i->getIsLinkType(); + const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, + GP_OBJECT_MANIPULATE); + const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, + GP_OBJECT_SET_SALE) && + !cannot_restrict_permissions; + const BOOL is_link = i->getIsLinkType(); // You need permission to modify the object to modify an inventory // item in it. @@ -332,16 +307,16 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) // ITEM NAME & DESC // ////////////////////// BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, - GP_OBJECT_MANIPULATE) - && is_obj_modify && is_complete; + GP_OBJECT_MANIPULATE) + && is_obj_modify && is_complete; - childSetEnabled("LabelItemNameTitle",TRUE); - childSetEnabled("LabelItemName",is_modifiable); - childSetText("LabelItemName",item->getName()); - childSetEnabled("LabelItemDescTitle",TRUE); - childSetEnabled("LabelItemDesc",is_modifiable); - childSetVisible("IconLocked",!is_modifiable); - childSetText("LabelItemDesc",item->getDescription()); + getChildView("LabelItemNameTitle")->setEnabled(TRUE); + getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards + getChild("LabelItemName")->setValue(item->getName()); + getChildView("LabelItemDescTitle")->setEnabled(TRUE); + getChildView("LabelItemDesc")->setEnabled(is_modifiable); + getChildView("IconLocked")->setVisible(!is_modifiable); + getChild("LabelItemDesc")->setValue(item->getDescription()); ////////////////// // CREATOR NAME // @@ -353,17 +328,17 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) { std::string name; gCacheName->getFullName(item->getCreatorUUID(), name); - childSetEnabled("BtnCreator",TRUE); - childSetEnabled("LabelCreatorTitle",TRUE); - childSetEnabled("LabelCreatorName",TRUE); - childSetText("LabelCreatorName",name); + getChildView("BtnCreator")->setEnabled(TRUE); + getChildView("LabelCreatorTitle")->setEnabled(TRUE); + getChildView("LabelCreatorName")->setEnabled(TRUE); + getChild("LabelCreatorName")->setValue(name); } else { - childSetEnabled("BtnCreator",FALSE); - childSetEnabled("LabelCreatorTitle",FALSE); - childSetEnabled("LabelCreatorName",FALSE); - childSetText("LabelCreatorName",getString("unknown")); + getChildView("BtnCreator")->setEnabled(FALSE); + getChildView("LabelCreatorTitle")->setEnabled(FALSE); + getChildView("LabelCreatorName")->setEnabled(FALSE); + getChild("LabelCreatorName")->setValue(getString("unknown")); } //////////////// @@ -386,20 +361,20 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) } // [/RLVa:KB] } - //childSetEnabled("BtnOwner",TRUE); + getChildView("BtnOwner")->setEnabled(TRUE); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e - childSetEnabled("BtnOwner", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); + getChildView("BtnOwner")->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); // [/RLVa:KB] - childSetEnabled("LabelOwnerTitle",TRUE); - childSetEnabled("LabelOwnerName",TRUE); - childSetText("LabelOwnerName",name); + getChildView("LabelOwnerTitle")->setEnabled(TRUE); + getChildView("LabelOwnerName")->setEnabled(TRUE); + getChild("LabelOwnerName")->setValue(name); } else { - childSetEnabled("BtnOwner",FALSE); - childSetEnabled("LabelOwnerTitle",FALSE); - childSetEnabled("LabelOwnerName",FALSE); - childSetText("LabelOwnerName",getString("public")); + getChildView("BtnOwner")->setEnabled(FALSE); + getChildView("LabelOwnerTitle")->setEnabled(FALSE); + getChildView("LabelOwnerName")->setEnabled(FALSE); + getChild("LabelOwnerName")->setValue(getString("public")); } ////////////////// @@ -410,13 +385,13 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) time_t time_utc = item->getCreationDate(); if (0 == time_utc) { - childSetText("LabelAcquiredDate",getString("unknown")); + getChild("LabelAcquiredDate")->setValue(getString("unknown")); } else { - std::string timestr; - timeToFormattedString(time_utc, gSavedSettings.getString("TimestampFormat"), timestr); - childSetText("LabelAcquiredDate", timestr); + std::string timeStr; + timeToFormattedString(time_utc, gSavedSettings.getString("TimestampFormat"), timeStr); + getChild("LabelAcquiredDate")->setValue(timeStr); } /////////////////////// @@ -424,11 +399,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) /////////////////////// if(can_agent_manipulate) { - childSetText("OwnerLabel",getString("you_can")); + getChild("OwnerLabel")->setValue(getString("you_can")); } else { - childSetText("OwnerLabel",getString("owner_can")); + getChild("OwnerLabel")->setValue(getString("owner_can")); } U32 base_mask = perm.getMaskBase(); @@ -437,19 +412,19 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) U32 everyone_mask = perm.getMaskEveryone(); U32 next_owner_mask = perm.getMaskNextOwner(); - childSetEnabled("OwnerLabel",TRUE); - childSetEnabled("CheckOwnerModify",FALSE); - childSetValue("CheckOwnerModify",LLSD((BOOL)(owner_mask & PERM_MODIFY))); - childSetEnabled("CheckOwnerCopy",FALSE); - childSetValue("CheckOwnerCopy",LLSD((BOOL)(owner_mask & PERM_COPY))); - childSetEnabled("CheckOwnerTransfer",FALSE); - childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER))); + getChildView("OwnerLabel")->setEnabled(TRUE); + getChildView("CheckOwnerModify")->setEnabled(FALSE); + getChild("CheckOwnerModify")->setValue(LLSD((BOOL)(owner_mask & PERM_MODIFY))); + getChildView("CheckOwnerCopy")->setEnabled(FALSE); + getChild("CheckOwnerCopy")->setValue(LLSD((BOOL)(owner_mask & PERM_COPY))); + getChildView("CheckOwnerTransfer")->setEnabled(FALSE); + getChild("CheckOwnerTransfer")->setValue(LLSD((BOOL)(owner_mask & PERM_TRANSFER))); bool supports_export = LFSimFeatureHandler::instance().simSupportsExport(); - childSetEnabled("CheckOwnerExport",false); - childSetValue("CheckOwnerExport", supports_export && owner_mask & PERM_EXPORT); + getChildView("CheckOwnerExport")->setEnabled(false); + getChild("CheckOwnerExport")->setValue(LLSD((BOOL)(supports_export && owner_mask & PERM_EXPORT))); if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) - childSetVisible("CheckOwnerExport", false); + getChildView("CheckOwnerExport")->setVisible(false); /////////////////////// // DEBUG PERMISSIONS // @@ -475,43 +450,43 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) perm_string += mask_to_string(base_mask); if (!supports_export && base_mask & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); - childSetText("BaseMaskDebug",perm_string); - childSetVisible("BaseMaskDebug",TRUE); + getChild("BaseMaskDebug")->setValue(perm_string); + getChildView("BaseMaskDebug")->setVisible(TRUE); perm_string = "O: "; perm_string += mask_to_string(owner_mask); if (!supports_export && owner_mask & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); - childSetText("OwnerMaskDebug",perm_string); - childSetVisible("OwnerMaskDebug",TRUE); + getChild("OwnerMaskDebug")->setValue(perm_string); + getChildView("OwnerMaskDebug")->setVisible(TRUE); perm_string = "G"; perm_string += overwrite_group ? "*: " : ": "; perm_string += mask_to_string(group_mask); - childSetText("GroupMaskDebug",perm_string); - childSetVisible("GroupMaskDebug",TRUE); + getChild("GroupMaskDebug")->setValue(perm_string); + getChildView("GroupMaskDebug")->setVisible(TRUE); perm_string = "E"; perm_string += overwrite_everyone ? "*: " : ": "; perm_string += mask_to_string(everyone_mask); if (!supports_export && everyone_mask & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); - childSetText("EveryoneMaskDebug",perm_string); - childSetVisible("EveryoneMaskDebug",TRUE); - + getChild("EveryoneMaskDebug")->setValue(perm_string); + getChildView("EveryoneMaskDebug")->setVisible(TRUE); + perm_string = "N"; perm_string += slam_perm ? "*: " : ": "; perm_string += mask_to_string(next_owner_mask); - childSetText("NextMaskDebug",perm_string); - childSetVisible("NextMaskDebug",TRUE); + getChild("NextMaskDebug")->setValue(perm_string); + getChildView("NextMaskDebug")->setVisible(TRUE); } else { - childSetVisible("BaseMaskDebug",FALSE); - childSetVisible("OwnerMaskDebug",FALSE); - childSetVisible("GroupMaskDebug",FALSE); - childSetVisible("EveryoneMaskDebug",FALSE); - childSetVisible("NextMaskDebug",FALSE); + getChildView("BaseMaskDebug")->setVisible(FALSE); + getChildView("OwnerMaskDebug")->setVisible(FALSE); + getChildView("GroupMaskDebug")->setVisible(FALSE); + getChildView("EveryoneMaskDebug")->setVisible(FALSE); + getChildView("NextMaskDebug")->setVisible(FALSE); } ///////////// @@ -521,25 +496,25 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) // Check for ability to change values. if (!is_link && is_obj_modify && can_agent_manipulate) { - childSetEnabled("GroupLabel", true); - childSetEnabled("CheckGroupCopy", (owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY)); - childSetEnabled("CheckGroupMod", owner_mask & PERM_MODIFY); - childSetEnabled("CheckGroupMove", true); - childSetEnabled("EveryoneLabel", true); - childSetEnabled("CheckEveryoneCopy", (owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY)); - childSetEnabled("CheckEveryoneMove",true); + getChild("GroupLabel")->setEnabled(TRUE); + getChild("CheckGroupCopy")->setEnabled((owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY)); + getChild("CheckGroupMod")->setEnabled(owner_mask & PERM_MODIFY); + getChild("CheckGroupMove")->setEnabled(TRUE); + getChild("EveryoneLabel")->setEnabled(TRUE); + getChild("CheckEveryoneCopy")->setEnabled((owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY)); + getChild("CheckEveryoneMove")->setEnabled(TRUE); } else { - childSetEnabled("GroupLabel", false); - childSetEnabled("CheckGroupCopy", false); - childSetEnabled("CheckGroupMod", false); - childSetEnabled("CheckGroupMove", false); - childSetEnabled("EveryoneLabel", false); - childSetEnabled("CheckEveryoneCopy",false); - childSetEnabled("CheckEveryoneMove",false); + getChild("GroupLabel")->setEnabled(FALSE); + getChild("CheckGroupCopy")->setEnabled(FALSE); + getChild("CheckGroupMod")->setEnabled(FALSE); + getChild("CheckGroupMove")->setEnabled(FALSE); + getChild("EveryoneLabel")->setEnabled(FALSE); + getChild("CheckEveryoneCopy")->setEnabled(FALSE); + getChild("CheckEveryoneMove")->setEnabled(FALSE); } - childSetEnabled("CheckExport", supports_export && item->getType() != LLAssetType::AT_OBJECT && gAgentID == item->getCreatorUUID() + getChild("CheckExport")->setEnabled(supports_export && item->getType() != LLAssetType::AT_OBJECT && gAgentID == item->getCreatorUUID() && can_set_export(base_mask, owner_mask, next_owner_mask)); // Set values. @@ -547,13 +522,13 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; - childSetValue("CheckGroupCopy", is_group_copy); - childSetValue("CheckGroupMod", is_group_modify); - childSetValue("CheckGroupMove", is_group_move); + getChild("CheckGroupCopy")->setValue(LLSD((BOOL)is_group_copy)); + getChild("CheckGroupMod")->setValue(LLSD((BOOL)is_group_modify)); + getChild("CheckGroupMove")->setValue(LLSD((BOOL)is_group_move)); - childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY))); - childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE))); - childSetValue("CheckExport", supports_export && everyone_mask & PERM_EXPORT); + getChild("CheckEveryoneCopy")->setValue(LLSD((BOOL)(everyone_mask & PERM_COPY))); + getChild("CheckEveryoneMove")->setValue(LLSD((BOOL)(everyone_mask & PERM_MOVE))); + getChild("CheckExport")->setValue(LLSD((BOOL)(supports_export && everyone_mask & PERM_EXPORT))); /////////////// // SALE INFO // @@ -565,39 +540,40 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) if (is_obj_modify && can_agent_sell && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE)) { - childSetEnabled("SaleLabel",is_complete); - childSetEnabled("CheckPurchase",is_complete); + getChildView("SaleLabel")->setEnabled(is_complete); + getChildView("CheckPurchase")->setEnabled(is_complete); bool no_export = !(everyone_mask & PERM_EXPORT); // Next owner perms can't be changed if set - childSetEnabled("NextOwnerLabel", no_export); - childSetEnabled("CheckNextOwnerModify", no_export && base_mask & PERM_MODIFY); - childSetEnabled("CheckNextOwnerCopy", no_export && base_mask & PERM_COPY); - childSetEnabled("CheckNextOwnerTransfer", no_export && next_owner_mask & PERM_COPY); + getChildView("NextOwnerLabel")->setEnabled(no_export); + getChildView("CheckNextOwnerModify")->setEnabled(no_export && (base_mask & PERM_MODIFY) && !cannot_restrict_permissions); + getChildView("CheckNextOwnerCopy")->setEnabled(no_export && (base_mask & PERM_COPY) && !cannot_restrict_permissions); + getChildView("CheckNextOwnerTransfer")->setEnabled(no_export && (next_owner_mask & PERM_COPY) && !cannot_restrict_permissions); - childSetEnabled("RadioSaleType",is_complete && is_for_sale); - childSetEnabled("TextPrice",is_complete && is_for_sale); - childSetEnabled("EditPrice",is_complete && is_for_sale); + getChildView("RadioSaleType")->setEnabled(is_complete && is_for_sale); + getChildView("TextPrice")->setEnabled(is_complete && is_for_sale); + getChildView("Edit Cost")->setEnabled(is_complete && is_for_sale); } else { - childSetEnabled("SaleLabel",FALSE); - childSetEnabled("CheckPurchase",FALSE); + getChildView("SaleLabel")->setEnabled(FALSE); + getChildView("CheckPurchase")->setEnabled(FALSE); - childSetEnabled("NextOwnerLabel",FALSE); - childSetEnabled("CheckNextOwnerModify",FALSE); - childSetEnabled("CheckNextOwnerCopy",FALSE); - childSetEnabled("CheckNextOwnerTransfer",FALSE); + getChildView("NextOwnerLabel")->setEnabled(FALSE); + getChildView("CheckNextOwnerModify")->setEnabled(FALSE); + getChildView("CheckNextOwnerCopy")->setEnabled(FALSE); + getChildView("CheckNextOwnerTransfer")->setEnabled(FALSE); - childSetEnabled("RadioSaleType",FALSE); - childSetEnabled("TextPrice",FALSE); - childSetEnabled("EditPrice",FALSE); + getChildView("RadioSaleType")->setEnabled(FALSE); + getChildView("TextPrice")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(FALSE); } // Set values. - childSetValue("CheckPurchase", is_for_sale); - childSetValue("CheckNextOwnerModify",LLSD(BOOL(next_owner_mask & PERM_MODIFY))); - childSetValue("CheckNextOwnerCopy",LLSD(BOOL(next_owner_mask & PERM_COPY))); - childSetValue("CheckNextOwnerTransfer",LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); + getChild("CheckPurchase")->setValue(is_for_sale); + getChildView("Edit Cost")->setEnabled(is_for_sale); + getChild("CheckNextOwnerModify")->setValue(LLSD(BOOL(next_owner_mask & PERM_MODIFY))); + getChild("CheckNextOwnerCopy")->setValue(LLSD(BOOL(next_owner_mask & PERM_COPY))); + getChild("CheckNextOwnerTransfer")->setValue(LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); LLRadioGroup* radioSaleType = getChild("RadioSaleType"); if (is_for_sale) @@ -605,66 +581,52 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1); S32 numerical_price; numerical_price = sale_info.getSalePrice(); - childSetText("EditPrice",llformat("%d",numerical_price)); + getChild("Edit Cost")->setValue(llformat("%d",numerical_price)); } else { radioSaleType->setSelectedIndex(-1); - childSetText("EditPrice",llformat("%d",0)); + getChild("Edit Cost")->setValue(llformat("%d",0)); } } -// static -void LLFloaterProperties::onClickCreator(void* data) +void LLFloaterProperties::onClickCreator() { - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLInventoryItem* item = self->findItem(); + LLInventoryItem* item = findItem(); if(!item) return; - if(!item->getCreatorUUID().isNull()) - { - LLFloaterAvatarInfo::showFromObject(item->getCreatorUUID()); - } + LLAvatarActions::showProfile(item->getCreatorUUID()); } // static -void LLFloaterProperties::onClickOwner(void* data) +void LLFloaterProperties::onClickOwner() { - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLInventoryItem* item = self->findItem(); + LLInventoryItem* item = findItem(); if(!item) return; if(item->getPermissions().isGroupOwned()) { - LLFloaterGroupInfo::showFromUUID(item->getPermissions().getGroup()); + LLGroupActions::show(item->getPermissions().getGroup()); } else { -// if(!item->getPermissions().getOwner().isNull()) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - if ( (!item->getPermissions().getOwner().isNull()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) // [/RLVa:KB] { - LLFloaterAvatarInfo::showFromObject(item->getPermissions().getOwner()); + LLAvatarActions::showProfile(item->getPermissions().getOwner()); } } } // static -void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitName() { //llinfos << "LLFloaterProperties::onCommitName()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) - { - return; - } - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) { return; } - LLLineEditor* labelItemName = self->getChild("LabelItemName"); + LLLineEditor* labelItemName = getChild("LabelItemName"); if(labelItemName&& (item->getName() != labelItemName->getText()) && @@ -672,7 +634,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) { LLPointer new_item = new LLViewerInventoryItem(item); new_item->rename(labelItemName->getText()); - if(self->mObjectID.isNull()) + if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); @@ -680,7 +642,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) } else { - LLViewerObject* object = gObjectList.findObject(self->mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( @@ -692,16 +654,13 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) } } -// static -void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitDescription() { //llinfos << "LLFloaterProperties::onCommitDescription()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; - LLLineEditor* labelItemDesc = self->getChild("LabelItemDesc"); + LLLineEditor* labelItemDesc = getChild("LabelItemDesc"); if(!labelItemDesc) { return; @@ -712,7 +671,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) LLPointer new_item = new LLViewerInventoryItem(item); new_item->setDescription(labelItemDesc->getText()); - if(self->mObjectID.isNull()) + if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); @@ -720,7 +679,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) } else { - LLViewerObject* object = gObjectList.findObject(self->mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( @@ -732,74 +691,71 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) } } -// static -void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitPermissions() { //llinfos << "LLFloaterProperties::onCommitPermissions()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; LLPermissions perm(item->getPermissions()); - LLCheckBoxCtrl* CheckGroupCopy = self->getChild("CheckGroupCopy"); + LLCheckBoxCtrl* CheckGroupCopy = getChild("CheckGroupCopy"); if(CheckGroupCopy) { perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), CheckGroupCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckGroupMod = self->getChild("CheckGroupMod"); + LLCheckBoxCtrl* CheckGroupMod = getChild("CheckGroupMod"); if(CheckGroupMod) { perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), CheckGroupMod->get(), PERM_MODIFY); } - LLCheckBoxCtrl* CheckGroupMove = self->getChild("CheckGroupMove"); + LLCheckBoxCtrl* CheckGroupMove = getChild("CheckGroupMove"); if(CheckGroupMove) { perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), CheckGroupMove->get(), PERM_MOVE); } - LLCheckBoxCtrl* CheckEveryoneMove = self->getChild("CheckEveryoneMove"); + LLCheckBoxCtrl* CheckEveryoneMove = getChild("CheckEveryoneMove"); if(CheckEveryoneMove) { perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckEveryoneMove->get(), PERM_MOVE); } - LLCheckBoxCtrl* CheckEveryoneCopy = self->getChild("CheckEveryoneCopy"); + LLCheckBoxCtrl* CheckEveryoneCopy = getChild("CheckEveryoneCopy"); if(CheckEveryoneCopy) { perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckEveryoneCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckExport = self->getChild("CheckExport"); + LLCheckBoxCtrl* CheckExport = getChild("CheckExport"); if(CheckExport) { perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckExport->get(), PERM_EXPORT); } - LLCheckBoxCtrl* CheckNextOwnerModify = self->getChild("CheckNextOwnerModify"); + LLCheckBoxCtrl* CheckNextOwnerModify = getChild("CheckNextOwnerModify"); if(CheckNextOwnerModify) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerModify->get(), PERM_MODIFY); } - LLCheckBoxCtrl* CheckNextOwnerCopy = self->getChild("CheckNextOwnerCopy"); + LLCheckBoxCtrl* CheckNextOwnerCopy = getChild("CheckNextOwnerCopy"); if(CheckNextOwnerCopy) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckNextOwnerTransfer = self->getChild("CheckNextOwnerTransfer"); + LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild("CheckNextOwnerTransfer"); if(CheckNextOwnerTransfer) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerTransfer->get(), PERM_TRANSFER); } if(perm != item->getPermissions() - && item->isComplete()) + && item->isFinished()) { LLPointer new_item = new LLViewerInventoryItem(item); new_item->setPermissions(perm); @@ -828,7 +784,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } new_item->setFlags(flags); - if(self->mObjectID.isNull()) + if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); @@ -836,7 +792,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) } else { - LLViewerObject* object = gObjectList.findObject(self->mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( @@ -849,26 +805,22 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) else { // need to make sure we don't just follow the click - self->refresh(); + refresh(); } } // static -void LLFloaterProperties::onCommitSaleInfo(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitSaleInfo() { //llinfos << "LLFloaterProperties::onCommitSaleInfo()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - self->updateSaleInfo(); + updateSaleInfo(); } // static -void LLFloaterProperties::onCommitSaleType(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitSaleType() { //llinfos << "LLFloaterProperties::onCommitSaleType()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - self->updateSaleInfo(); + updateSaleInfo(); } void LLFloaterProperties::updateSaleInfo() @@ -878,10 +830,10 @@ void LLFloaterProperties::updateSaleInfo() LLSaleInfo sale_info(item->getSaleInfo()); if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE)) { - childSetValue("CheckPurchase",LLSD((BOOL)FALSE)); + getChild("CheckPurchase")->setValue(LLSD((BOOL)FALSE)); } - if((BOOL)childGetValue("CheckPurchase")) + if((BOOL)getChild("CheckPurchase")->getValue()) { // turn on sale info LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY; @@ -913,13 +865,11 @@ void LLFloaterProperties::updateSaleInfo() sale_type = LLSaleInfo::FS_ORIGINAL; } - LLLineEditor* EditPrice = getChild("EditPrice"); + S32 price = -1; - if(EditPrice) - { - price = atoi(EditPrice->getText().c_str()); - } + price = getChild("Edit Cost")->getValue().asInteger();; + // Invalid data - turn off the sale if (price < 0) { @@ -935,7 +885,7 @@ void LLFloaterProperties::updateSaleInfo() sale_info.setSaleType(LLSaleInfo::FS_NOT); } if(sale_info != item->getSaleInfo() - && item->isComplete()) + && item->isFinished()) { LLPointer new_item = new LLViewerInventoryItem(item); @@ -994,21 +944,30 @@ LLInventoryItem* LLFloaterProperties::findItem() const return item; } +//static void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_id) { - LLFloaterProperties* floaterp = find(item_id, object_id); - + LLFloaterProperties* floaterp = getInstance(item_id ^ object_id); if (floaterp) { floaterp->close(); } } +//static +void LLFloaterProperties::dirtyAll() +{ + for(instance_iter it = beginInstances();it!=endInstances();++it) + { + it->dirty(); + } +} + ///---------------------------------------------------------------------------- /// LLMultiProperties ///---------------------------------------------------------------------------- -LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect) +LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(LLTrans::getString("MultiPropertiesTitle"), rect) { } diff --git a/indra/newview/llfloaterproperties.h b/indra/newview/llfloaterproperties.h index fe54bcd0e..69c5eead2 100644 --- a/indra/newview/llfloaterproperties.h +++ b/indra/newview/llfloaterproperties.h @@ -36,6 +36,8 @@ #include #include "llmultifloater.h" #include "lliconctrl.h" +#include "llinstancetracker.h" +#include "lluuid.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLFloaterProperties @@ -50,7 +52,7 @@ class LLTextBox; class LLPropertiesObserver; -class LLFloaterProperties : public LLFloater +class LLFloaterProperties : public LLFloater, public LLInstanceTracker { public: static LLFloaterProperties* find(const LLUUID& item_id, @@ -62,21 +64,23 @@ public: static void closeByID(const LLUUID& item_id, const LLUUID& object_id); LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id); - virtual ~LLFloaterProperties(); + /*virtual*/ ~LLFloaterProperties(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(); // do everything necessary void dirty() { mDirty = TRUE; } void refresh(); - + protected: // ui callbacks - static void onClickCreator(void* data); - static void onClickOwner(void* data); - static void onCommitName(LLUICtrl* ctrl, void* data); - static void onCommitDescription(LLUICtrl* ctrl, void* data); - static void onCommitPermissions(LLUICtrl* ctrl, void* data); - static void onCommitSaleInfo(LLUICtrl* ctrl, void* data); - static void onCommitSaleType(LLUICtrl* ctrl, void* data); + void onClickCreator(); + void onClickOwner(); + void onCommitName(); + void onCommitDescription(); + void onCommitPermissions(); + void onCommitSaleInfo(); + void onCommitSaleType(); void updateSaleInfo(); LLInventoryItem* findItem() const; @@ -95,10 +99,7 @@ protected: BOOL mDirty; - typedef std::map instance_map; - static instance_map sInstances; - static LLPropertiesObserver* sPropertiesObserver; - static S32 sPropertiesObserverCount; + LLPropertiesObserver* mPropertiesObserver; }; class LLMultiProperties : public LLMultiFloater diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index e8cb41ad5..7aa6c1745 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -49,7 +49,6 @@ #include "llradiogroup.h" #include "llagent.h" -#include "llalertdialog.h" #include "llappviewer.h" #include "llavatarnamecache.h" #include "llfloateravatarpicker.h" diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 1b50f3ead..6efdf1e53 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -184,7 +184,7 @@ BOOL LLFloaterSellLandUI::postBuild() { childSetCommitCallback("sell_to", onChangeValue, this); childSetCommitCallback("price", onChangeValue, this); - childSetPrevalidate("price", LLLineEditor::prevalidateNonNegativeS32); + getChild("price")->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); childSetCommitCallback("sell_objects", onChangeValue, this); childSetAction("sell_to_select_agent", doSelectAgent, this); childSetAction("cancel_btn", doCancel, this); diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 1360b8b12..f95e8b365 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -37,6 +37,7 @@ #include "llcolorswatch.h" //#include "llfirstuse.h" #include "llfloater.h" +#include "llfiltereditor.h" #include "llscrolllistctrl.h" #include "llspinctrl.h" #include "lltexteditor.h" @@ -107,7 +108,7 @@ BOOL LLFloaterSettingsDebug::postBuild() getChild("boolean_combo")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); getChild("copy_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCopyToClipboard, this)); getChild("default_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onClickDefault, this)); - getChild("search_settings_input")->setSearchCallback(onUpdateFilter, this); + getChild("search_settings_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onUpdateFilter, this, _2)); mComment = getChild("comment_text"); return TRUE; } @@ -532,9 +533,9 @@ void LLFloaterSettingsDebug::updateControl() } -void LLFloaterSettingsDebug::onUpdateFilter(const std::string& searchTerm, void*) +void LLFloaterSettingsDebug::onUpdateFilter(const LLSD& value) { - LLFloaterSettingsDebug::getInstance()->updateFilter(searchTerm); + updateFilter(value.asString()); } void LLFloaterSettingsDebug::updateFilter(std::string searchTerm) diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index cce8fa481..5c94d6bd0 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -53,7 +53,7 @@ public: void updateControl(); // updates control filter to display in the controls list on keystroke - static void onUpdateFilter(const std::string& searchTerm, void*); + void onUpdateFilter(const LLSD& value); void updateFilter(std::string searchTerm); void onSettingSelect(); diff --git a/indra/newview/llfloaterstats.cpp b/indra/newview/llfloaterstats.cpp index 342e4fa45..53a6c1708 100644 --- a/indra/newview/llfloaterstats.cpp +++ b/indra/newview/llfloaterstats.cpp @@ -63,15 +63,22 @@ void LLFloaterStats::buildStats() // // Viewer Basic // - stat_viewp = new LLStatView("basic stat view", "Basic", "OpenDebugStatBasic", rect); + LLStatView::Params params; + params.name("basic stat view"); + params.show_label(true); + params.label("Basic"); + params.setting("OpenDebugStatBasic"); + params.rect(rect); + + stat_viewp = LLUICtrlFactory::create(params); addStatView(stat_viewp); stat_barp = stat_viewp->addStat("FPS", &(LLViewerStats::getInstance()->mFPSStat), "DebugStatModeFPS", TRUE, TRUE); stat_barp->setUnitLabel(" fps"); stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 45.f; - stat_barp->mTickSpacing = 7.5f; + stat_barp->mMaxBar = 60.f; + stat_barp->mTickSpacing = 3.f; stat_barp->mLabelSpacing = 15.f; stat_barp->mPrecision = 1; @@ -113,16 +120,25 @@ void LLFloaterStats::buildStats() stat_barp->mDisplayMean = FALSE; } - stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect); + params.name("advanced stat view"); + params.show_label(true); + params.label("Advanced"); + params.setting("OpenDebugStatAdvanced"); + params.rect(rect); + stat_viewp = LLUICtrlFactory::create(params); addStatView(stat_viewp); - - LLStatView *render_statviewp = stat_viewp->addStatView("render stat view", "Render", "OpenDebugStatRender", rect); + params.name("render stat view"); + params.show_label(true); + params.label("Render"); + params.setting("OpenDebugStatRender"); + params.rect(rect); + LLStatView *render_statviewp = stat_viewp->addStatView(params); stat_barp = render_statviewp->addStat("KTris Drawn", &(LLViewerStats::getInstance()->mTrianglesDrawnStat), "DebugStatModeKTrisDrawnFr"); stat_barp->setUnitLabel("/fr"); stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 500.f; + stat_barp->mMaxBar = 3000.f; stat_barp->mTickSpacing = 100.f; stat_barp->mLabelSpacing = 500.f; stat_barp->mPrecision = 1; @@ -131,9 +147,9 @@ void LLFloaterStats::buildStats() stat_barp = render_statviewp->addStat("KTris Drawn", &(LLViewerStats::getInstance()->mTrianglesDrawnStat), "DebugStatModeKTrisDrawnSec"); stat_barp->setUnitLabel("/sec"); stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 3000.f; - stat_barp->mTickSpacing = 250.f; - stat_barp->mLabelSpacing = 1000.f; + stat_barp->mMaxBar = 100000.f; + stat_barp->mTickSpacing = 4000.f; + stat_barp->mLabelSpacing = 20000.f; stat_barp->mPrecision = 1; stat_barp = render_statviewp->addStat("Total Objs", &(LLViewerStats::getInstance()->mNumObjectsStat), "DebugStatModeTotalObjs"); @@ -144,7 +160,6 @@ void LLFloaterStats::buildStats() stat_barp->mPerSec = FALSE; stat_barp = render_statviewp->addStat("New Objs", &(LLViewerStats::getInstance()->mNumNewObjectsStat), "DebugStatModeNewObjs"); - stat_barp->setLabel("New Objs"); stat_barp->setUnitLabel("/sec"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 1000.f; @@ -153,7 +168,6 @@ void LLFloaterStats::buildStats() stat_barp->mPerSec = TRUE; stat_barp = render_statviewp->addStat("Object Cache Hit Rate", &(LLViewerStats::getInstance()->mNumNewObjectsStat), std::string(), false, true); - stat_barp->setLabel("Object Cache Hit Rate"); stat_barp->setUnitLabel("%"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 100.f; @@ -162,10 +176,14 @@ void LLFloaterStats::buildStats() stat_barp->mPerSec = FALSE; // Texture statistics - LLStatView *texture_statviewp = render_statviewp->addStatView("texture stat view", "Texture", "OpenDebugStatTexture", rect); + params.name("texture stat view"); + params.show_label(true); + params.label("Texture"); + params.setting("OpenDebugStatTexture"); + params.rect(rect); + LLStatView *texture_statviewp = render_statviewp->addStatView(params); stat_barp = texture_statviewp->addStat("Cache Hit Rate", &(LLTextureFetch::sCacheHitRate), std::string(), false, true); - stat_barp->setLabel("Cache Hit Rate"); stat_barp->setUnitLabel("%"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 100.f; @@ -233,10 +251,14 @@ void LLFloaterStats::buildStats() stat_barp->mLabelSpacing = 200.f; stat_barp->mPrecision = 1; stat_barp->mPerSec = FALSE; - // Network statistics - LLStatView *net_statviewp = stat_viewp->addStatView("network stat view", "Network", "OpenDebugStatNet", rect); + params.name("network stat view"); + params.show_label(true); + params.label("Network"); + params.setting("OpenDebugStatNet"); + params.rect(rect); + LLStatView *net_statviewp = stat_viewp->addStatView(params); stat_barp = net_statviewp->addStat("UDP Packets In", &(LLViewerStats::getInstance()->mPacketsInStat), "DebugStatModePacketsIn"); stat_barp->setUnitLabel("/sec"); @@ -307,7 +329,12 @@ void LLFloaterStats::buildStats() // Simulator stats - LLStatView *sim_statviewp = new LLStatView("sim stat view", "Simulator", "OpenDebugStatSim", rect); + params.name("sim stat view"); + params.show_label(true); + params.label("Simulator"); + params.setting("OpenDebugStatSim"); + params.rect(rect); + LLStatView *sim_statviewp = LLUICtrlFactory::create(params); addStatView(sim_statviewp); stat_barp = sim_statviewp->addStat("Time Dilation", &(LLViewerStats::getInstance()->mSimTimeDilation), "DebugStatModeTimeDialation"); @@ -336,7 +363,12 @@ void LLFloaterStats::buildStats() stat_barp->mPerSec = FALSE; stat_barp->mDisplayMean = FALSE; - LLStatView *phys_details_viewp = sim_statviewp->addStatView("phys detail view", "Physics Details", "OpenDebugStatPhysicsDetails", rect); + params.name("phys detail view"); + params.show_label(true); + params.label("Physics Details"); + params.setting("OpenDebugStatPhysicsDetails"); + params.rect(rect); + LLStatView *phys_details_viewp = sim_statviewp->addStatView(params); stat_barp = phys_details_viewp->addStat("Pinned Objects", &(LLViewerStats::getInstance()->mPhysicsPinnedTasks), "DebugStatModePinnedObjects"); stat_barp->mPrecision = 0; @@ -439,7 +471,12 @@ void LLFloaterStats::buildStats() stat_barp->mPerSec = FALSE; stat_barp->mDisplayMean = FALSE; - LLStatView *pathfinding_viewp = sim_statviewp->addStatView("pathfinding view", "Pathfinding Details", std::string(), rect); + params.name("pathfinding view"); + params.show_label(true); + params.label("Pathfinding Details"); + params.rect(rect); + LLStatView *pathfinding_viewp = sim_statviewp->addStatView(params); + stat_barp = pathfinding_viewp->addStat("AI Step Time", &(LLViewerStats::getInstance()->mSimSimAIStepMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 3; @@ -516,7 +553,12 @@ void LLFloaterStats::buildStats() stat_barp->mPerSec = FALSE; stat_barp->mDisplayMean = FALSE; - LLStatView *sim_time_viewp = sim_statviewp->addStatView("sim perf view", "Time (ms)", "OpenDebugStatSimTime", rect); + params.name("sim perf view"); + params.show_label(true); + params.label("Time (ms)"); + params.setting("OpenDebugStatSimTime"); + params.rect(rect); + LLStatView *sim_time_viewp = sim_statviewp->addStatView(params); stat_barp = sim_time_viewp->addStat("Total Frame Time", &(LLViewerStats::getInstance()->mSimFrameMsec), "DebugStatModeSimFrameMsec"); stat_barp->setUnitLabel("ms"); @@ -600,7 +642,12 @@ void LLFloaterStats::buildStats() // 2nd level time blocks under 'Details' second - LLStatView *detailed_time_viewp = sim_time_viewp->addStatView("sim perf view", "Time Details (ms)", "OpenDebugStatSimTimeDetails", rect); + params.name("sim perf view"); + params.show_label(true); + params.label("Time (ms)"); + params.setting("OpenDebugStatSimTimeDetails"); + params.rect(rect); + LLStatView *detailed_time_viewp = sim_time_viewp->addStatView(params); { stat_barp = detailed_time_viewp->addStat(" Physics Step", &(LLViewerStats::getInstance()->mSimSimPhysicsStepMsec), "DebugStatModeSimSimPhysicsStepMsec"); stat_barp->setUnitLabel("ms"); @@ -670,12 +717,15 @@ LLFloaterStats::LLFloaterStats(const LLSD& val) LLRect stats_rect(0, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLFLOATER_CLOSE_BOX_SIZE, 0); - mStatsContainer = new LLContainerView("statistics_view", stats_rect); - mStatsContainer->showLabel(FALSE); + + LLContainerView::Params rvp; + rvp.name("statistics_view"); + rvp.rect(stats_rect); + mStatsContainer = LLUICtrlFactory::create(rvp); LLRect scroll_rect(LL_SCROLL_BORDER, getRect().getHeight() - LLFLOATER_HEADER_SIZE - LL_SCROLL_BORDER, getRect().getWidth() - LL_SCROLL_BORDER, LL_SCROLL_BORDER); - mScrollContainer = new LLScrollableContainerView(std::string("statistics_scroll"), scroll_rect, mStatsContainer); + mScrollContainer = new LLScrollContainer(std::string("statistics_scroll"), scroll_rect, mStatsContainer); mScrollContainer->setFollowsAll(); mScrollContainer->setReserveScrollCorner(TRUE); diff --git a/indra/newview/llfloaterstats.h b/indra/newview/llfloaterstats.h index 64721bda1..f1f5f04a5 100644 --- a/indra/newview/llfloaterstats.h +++ b/indra/newview/llfloaterstats.h @@ -38,7 +38,7 @@ class LLContainerView; class LLStatView; -class LLScrollableContainerView; +class LLScrollContainer; class LLFloaterStats : public LLFloater, @@ -58,7 +58,7 @@ class LLFloaterStats private: void buildStats(); LLContainerView* mStatsContainer; - LLScrollableContainerView* mScrollContainer; + LLScrollContainer* mScrollContainer; }; #endif diff --git a/indra/newview/llfloatertest.cpp b/indra/newview/llfloatertest.cpp index 83a0c6fed..22628dc09 100644 --- a/indra/newview/llfloatertest.cpp +++ b/indra/newview/llfloatertest.cpp @@ -62,15 +62,15 @@ public: LLFloaterTestImpl(); private: - static void onClickButton(void*); - static void onClickText(void*); - static void onClickTab(void*, bool); - static void onCommitCheck(LLUICtrl*, void*); - static void onCommitCombo(LLUICtrl*, void*); - static void onCommitLine(LLUICtrl*, void*); - static void onKeyLine(LLLineEditor*, void*); - static void onFocusLostLine(LLFocusableElement*, void*); - static void onChangeRadioGroup(LLUICtrl*, void*); + static void onClickButton(); + static void onClickText(); + static void onClickTab(); + static void onCommitCheck(); + static void onCommitCombo(LLUICtrl* ctrl, const LLSD& value); + static void onCommitLine(); + static void onKeyLine(); + static void onFocusLostLine(); + static void onChangeRadioGroup(); LLButton* mBtnSimple; LLButton* mBtnUnicode; @@ -83,7 +83,7 @@ private: LLRadioGroup* mRadioGroup; LLRadioCtrl* mRadio1; LLRadioCtrl* mRadio2; - LLScrollableContainerView* mScroll; + LLScrollContainer* mScroll; LLScrollListCtrl* mScrollList; LLTabContainer* mTab; LLTextEditor* mTextEditor; @@ -118,7 +118,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() btn = new LLButton(std::string("can't click"), LLRect(LEFT+150, y, LEFT+150+100, y-LINE), LLStringUtil::null, - onClickButton, this); + boost::bind(&LLFloaterTestImpl::onClickButton)); btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); btn->setFont(LLFontGL::getFontSansSerifSmall()); addChild(btn); @@ -128,7 +128,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() 50, // max_width LLFontGL::getFontSansSerifSmall(), TRUE); // mouse_opaque - text->setClickedCallback(onClickText); + text->setClickedCallback(boost::bind(&onClickText)); text->setRect(LLRect(LEFT, y, RIGHT, y-LINE)); addChild(text); @@ -137,7 +137,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() btn = new LLButton(std::string("can click"), LLRect(LEFT+150, y, LEFT+150+100, y-LINE), LLStringUtil::null, - onClickButton, this); + boost::bind(&LLFloaterTestImpl::onClickButton)); btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); btn->setFont(LLFontGL::getFontSansSerifSmall()); addChild(btn); @@ -160,7 +160,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() addChild(tab); mTab = tab; - tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab,_1,_2)); + tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab)); //----------------------------------------------------------------------- // First tab container panel @@ -194,7 +194,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() std::string("tool_zoom.tga"), std::string("tool_zoom_active.tga"), LLStringUtil::null, - onClickButton, this, + boost::bind(&LLFloaterTestImpl::onClickButton), LLFontGL::getFontSansSerifSmall()); btn->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); panel->addChild(btn); @@ -205,7 +205,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT), std::string("Simple Checkbox"), LLFontGL::getFontSansSerifSmall(), - onCommitCheck, this, + boost::bind(&LLFloaterTestImpl::onCommitCheck), TRUE, // initial_value FALSE, // radio_style std::string("UIFloaterTestBool")); // control_which @@ -217,7 +217,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT), std::string("TODO: Unicode Checkbox"), LLFontGL::getFontSansSerifSmall(), - onCommitCheck, this, + boost::bind(&LLFloaterTestImpl::onCommitCheck), TRUE, // initial_value FALSE, // radio_style LLStringUtil::null); // control_which @@ -229,7 +229,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() combo = new LLComboBox(std::string("combo"), LLRect(LEFT, y, LEFT+100, y-LLCOMBOBOX_HEIGHT), std::string("Combobox Label"), - onCommitCombo, this); + boost::bind(&LLFloaterTestImpl::onCommitCombo, _1,_2) ); combo->add(std::string("first item")); combo->add(std::string("second item")); combo->add(std::string("should go to the top"), ADD_TOP); @@ -253,10 +253,9 @@ LLFloaterTestImpl::LLFloaterTestImpl() std::string("test some unicode text here"), LLFontGL::getFontSansSerif(), 200, // max_length_bytes - onCommitLine, - onKeyLine, - onFocusLostLine, - this); + boost::bind(&LLFloaterTestImpl::onCommitLine), + boost::bind(&LLFloaterTestImpl::onKeyLine), + boost::bind(&LLFloaterTestImpl::onFocusLostLine)); line->setHandleEditKeysDirectly(true); panel->addChild(line); @@ -266,7 +265,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() std::string("radio_group"), LLRect(LEFT, y, LEFT+200, y - 50), 0, // initial_index - onChangeRadioGroup, this, + boost::bind(&LLFloaterTestImpl::onChangeRadioGroup), TRUE); // border panel->addChild(group); @@ -292,7 +291,7 @@ LLFloaterTestImpl::LLFloaterTestImpl() btn = new LLButton(std::string("Simple Button"), LLRect(LEFT, y, LEFT+100, y - 20), LLStringUtil::null, - onClickButton, this); + boost::bind(&LLFloaterTestImpl::onClickButton)); btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); panel->addChild(btn); mBtnSimple = btn; @@ -305,58 +304,56 @@ LLFloaterTestImpl::LLFloaterTestImpl() } // static -void LLFloaterTestImpl::onClickButton(void*) +void LLFloaterTestImpl::onClickButton() { llinfos << "button clicked" << llendl; } // static -void LLFloaterTestImpl::onClickText(void*) +void LLFloaterTestImpl::onClickText() { llinfos << "text clicked" << llendl; } // static -void LLFloaterTestImpl::onClickTab(void*, bool) +void LLFloaterTestImpl::onClickTab() { llinfos << "click tab" << llendl; } // static -void LLFloaterTestImpl::onCommitCheck(LLUICtrl*, void*) +void LLFloaterTestImpl::onCommitCheck() { llinfos << "commit check" << llendl; } // static -void LLFloaterTestImpl::onCommitCombo(LLUICtrl* ctrl, void*) +void LLFloaterTestImpl::onCommitCombo(LLUICtrl* ctrl, const LLSD& value) { LLComboBox* combo = (LLComboBox*)ctrl; - std::string name = combo->getSimple(); - LLSD value = combo->getValue(); - llinfos << "commit combo name " << name << " value " << value.asString() << llendl; + llinfos << "commit combo name " << combo->getSimple() << " value " << value.asString() << llendl; } // static -void LLFloaterTestImpl::onCommitLine(LLUICtrl*, void*) +void LLFloaterTestImpl::onCommitLine() { llinfos << "commit line editor" << llendl; } // static -void LLFloaterTestImpl::onKeyLine(LLLineEditor*, void*) +void LLFloaterTestImpl::onKeyLine() { llinfos << "keystroke line editor" << llendl; } // static -void LLFloaterTestImpl::onFocusLostLine(LLFocusableElement*, void*) +void LLFloaterTestImpl::onFocusLostLine() { llinfos << "focus lost line editor" << llendl; } // static -void LLFloaterTestImpl::onChangeRadioGroup(LLUICtrl*, void*) +void LLFloaterTestImpl::onChangeRadioGroup() { llinfos << "change radio group" << llendl; } diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index e737b3d56..46757f75b 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -38,9 +38,9 @@ #include "llfontgl.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llfloatergodtools.h" -#include "llfloateravatarinfo.h" #include "llnotificationsutil.h" #include "llparcel.h" #include "llscrolllistctrl.h" @@ -481,8 +481,7 @@ void LLFloaterTopObjects::onProfile(void* data) if (!list) return; LLScrollListItem* first_selected = list->getFirstSelected(); if (!first_selected) return; - LLUUID taskid = first_selected->getUUID(); - LLFloaterAvatarInfo::showFromDirectory(taskid); + LLAvatarActions::showProfile(first_selected->getUUID()); } void LLFloaterTopObjects::onKickBtn(void* data) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index fb84ee0c1..e3532cfe8 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -59,6 +59,7 @@ #include "llnotificationsutil.h" #include "llregionhandle.h" #include "llscrolllistctrl.h" +#include "llsearcheditor.h" #include "lltextbox.h" #include "lltracker.h" #include "lltrans.h" @@ -208,23 +209,22 @@ BOOL LLFloaterWorldMap::postBuild() LLComboBox *avatar_combo = getChild("friend combo"); avatar_combo->selectFirstItem(); - avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); - avatar_combo->setTextEntryCallback( onComboTextEntry ); + avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange,this) ); + avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry,this) ); mListFriendCombo = dynamic_cast(avatar_combo); - LLLineEditor *location_editor = getChild("location"); + LLSearchEditor *location_editor = getChild("location"); location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); - location_editor->setKeystrokeCallback( onSearchTextEntry ); + location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); LLScrollListCtrl* search_results = getChild("search_results"); search_results->setDoubleClickCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this)); mListSearchResults = dynamic_cast(search_results); LLComboBox *landmark_combo = getChild( "landmark combo"); - landmark_combo->selectFirstItem(); - landmark_combo->setPrearrangeCallback( onLandmarkComboPrearrange ); - landmark_combo->setTextEntryCallback( onComboTextEntry ); + landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) ); + landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListLandmarkCombo = dynamic_cast(landmark_combo); avatar_combo->setCommitCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboCommit,this) ); @@ -1078,22 +1078,20 @@ void LLFloaterWorldMap::onGoHome() } -// static -void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdata ) +void LLFloaterWorldMap::onLandmarkComboPrearrange( ) { - LLFloaterWorldMap* self = gFloaterWorldMap; - if( !self || self->mIsClosing ) + if( mIsClosing ) { return; } - - LLCtrlListInterface *list = self->childGetListInterface("landmark combo"); + + LLCtrlListInterface *list = mListLandmarkCombo; if (!list) return; - + LLUUID current_choice = list->getCurrentID(); - - gFloaterWorldMap->buildLandmarkIDLists(); - + + buildLandmarkIDLists(); + if( current_choice.isNull() || !list->setCurrentByID( current_choice ) ) { LLTracker::stopTracking(false); @@ -1101,7 +1099,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdat } -void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata ) +void LLFloaterWorldMap::onComboTextEntry() { // Reset the tracking whenever we start typing into any of the search fields, // so that hitting does an auto-complete versus teleporting us to the @@ -1109,11 +1107,10 @@ void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata ) LLTracker::stopTracking(false); } -// static -void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl, void* userdata ) +void LLFloaterWorldMap::onSearchTextEntry( ) { - onComboTextEntry(ctrl, userdata); - gFloaterWorldMap->updateSearchEnabled(); + onComboTextEntry(); + updateSearchEnabled(); } // static @@ -1164,26 +1161,25 @@ void LLFloaterWorldMap::onLandmarkComboCommit() } // static -void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata ) +void LLFloaterWorldMap::onAvatarComboPrearrange( ) { - LLFloaterWorldMap* self = gFloaterWorldMap; - if( !self || self->mIsClosing ) + if( mIsClosing ) { return; } - - LLCtrlListInterface *list = self->childGetListInterface("friend combo"); + + LLCtrlListInterface *list = mListFriendCombo; if (!list) return; - + LLUUID current_choice; - + if( LLAvatarTracker::instance().haveTrackingInfo() ) { current_choice = LLAvatarTracker::instance().getAvatarID(); } - - self->buildAvatarIDList(); - + + buildAvatarIDList(); + if( !list->setCurrentByID( current_choice ) || current_choice.isNull() ) { LLTracker::stopTracking(false); diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 47cbb025f..40ac1dcb2 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -116,14 +116,14 @@ public: protected: void onGoHome(); - static void onLandmarkComboPrearrange( LLUICtrl* ctrl, void* data ); + void onLandmarkComboPrearrange(); void onLandmarkComboCommit(); - static void onAvatarComboPrearrange( LLUICtrl* ctrl, void* data ); + void onAvatarComboPrearrange(); void onAvatarComboCommit(); - static void onComboTextEntry( LLLineEditor* ctrl, void* data ); - static void onSearchTextEntry( LLLineEditor* ctrl, void* data ); + void onComboTextEntry( ); + void onSearchTextEntry( ); void onClearBtn(); void onClickTeleportBtn(); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 8c84104f2..4b6142a39 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -235,10 +235,9 @@ LLFolderView::LLFolderView( const std::string& name, mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, getLabelFontForStyle(LLFontGL::NORMAL), DB_INV_ITEM_NAME_STR_LEN, - &LLFolderView::commitRename, + boost::bind(&LLFolderView::commitRename,this), NULL, NULL, - this, &LLLineEditor::prevalidatePrintableNotPipe); //mRenamer->setWriteableBgColor(LLColor4::white); // Escape is handled by reverting the rename, not commiting it (default behavior) @@ -897,13 +896,9 @@ BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) return can_drag; } -void LLFolderView::commitRename( LLUICtrl* renamer, void* user_data ) +void LLFolderView::commitRename( ) { - LLFolderView* root = reinterpret_cast(user_data); - if( root ) - { - root->finishRenamingItem(); - } + finishRenamingItem(); } void LLFolderView::draw() @@ -2067,7 +2062,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr } } -void LLFolderView::setScrollContainer(LLScrollableContainerView* parent) +void LLFolderView::setScrollContainer(LLScrollContainer* parent) { mScrollContainer = parent; parent->setPassBackToChildren(false); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index c2771ed77..f441e8995 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -60,7 +60,7 @@ class LLInventoryModel; class LLPanel; class LLLineEditor; class LLMenuGL; -class LLScrollableContainerView; +class LLScrollContainer; class LLUICtrl; class LLTextBox; @@ -217,7 +217,7 @@ public: void scrollToShowSelection(); void scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect); - void setScrollContainer(LLScrollableContainerView* parent); + void setScrollContainer(LLScrollContainer* parent); LLRect getVisibleRect(); BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); @@ -258,9 +258,9 @@ private: void updateRenamerPosition(); protected: - LLScrollableContainerView* mScrollContainer; // NULL if this is not a child of a scroll container. + LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container. - static void commitRename( LLUICtrl* renamer, void* user_data ); + void commitRename( ); void onRenamerLost(); void finishRenamingItem( void ); diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 575957476..33a78838d 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -93,7 +93,7 @@ LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ) : - LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT), + LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT), mLabelWidth(0), mLabelWidthDirty(false), mParentFolder( NULL ), diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index 09f690cf0..25885e68f 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -320,6 +320,20 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im { gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); } +// [RLVa:KB] - Checked: 2010-05-26 (RLVa-1.2.2a) | Modified: RLVa-1.2.0h + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(to_agent)) && + (!RlvUIEnabler::hasOpenProfile(to_agent)) ) + { + // Log to chat history if the user didn't drop on an IM session or a profile to avoid revealing the name of the recipient + std::string strMsgName = "inventory_item_offered"; LLSD args; LLAvatarName avName; + if (LLAvatarNameCache::get(to_agent, &avName)) + { + args["NAME"] = RlvStrings::getAnonym(avName); + strMsgName = "inventory_item_offered_rlv"; + } + gIMMgr->addSystemMessage(LLUUID::null, strMsgName, args); + } +// [/RLVa:KB] // If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat. else if (gIMMgr->isIMSessionOpen(session_id)) { diff --git a/indra/newview/llgivemoney.cpp b/indra/newview/llgivemoney.cpp index 93865f444..6816c378a 100644 --- a/indra/newview/llgivemoney.cpp +++ b/indra/newview/llgivemoney.cpp @@ -54,24 +54,11 @@ #include "hippogridmanager.h" +#include ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLGiveMoneyInfo -// -// A small class used to track callback information -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -struct LLGiveMoneyInfo -{ - LLFloaterPay* mFloater; - S32 mAmount; - LLGiveMoneyInfo(LLFloaterPay* floater, S32 amount) : - mFloater(floater), mAmount(amount){} -}; - ///---------------------------------------------------------------------------- /// Class LLFloaterPay ///---------------------------------------------------------------------------- @@ -88,13 +75,19 @@ LLFloaterPay::LLFloaterPay(const std::string& name, LLFloater(name, std::string("FloaterPayRectB"), LLStringUtil::null, RESIZE_NO, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), - mCallbackData(), mCallback(callback), mObjectNameText(NULL), mTargetUUID(uuid), mTargetIsObject(target_is_object), - mTargetIsGroup(FALSE) + mTargetIsGroup(FALSE), + mDefaultValue(0) { + mQuickPayInfo[0] = PAY_BUTTON_DEFAULT_0; + mQuickPayInfo[1] = PAY_BUTTON_DEFAULT_1; + mQuickPayInfo[2] = PAY_BUTTON_DEFAULT_2; + mQuickPayInfo[3] = PAY_BUTTON_DEFAULT_3; + BOOST_STATIC_ASSERT(MAX_PAY_BUTTONS == 4); + if (target_is_object) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_pay_object.xml"); @@ -105,55 +98,14 @@ LLFloaterPay::LLFloaterPay(const std::string& name, LLUICtrlFactory::getInstance()->buildFloater(this,"floater_pay.xml"); } - - S32 i =0; + for(U32 i = 0; i < MAX_PAY_BUTTONS; ++i) + { + mQuickPayButton[i] = getChild("fastpay " + boost::lexical_cast(mQuickPayInfo[i])); + mQuickPayButton[i]->setClickedCallback(boost::bind(&LLFloaterPay::onGive,this,boost::ref(mQuickPayInfo[i]))); + mQuickPayButton[i]->setVisible(FALSE); + mQuickPayButton[i]->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); + } - LLGiveMoneyInfo* info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_0); - mCallbackData.push_back(info); - - childSetAction("fastpay 1",&LLFloaterPay::onGive,info); - childSetVisible("fastpay 1", FALSE); - childSetLabelArg("fastpay 1", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); - - - mQuickPayButton[i] = getChild("fastpay 1"); - mQuickPayInfo[i] = info; - ++i; - - info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_1); - mCallbackData.push_back(info); - - childSetAction("fastpay 5",&LLFloaterPay::onGive,info); - childSetVisible("fastpay 5", FALSE); - childSetLabelArg("fastpay 5", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); - - mQuickPayButton[i] = getChild("fastpay 5"); - mQuickPayInfo[i] = info; - ++i; - - info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_2); - mCallbackData.push_back(info); - - childSetAction("fastpay 10",&LLFloaterPay::onGive,info); - childSetVisible("fastpay 10", FALSE); - childSetLabelArg("fastpay 10", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); - - mQuickPayButton[i] = getChild("fastpay 10"); - mQuickPayInfo[i] = info; - ++i; - - info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_3); - mCallbackData.push_back(info); - - childSetAction("fastpay 20",&LLFloaterPay::onGive,info); - childSetVisible("fastpay 20", FALSE); - childSetLabelArg("fastpay 20", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); - - mQuickPayButton[i] = getChild("fastpay 20"); - mQuickPayInfo[i] = info; - ++i; - - childSetVisible("amount text", FALSE); std::string last_amount; @@ -162,21 +114,20 @@ LLFloaterPay::LLFloaterPay(const std::string& name, last_amount = llformat("%d", sLastAmount); } - childSetVisible("amount", FALSE); - - childSetKeystrokeCallback("amount", &LLFloaterPay::onKeystroke, this); - childSetText("amount", last_amount); - childSetPrevalidate("amount", LLLineEditor::prevalidateNonNegativeS32); + LLLineEditor* amount = getChild("amount"); + amount->setVisible(false); + amount->setKeystrokeCallback(boost::bind(&LLFloaterPay::onKeystroke, this, _1)); + amount->setText(last_amount); + amount->setPrevalidate(&LLLineEditor::prevalidateNonNegativeS32); - info = new LLGiveMoneyInfo(this, 0); - mCallbackData.push_back(info); - childSetAction("pay btn",&LLFloaterPay::onGive,info); - setDefaultBtn("pay btn"); - childSetVisible("pay btn", FALSE); - childSetEnabled("pay btn", (sLastAmount > 0)); + LLButton* pay_btn = getChild("pay btn"); + pay_btn->setClickedCallback(boost::bind(&LLFloaterPay::onGive,this,boost::ref(mDefaultValue))); + setDefaultBtn(pay_btn); + pay_btn->setVisible(false); + pay_btn->setEnabled(sLastAmount > 0); - childSetAction("cancel btn",&LLFloaterPay::onCancel,this); + getChild("cancel btn")->setClickedCallback(boost::bind(&LLFloaterPay::onCancel,this)); center(); open(); /*Flawfinder: ignore*/ @@ -185,7 +136,6 @@ LLFloaterPay::LLFloaterPay(const std::string& name, // Destroys the object LLFloaterPay::~LLFloaterPay() { - std::for_each(mCallbackData.begin(), mCallbackData.end(), DeletePointer()); } // static @@ -250,7 +200,7 @@ void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata) self->mQuickPayButton[i]->setLabelSelected(button_str); self->mQuickPayButton[i]->setLabelUnselected(button_str); self->mQuickPayButton[i]->setVisible(TRUE); - self->mQuickPayInfo[i]->mAmount = pay_button; + self->mQuickPayInfo[i] = pay_button; self->childSetVisible("fastpay text",TRUE); if ( pay_button > max_pay_amount ) @@ -397,51 +347,34 @@ void LLFloaterPay::onCacheOwnerName(const LLUUID& owner_id, const std::string& full_name, bool is_group) { - if (is_group) + if (LLView* view = findChild("payee_group")) { - childSetVisible("payee_group",true); - childSetVisible("payee_resident",false); + view->setVisible(is_group); } - else + if (LLView* view = findChild("payee_resident")) { - childSetVisible("payee_group",false); - childSetVisible("payee_resident",true); + view->setVisible(!is_group); } - + childSetTextArg("payee_name", "[NAME]", full_name); } -// static -void LLFloaterPay::onCancel(void* data) +void LLFloaterPay::onCancel() { - LLFloaterPay* self = reinterpret_cast(data); - if(self) - { - self->close(); - } + close(); } -// static -void LLFloaterPay::onKeystroke(LLLineEditor*, void* data) +void LLFloaterPay::onKeystroke(LLLineEditor* caller) { - LLFloaterPay* self = reinterpret_cast(data); - if(self) - { - // enable the Pay button when amount is non-empty and positive, disable otherwise - std::string amtstr = self->childGetText("amount"); - self->childSetEnabled("pay btn", !amtstr.empty() && atoi(amtstr.c_str()) > 0); - } + // enable the Pay button when amount is non-empty and positive, disable otherwise + std::string amtstr = caller->getValue().asString(); + childSetEnabled("pay btn", !amtstr.empty() && atoi(amtstr.c_str()) > 0); } -// static -void LLFloaterPay::onGive(void* data) +void LLFloaterPay::onGive(const S32& amount) { - LLGiveMoneyInfo* info = reinterpret_cast(data); - if(info && info->mFloater) - { - info->mFloater->give(info->mAmount); - info->mFloater->close(); - } + give(amount); + close(); } void LLFloaterPay::give(S32 amount) diff --git a/indra/newview/llgivemoney.h b/indra/newview/llgivemoney.h index b598b3cd7..540d0dade 100644 --- a/indra/newview/llgivemoney.h +++ b/indra/newview/llgivemoney.h @@ -46,7 +46,6 @@ class LLLineEditor; class LLTextBox; class LLButton; class LLObjectSelection; -struct LLGiveMoneyInfo; typedef void (*money_callback)(const LLUUID&, LLViewerRegion*,S32,BOOL,S32,const std::string&); @@ -72,16 +71,15 @@ public: BOOL is_group); private: - static void onCancel(void* data); - static void onKeystroke(LLLineEditor* editor, void* data); - static void onGive(void* data); + void onCancel(); + void onKeystroke(LLLineEditor* caller); + void onGive(const S32& amount); void give(S32 amount); static void processPayPriceReply(LLMessageSystem* msg, void **userdata); void onCacheOwnerName( const LLUUID& owner_id, const std::string& full_name, bool is_group); void finishPayUI(const LLUUID& target_id, BOOL is_group); protected: - std::vector mCallbackData; money_callback mCallback; LLTextBox* mObjectNameText; LLUUID mTargetUUID; @@ -90,7 +88,8 @@ protected: BOOL mHaveName; LLButton* mQuickPayButton[MAX_PAY_BUTTONS]; - LLGiveMoneyInfo* mQuickPayInfo[MAX_PAY_BUTTONS]; + S32 mQuickPayInfo[MAX_PAY_BUTTONS]; + S32 mDefaultValue; LLSafeHandle mObjectSelection; diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp new file mode 100644 index 000000000..5efe05ccc --- /dev/null +++ b/indra/newview/llgroupactions.cpp @@ -0,0 +1,505 @@ +/** + * @file llgroupactions.cpp + * @brief Group-related actions (join, leave, new, delete, etc) + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llgroupactions.h" + +#include "llagent.h" +#include "llcommandhandler.h" +#include "llfloaterchatterbox.h" // for LLFloaterMyFriends +#include "llfloaterdirectory.h" +#include "llfloatergroupinfo.h" +#include "llgroupmgr.h" +#include "llimview.h" // for gIMMgr +#include "llnotificationsutil.h" +#include "llpanelgroup.h" +#include "llviewermessage.h" +#include "groupchatlistener.h" +#include "hippolimits.h" // for getMaxAgentGroups +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0f) +//#include "llslurl.h" +#include "rlvhandler.h" +// [/RLVa:KB] + +// +// Globals +// +static GroupChatListener sGroupChatListener; + +class LLGroupHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLGroupHandler() : LLCommandHandler("group", true/*UNTRUSTED_THROTTLE*/) { } + bool handle(const LLSD& tokens, const LLSD& query_map, + LLMediaCtrl* web) + { + /*if (!LLUI::sSettingGroups["config"]->getBOOL("EnableGroupInfo")) + { + LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); + return true; + }*/ + + if (tokens.size() < 1) + { + return false; + } + + if (tokens[0].asString() == "create") + { + LLGroupActions::createGroup(); + return true; + } + + if (tokens.size() < 2) + { + return false; + } + + if (tokens[0].asString() == "list") + { + if (tokens[1].asString() == "show") + { + // CP_TODO: get the value we pass in via the XUI name + // of the tab instead of using a literal like this + LLFloaterMyFriends::showInstance( 1 ); + + return true; + } + return false; + } + + LLUUID group_id; + if (!group_id.set(tokens[0], FALSE)) + { + return false; + } + + if (tokens[1].asString() == "about") + { + if (group_id.isNull()) + return true; + + LLGroupActions::show(group_id); + + return true; + } + if (tokens[1].asString() == "inspect") + { + if (group_id.isNull()) + return true; + LLGroupActions::inspect(group_id); + return true; + } + return false; + } +}; +LLGroupHandler gGroupHandler; + +// static +void LLGroupActions::search() +{ + //LLFloaterReg::showInstance("search", LLSD().with("category", "groups")); + LLFloaterDirectory::showGroups(); +} + +/* Singu TODO: Voice refactor +// static +void LLGroupActions::startCall(const LLUUID& group_id) +{ + // create a new group voice session + LLGroupData gdata; + + if (!gAgent.getGroupData(group_id, gdata)) + { + llwarns << "Error getting group data" << llendl; + return; + } + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); + return; + } +// [/RLVa:KB] + + LLUUID session_id = gIMMgr->addSession(gdata.mName, IM_SESSION_GROUP_START, group_id, true); + if (session_id.isNull()) + { + llwarns << "Error adding session" << llendl; + return; + } + + // start the call + gIMMgr->autoStartCallOnStartup(session_id); + + make_ui_sound("UISndStartIM"); +} +*/ + +// static +void LLGroupActions::join(const LLUUID& group_id) +{ + if (gAgent.mGroups.count() >= gHippoLimits->getMaxAgentGroups()) //!gAgent.canJoinGroups() + { + LLNotificationsUtil::add("JoinedTooManyGroups"); + return; + } + + LLGroupMgrGroupData* gdatap = + LLGroupMgr::getInstance()->getGroupData(group_id); + + if (gdatap) + { + S32 cost = gdatap->mMembershipFee; + LLSD args; + args["COST"] = llformat("%d", cost); + args["NAME"] = gdatap->mName; + LLSD payload; + payload["group_id"] = group_id; + + if (can_afford_transaction(cost)) + { + if(cost > 0) + LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, onJoinGroup); + else + LLNotificationsUtil::add("JoinGroupNoCost", args, payload, onJoinGroup); + } + else + { + LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload); + } + } + else + { + llwarns << "LLGroupMgr::getInstance()->getGroupData(" << group_id + << ") was NULL" << llendl; + } +} + +// static +bool LLGroupActions::onJoinGroup(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 1) + { + // user clicked cancel + return false; + } + + LLGroupMgr::getInstance()-> + sendGroupMemberJoin(notification["payload"]["group_id"].asUUID()); + return false; +} + +// static +void LLGroupActions::leave(const LLUUID& group_id) +{ +// if (group_id.isNull()) +// return; +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f + if ( (group_id.isNull()) || ((gAgent.getGroupID() == group_id) && (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP))) ) + return; +// [/RLVa:KB] + + S32 count = gAgent.mGroups.count(); + S32 i; + for (i = 0; i < count; ++i) + { + if(gAgent.mGroups.get(i).mID == group_id) + break; + } + if (i < count) + { + LLSD args; + args["GROUP"] = gAgent.mGroups.get(i).mName; + LLSD payload; + payload["group_id"] = group_id; + LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup); + } +} + +// static +void LLGroupActions::activate(const LLUUID& group_id) +{ +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP)) && (gRlvHandler.getAgentGroup() != group_id) ) + { + return; + } +// [/RLVa:KB] + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ActivateGroup); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_GroupID, group_id); + gAgent.sendReliableMessage(); +} + +/* Singu Note: this function serves no purpose to us, it is here as an honorable mention +static bool isGroupUIVisible() +{ + static LLPanel* panel = 0; + if(!panel) + panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray"); + if(!panel) + return false; + return panel->isInVisibleChain(); +} +*/ + +// static +void LLGroupActions::inspect(const LLUUID& group_id) +{ + //LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id)); + openGroupProfile(group_id); +} + + +// static +void LLGroupActions::show(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + /* + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + openGroupProfile(group_id); +} + +// static +void LLGroupActions::showTab(const LLUUID& group_id, const std::string& tab_name) +{ + if (group_id.isNull()) return; + + openGroupProfile(group_id)->selectTabByName(tab_name); +} + +// static +void LLGroupActions::showNotice(const std::string& subj, const std::string& mes, const LLUUID& group_id, const bool& has_inventory, const std::string& item_name, LLOfferInfo* info) +{ + if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id)) + { + fgi->mPanelGroupp->showNotice(subj, mes, has_inventory, item_name, info); + } + else + { + // We need to clean up that inventory offer. + if (info) + { + info->forceResponse(IOR_DECLINE); + } + } +} + +/* Singu Note: How could this ever work with a null id, it's only used by llnotificationgrouphandler.cpp which we don't have +void LLGroupActions::refresh_notices() +{ + if(!isGroupUIVisible()) + return; + + LLSD params; + params["group_id"] = LLUUID::null; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "refresh_notices"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); +} +*/ + +//static +void LLGroupActions::refresh(const LLUUID& group_id) +{ + /* + if(!isGroupUIVisible()) + return; + + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "refresh"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id)) + if (LLPanelGroup* pg = fgi->mPanelGroupp) + pg->refreshData(); +} + +//static +void LLGroupActions::createGroup() +{ + /* + LLSD params; + params["group_id"] = LLUUID::null; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "create"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + openGroupProfile(LLUUID::null); +} +//static +void LLGroupActions::closeGroup(const LLUUID& group_id) +{ + /* + if(!isGroupUIVisible()) + return; + + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "close"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id)) + fgi->close(); +} + + +// static +LLUUID LLGroupActions::startIM(const LLUUID& group_id) +{ + if (group_id.isNull()) return LLUUID::null; + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", group_id/*LLSLURL("group", group_id, "about").getSLURLString()*/)); + return LLUUID::null; + } +// [/RLVa:KB] + + LLGroupData group_data; + if (gAgent.getGroupData(group_id, group_data)) + { + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(TRUE); + LLUUID session_id = gIMMgr->addSession( + group_data.mName, + IM_SESSION_GROUP_START, + group_id); + make_ui_sound("UISndStartIM"); + return session_id; + } + else + { + // this should never happen, as starting a group IM session + // relies on you belonging to the group and hence having the group data + make_ui_sound("UISndInvalidOp"); + return LLUUID::null; + } +} + +// static +void LLGroupActions::endIM(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id); + if (session_id.notNull()) + { + gIMMgr->removeSession(session_id); + } +} + +// static +bool LLGroupActions::isInGroup(const LLUUID& group_id) +{ + // *TODO: Move all the LLAgent group stuff into another class, such as + // this one. + return gAgent.isInGroup(group_id); +} + +// static +bool LLGroupActions::isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id) +{ + if(group_id.isNull() || avatar_id.isNull()) + { + return false; + } + + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id); + if(!group_data) + { + return false; + } + + if(group_data->mMembers.end() == group_data->mMembers.find(avatar_id)) + { + return false; + } + + return true; +} + +//-- Private methods ---------------------------------------------------------- + +// static +bool LLGroupActions::onLeaveGroup(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLUUID group_id = notification["payload"]["group_id"].asUUID(); + if(option == 0) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_LeaveGroupRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_GroupData); + msg->addUUIDFast(_PREHASH_GroupID, group_id); + gAgent.sendReliableMessage(); + } + return false; +} + +// Singu helper function, open a profile and center it +// static +LLFloaterGroupInfo* LLGroupActions::openGroupProfile(const LLUUID& group_id) +{ + LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id); + if (!fgi) fgi = new LLFloaterGroupInfo(group_id); + fgi->center(); + fgi->open(); + return fgi; +} + diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h new file mode 100644 index 000000000..bba06890e --- /dev/null +++ b/indra/newview/llgroupactions.h @@ -0,0 +1,131 @@ +/** + * @file llgroupactions.h + * @brief Group-related actions (join, leave, new, delete, etc) + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLGROUPACTIONS_H +#define LL_LLGROUPACTIONS_H + +class LLFloaterGroupInfo; +struct LLOfferInfo; + +/** + * Group-related actions (join, leave, new, delete, etc) + */ +class LLGroupActions +{ +public: + /** + * Invokes group search floater. + */ + static void search(); + + /// Join a group. Assumes LLGroupMgr has data for that group already. + static void join(const LLUUID& group_id); + + /** + * Invokes "Leave Group" floater. + */ + static void leave(const LLUUID& group_id); + + /** + * Activate group. + */ + static void activate(const LLUUID& group_id); + + /** + * Show group information panel. + */ + static void show(const LLUUID& group_id); + + /** + * Show group information panel, with specific tab open. + */ + static void showTab(const LLUUID& group_id, const std::string& tab_name); + + /** + * Show group notice that has come in. + */ + static void showNotice(const std::string& subj, const std::string& mes, const LLUUID& group_id, const bool& has_inventory, const std::string& item_name, LLOfferInfo* info); + + /** + * Show group inspector floater. + */ + static void inspect(const LLUUID& group_id); + + /** + * Refresh group information panel. + */ + static void refresh(const LLUUID& group_id); + + /** + * Refresh group notices panel. + */ + static void refresh_notices(); + + /** + * Refresh group information panel. + */ + static void createGroup(); + + /** + * Close group information panel. + */ + static void closeGroup(const LLUUID& group_id); + + /** + * Start group instant messaging session. + */ + static LLUUID startIM(const LLUUID& group_id); + + /** + * End group instant messaging session. + */ + static void endIM(const LLUUID& group_id); + + /// Returns if the current user is a member of the group + static bool isInGroup(const LLUUID& group_id); + + /** + * Start a group voice call. + */ + static void startCall(const LLUUID& group_id); + + /** + * Returns true if avatar is in group. + * + * Note that data about group members is loaded from server. + * If data has not been loaded yet, function will return inaccurate result. + * See LLGroupMgr::sendGroupMembersRequest + */ + static bool isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id); + +private: + static bool onJoinGroup(const LLSD& notification, const LLSD& response); + static bool onLeaveGroup(const LLSD& notification, const LLSD& response); + static LLFloaterGroupInfo* openGroupProfile(const LLUUID& group_id); +}; + +#endif // LL_LLGROUPACTIONS_H + diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index ea0014b1b..70eddbcdc 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -44,11 +44,10 @@ #include "lltransactiontypes.h" #include "llstatusbar.h" #include "lleconomy.h" -#include "llviewercontrol.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llfloaterdirectory.h" -#include "llfloatergroupinfo.h" +#include "llgroupactions.h" #include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "lltrans.h" @@ -66,7 +65,7 @@ #pragma warning(pop) // Restore all warnings to the previous state #endif -const U32 MAX_CACHED_GROUPS = 10; +const U32 MAX_CACHED_GROUPS = 20; // // LLRoleActionSet @@ -236,8 +235,15 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) : mRoleDataComplete(FALSE), mRoleMemberDataComplete(FALSE), mGroupPropertiesDataComplete(FALSE), - mPendingRoleMemberRequest(FALSE) + mPendingRoleMemberRequest(FALSE), + mAccessTime(0.0f) { + mMemberVersion.generate(); +} + +void LLGroupMgrGroupData::setAccessed() +{ + mAccessTime = (F32)LLFrameTimer::getTotalSeconds(); } BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data) @@ -419,6 +425,7 @@ void LLGroupMgrGroupData::removeMemberData() } mMembers.clear(); mMemberDataComplete = FALSE; + mMemberVersion.generate(); } void LLGroupMgrGroupData::removeRoleData() @@ -947,7 +954,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) LLUUID request_id; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id); - LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mMemberRequestID != request_id)) { llwarns << "processGroupMembersReply: Received incorrect (stale?) group or request id" << llendl; @@ -1017,6 +1024,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) } } + group_datap->mMemberVersion.generate(); + if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount) { group_datap->mMemberDataComplete = TRUE; @@ -1118,7 +1127,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) LLUUID request_id; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id); - LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mRoleDataRequestID != request_id)) { llwarns << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << llendl; @@ -1207,7 +1216,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) U32 total_pairs; msg->getU32(_PREHASH_AgentData, "TotalPairs", total_pairs); - LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mRoleMembersRequestID != request_id)) { llwarns << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << llendl; @@ -1311,7 +1320,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) LLUUID request_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id); - LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mTitlesRequestID != request_id)) { llwarns << "processGroupTitlesReply: Received incorrect (stale?) group" << llendl; @@ -1351,7 +1360,7 @@ void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data // If we had a failure, the group panel needs to be updated. if (!success) { - LLFloaterGroupInfo::refreshGroup(group_id); + LLGroupActions::refresh(group_id); } } @@ -1371,7 +1380,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) LLGroupMgr::getInstance()->clearGroupData(group_id); // refresh the floater for this group, if any. - LLFloaterGroupInfo::refreshGroup(group_id); + LLGroupActions::refresh(group_id); // refresh the group panel of the search window, if necessary. LLFloaterDirectory::refreshGroup(group_id); } @@ -1393,7 +1402,7 @@ void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. - LLFloaterGroupInfo::closeGroup(group_id); + LLGroupActions::closeGroup(group_id); // refresh the group panel of the search window, if necessary. LLFloaterDirectory::refreshGroup(group_id); } @@ -1429,8 +1438,8 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) gAgent.mGroups.push_back(gd); - LLFloaterGroupInfo::closeCreateGroup(); - LLFloaterGroupInfo::showFromUUID(group_id,"roles_tab"); + LLGroupActions::closeGroup(LLUUID::null); + LLGroupActions::showTab(group_id, "roles_tab"); } else { @@ -1443,7 +1452,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id) { - LLGroupMgrGroupData* group_datap; + LLGroupMgrGroupData* group_datap = NULL; group_map_t::iterator existing_group = LLGroupMgr::getInstance()->mGroups.find(id); if (existing_group == LLGroupMgr::getInstance()->mGroups.end()) @@ -1456,6 +1465,11 @@ LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id) group_datap = existing_group->second; } + if (group_datap) + { + group_datap->setAccessed(); + } + return group_datap; } @@ -1496,25 +1510,41 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc) void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap) { - if (mGroups.size() > MAX_CACHED_GROUPS) + while (mGroups.size() >= MAX_CACHED_GROUPS) { - // get rid of groups that aren't observed - for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end() && mGroups.size() > MAX_CACHED_GROUPS / 2; ) + // LRU: Remove the oldest un-observed group from cache until group size is small enough + + F32 oldest_access = LLFrameTimer::getTotalSeconds(); + group_map_t::iterator oldest_gi = mGroups.end(); + + for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi ) { observer_multimap_t::iterator oi = mObservers.find(gi->first); if (oi == mObservers.end()) { - // not observed - LLGroupMgrGroupData* unobserved_groupp = gi->second; - delete unobserved_groupp; - mGroups.erase(gi++); - } - else - { - ++gi; + if (gi->second + && (gi->second->getAccessTime() < oldest_access)) + { + oldest_access = gi->second->getAccessTime(); + oldest_gi = gi; + } } } + + if (oldest_gi != mGroups.end()) + { + delete oldest_gi->second; + mGroups.erase(oldest_gi); + } + else + { + // All groups must be currently open, none to remove. + // Just add the new group anyway, but get out of this loop as it + // will never drop below max_cached_groups. + break; + } } + mGroups[group_datap->getID()] = group_datap; } @@ -1886,6 +1916,8 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, { gAgent.sendReliableMessage(); } + + group_datap->mMemberVersion.generate(); } @@ -2047,8 +2079,10 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) group_datap->mMembers[member_id] = data; } + group_datap->mMemberVersion.generate(); + // Technically, we have this data, but to prevent completely overhauling - // this entire system (it would be nice, but I don't have the time), + // this entire system (it would be nice, but I don't have the time), // I'm going to be dumb and just call services I most likely don't need // with the thought being that the system might need it to be done. // diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 6a18add68..5a40d3a2e 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -86,7 +86,7 @@ public: BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); } -protected: +private: LLUUID mID; S32 mContribution; U64 mAgentPowers; @@ -233,6 +233,10 @@ public: BOOL isRoleMemberDataComplete() { return mRoleMemberDataComplete; } BOOL isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; } + F32 getAccessTime() const { return mAccessTime; } + void setAccessed(); + + const LLUUID& getMemberVersion() const { return mMemberVersion; } public: typedef std::map member_list_t; typedef std::map role_list_t; @@ -279,6 +283,10 @@ private: BOOL mGroupPropertiesDataComplete; BOOL mPendingRoleMemberRequest; + F32 mAccessTime; + + // Generate a new ID every time mMembers + LLUUID mMemberVersion; }; struct LLRoleAction diff --git a/indra/newview/llgroupnotify.cpp b/indra/newview/llgroupnotify.cpp index 46f368300..ca9c834f8 100644 --- a/indra/newview/llgroupnotify.cpp +++ b/indra/newview/llgroupnotify.cpp @@ -39,13 +39,13 @@ #include "llbutton.h" #include "lliconctrl.h" #include "llfloaterchat.h" // for add_chat_history() +#include "llgroupactions.h" #include "llnotify.h" #include "lltextbox.h" #include "llviewertexteditor.h" #include "lluiconstants.h" #include "llui.h" #include "llviewercontrol.h" -#include "llfloatergroupinfo.h" #include "llinventoryicon.h" #include "llinventory.h" #include "lltrans.h" @@ -250,8 +250,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, - onClickNext, - this, + boost::bind(&LLGroupNotifyBox::onClickNext, this), LLFontGL::getFontSansSerif()); btn->setToolTip(LLTrans::getString("next")); btn->setScaleImage(TRUE); @@ -268,7 +267,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, btn_width, BTN_HEIGHT); - btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, onClickOk, this); + btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickOk,this)); addChild(btn, -1); setDefaultBtn(btn); @@ -280,7 +279,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, wide_btn_width, BTN_HEIGHT); - btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); + btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(LLGroupActions::showTab, mGroupID, "notices_tab")); btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); addChild(btn, -1); @@ -302,7 +301,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, { btn_lbl = LLTrans::getString("GroupNotifySaveAttachment"); } - mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); + mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickSaveInventory,this)); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } @@ -453,41 +452,23 @@ LLRect LLGroupNotifyBox::getGroupNotifyRect() } -// static -void LLGroupNotifyBox::onClickOk(void* data) +void LLGroupNotifyBox::onClickOk() { - LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; - if (self) self->close(); + close(); } -void LLGroupNotifyBox::onClickGroupInfo(void* data) +void LLGroupNotifyBox::onClickSaveInventory() { - LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; + mInventoryOffer->forceResponse(IOR_ACCEPT); - if (self) - { - LLFloaterGroupInfo::showFromUUID(self->mGroupID, "notices_tab"); - } - - //Leave notice open until explicitly closed -} - -void LLGroupNotifyBox::onClickSaveInventory(void* data) -{ - LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; - - self->mInventoryOffer->forceResponse(IOR_ACCEPT); - - self->mInventoryOffer = NULL; - self->mHasInventory = FALSE; + mInventoryOffer = NULL; + mHasInventory = FALSE; // Each item can only be received once, so disable the button. - self->mSaveInventoryBtn->setEnabled(FALSE); + mSaveInventoryBtn->setEnabled(FALSE); } -// static -void LLGroupNotifyBox::onClickNext(void* data) +void LLGroupNotifyBox::onClickNext() { - LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; - self->moveToBack(); + moveToBack(); } diff --git a/indra/newview/llgroupnotify.h b/indra/newview/llgroupnotify.h index 7eac922ed..bd19ccd89 100644 --- a/indra/newview/llgroupnotify.h +++ b/indra/newview/llgroupnotify.h @@ -89,12 +89,11 @@ protected: static LLRect getGroupNotifyRect(); // internal handler for button being clicked - static void onClickOk(void* data); - static void onClickGroupInfo(void* data); - static void onClickSaveInventory(void* data); + void onClickOk(); + void onClickSaveInventory(); // for "next" button - static void onClickNext(void* data); + void onClickNext(); private: // Are we sliding onscreen? diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index ae5dcdc45..47c968056 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -45,13 +45,13 @@ #include "llnotificationsutil.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcallingcard.h" #include "llchat.h" #include "llconsole.h" -#include "llfloater.h" +#include "llgroupactions.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatergroupinfo.h" #include "llimview.h" @@ -1349,35 +1349,32 @@ BOOL LLFloaterIMPanel::postBuild() mInputEditor = getChild("chat_editor"); mInputEditor->setFocusReceivedCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusReceived, this) ); mFocusLostSignal = mInputEditor->setFocusLostCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusLost, this) ); - mInputEditor->setKeystrokeCallback( onInputEditorKeystroke ); - mInputEditor->setCommitCallback( onCommitChat ); - mInputEditor->setCallbackUserData(this); + mInputEditor->setKeystrokeCallback( boost::bind(&LLFloaterIMPanel::onInputEditorKeystroke, this, _1) ); + mInputEditor->setCommitCallback( boost::bind(&LLFloaterIMPanel::onSendMsg,this) ); mInputEditor->setCommitOnFocusLost( FALSE ); mInputEditor->setRevertOnEsc( FALSE ); mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); + mInputEditor->setPassDelete( TRUE ); if (LLButton* btn = findChild("profile_callee_btn")) { - btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickProfile, this)); + btn->setCommitCallback(boost::bind(LLAvatarActions::showProfile, mOtherParticipantUUID)); if (!mProfileButtonEnabled) btn->setEnabled(false); } if (LLButton* btn = findChild("profile_tele_btn")) - btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickTeleport, this)); + btn->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), mOtherParticipantUUID)); if (LLButton* btn = findChild("group_info_btn")) - btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickGroupInfo, this)); + btn->setCommitCallback(boost::bind(LLGroupActions::show, mSessionUUID)); childSetAction("history_btn", onClickHistory, this); if (LLUICtrl* ctrl = findChild("rp_mode")) ctrl->setCommitCallback(boost::bind(&LLFloaterIMPanel::onRPMode, this, _2)); childSetAction("start_call_btn", onClickStartCall, this); childSetAction("end_call_btn", onClickEndCall, this); - childSetAction("send_btn", onClickSend, this); + getChild("send_btn")->setCommitCallback(boost::bind(&LLFloaterIMPanel::onSendMsg,this)); if (LLButton* btn = findChild("toggle_active_speakers_btn")) btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickToggleActiveSpeakers, this, _2)); - //LLButton* close_btn = getChild("close_btn"); - //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this); - mHistoryEditor = getChild("im_history"); mHistoryEditor->setParseHTML(TRUE); mHistoryEditor->setParseHighlights(TRUE); @@ -1746,7 +1743,7 @@ BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask ) BOOL handled = FALSE; if( KEY_RETURN == key && mask == MASK_NONE) { - sendMsg(); + onSendMsg(); handled = TRUE; // Close talk panels on hitting return @@ -1876,25 +1873,6 @@ void LLFloaterIMPanel::onTabClick(void* userdata) } -void LLFloaterIMPanel::onClickProfile() -{ - // Bring up the Profile window - if (mOtherParticipantUUID.notNull()) - { - LLFloaterAvatarInfo::showFromDirectory(mOtherParticipantUUID); - } -} - -void LLFloaterIMPanel::onClickTeleport() -{ - if (mOtherParticipantUUID.notNull()) - { - handle_lure(mOtherParticipantUUID); - //do a teleport to other part id - //LLFloaterAvatarInfo::showFromDirectory(mOtherParticipantID); - } -} - void LLFloaterIMPanel::onRPMode(const LLSD& value) { mRPMode = value.asBoolean(); @@ -1919,22 +1897,6 @@ void LLFloaterIMPanel::onClickHistory( void* userdata ) } } -void LLFloaterIMPanel::onClickGroupInfo() -{ - // Bring up the Profile window - LLFloaterGroupInfo::showFromUUID(mSessionUUID); -} - -// static -void LLFloaterIMPanel::onClickClose( void* userdata ) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - if(self) - { - self->close(); - } -} - // static void LLFloaterIMPanel::onClickStartCall(void* userdata) { @@ -1951,25 +1913,11 @@ void LLFloaterIMPanel::onClickEndCall(void* userdata) self->getVoiceChannel()->deactivate(); } -// static -void LLFloaterIMPanel::onClickSend(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - self->sendMsg(); -} - void LLFloaterIMPanel::onClickToggleActiveSpeakers(const LLSD& value) { childSetVisible("active_speakers_panel", !value); } -// static -void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata) -{ - LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; - self->sendMsg(); -} - void LLFloaterIMPanel::onInputEditorFocusReceived() { mHistoryEditor->setCursorAndScrollToEnd(); @@ -1980,19 +1928,17 @@ void LLFloaterIMPanel::onInputEditorFocusLost() setTyping(FALSE); } -// static -void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) +void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller) { - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - std::string text = self->mInputEditor->getText(); + std::string text = caller->getText(); if (!text.empty()) { - self->setTyping(TRUE); + setTyping(TRUE); } else { // Deleting all text counts as stopping typing. - self->setTyping(FALSE); + setTyping(FALSE); } } @@ -2099,7 +2045,7 @@ void deliver_message(const std::string& utf8_text, } } -void LLFloaterIMPanel::sendMsg() +void LLFloaterIMPanel::onSendMsg() { if (!gAgent.isGodlike() && (mDialog == IM_NOTHING_SPECIAL) diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index d8aac2be7..3c42228ba 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -236,19 +236,13 @@ public: void onFocusReceived(); void onInputEditorFocusReceived(); void onInputEditorFocusLost(); - static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); - static void onCommitChat(LLUICtrl* caller, void* userdata); + void onInputEditorKeystroke(LLLineEditor* caller); static void onTabClick( void* userdata ); - void onClickProfile(); static void onClickHistory( void* userdata ); void onRPMode(const LLSD& value); - void onClickTeleport(); - void onClickGroupInfo(); - static void onClickClose( void* userdata ); static void onClickStartCall( void* userdata ); static void onClickEndCall( void* userdata ); - static void onClickSend( void* userdata ); void onClickToggleActiveSpeakers(const LLSD& value); static void* createSpeakersPanel(void* data); @@ -297,7 +291,7 @@ private: void init(const std::string& session_label); // Called by UI methods. - void sendMsg(); + void onSendMsg(); // for adding agents via the UI. Return TRUE if possible, do it if BOOL dropCallingCard(LLInventoryItem* item, BOOL drop); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 64be462f7..ff46d3ab3 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -36,7 +36,6 @@ #include "llfontgl.h" #include "llrect.h" -#include "llerror.h" #include "llbutton.h" #include "llhttpclient.h" #include "llsdutil_math.h" @@ -46,6 +45,7 @@ #include "llagent.h" #include "llagentcamera.h" +#include "llavataractions.h" #include "llcallingcard.h" #include "llchat.h" #include "llresmgr.h" @@ -53,25 +53,16 @@ #include "llfloaterchatterbox.h" #include "llhttpnode.h" #include "llimpanel.h" -#include "llresizebar.h" #include "llsdserialize.h" #include "lltabcontainer.h" -#include "llviewercontrol.h" -#include "llfloater.h" #include "llmutelist.h" #include "llresizehandle.h" -#include "llkeyboard.h" -#include "llui.h" #include "llviewermenu.h" -#include "llcallingcard.h" -#include "lltoolbar.h" #include "llviewermessage.h" #include "llviewerwindow.h" #include "llnotify.h" #include "llviewerregion.h" -#include "llfirstuse.h" - // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] @@ -402,7 +393,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) EInstantMessage LLIMMgr::defaultIMTypeForAgent(const LLUUID& agent_id) { EInstantMessage type = IM_NOTHING_SPECIAL; - if(is_agent_friend(agent_id)) + if (LLAvatarActions::isFriend(agent_id)) { if(LLAvatarTracker::instance().isBuddyOnline(agent_id)) { @@ -766,7 +757,10 @@ LLUUID LLIMMgr::addSession( floater->open(); } //mTabContainer->selectTabPanel(panel); - floater->setInputFocus(TRUE); + if(gSavedSettings.getBOOL("PhoenixIMAnnounceStealFocus")) + { + floater->setInputFocus(TRUE); + } return floater->getSessionID(); } @@ -816,7 +810,10 @@ LLUUID LLIMMgr::addSession( floater->open(); } //mTabContainer->selectTabPanel(panel); - floater->setInputFocus(TRUE); + if(gSavedSettings.getBOOL("PhoenixIMAnnounceStealFocus")) + { + floater->setInputFocus(TRUE); + } return floater->getSessionID(); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 983311680..7ba3bf859 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -39,9 +39,9 @@ #include "llagentwearables.h" #include "llappearancemgr.h" #include "llattachmentsmgr.h" +#include "llavataractions.h" #include "llcallingcard.h" #include "llfirstuse.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloateropenobject.h" @@ -2896,7 +2896,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) restoreItem(); return; } -#ifndef LL_RELEASE_FOR_DOWNLOAD +#ifdef DELETE_SYSTEM_FOLDERS else if ("delete_system_folder" == action) { removeSystemFolder(); @@ -3455,7 +3455,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) mDisabledItems.push_back(std::string("Delete")); } -#ifndef LL_RELEASE_FOR_DOWNLOAD +#ifdef DELETE_SYSTEM_FOLDERS if (LLFolderType::lookupIsProtectedType(type)) { mItems.push_back(std::string("Delete System Folder")); @@ -4730,7 +4730,7 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem* item = getItem(); BOOL good_card = (item - && (LLUUID::null != item->getCreatorUUID()) + && (item->getCreatorUUID().notNull()) && (item->getCreatorUUID() != gAgent.getID())); BOOL user_online = FALSE; if (item) @@ -6441,10 +6441,9 @@ public: virtual void doIt() { LLViewerInventoryItem* item = getItem(); - if (item && item->getCreatorUUID().notNull()) + if (item) { - bool online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); - LLFloaterAvatarInfo::showFromFriend(item->getCreatorUUID(), online); + LLAvatarActions::showProfile(item->getCreatorUUID()); } LLInvFVBridgeAction::doIt(); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index b5a572c0c..1099c165d 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -409,10 +409,12 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) const LLFolderType::EType folder_type = category->getPreferredType(); +#ifndef DELETE_SYSTEM_FOLDERS if (LLFolderType::lookupIsProtectedType(folder_type)) { return FALSE; } +#endif // Can't delete the outfit that is currently being worn. if (folder_type == LLFolderType::FT_OUTFIT) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 1503e9402..21c51c25c 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -201,7 +201,7 @@ BOOL LLInventoryPanel::postBuild() // scroller LLRect scroller_view_rect = getRect(); scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); - mScroller = new LLScrollableContainerView(std::string("Inventory Scroller"), + mScroller = new LLScrollContainer(std::string("Inventory Scroller"), scroller_view_rect, mFolderRoot); mScroller->setFollowsAll(); @@ -871,8 +871,7 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) BOOL handled = LLView::handleHover(x, y, mask); if(handled) { - ECursorType cursor = getWindow()->getCursor(); - if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && cursor == UI_CURSOR_ARROW) + if (LLInventoryModelBackgroundFetch::instance().folderFetchActive()) { // replace arrow cursor with arrow and hourglass cursor getWindow()->setCursor(UI_CURSOR_WORKING); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index f1ae05685..e3d3c54f9 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -57,11 +57,10 @@ class LLInventoryFVBridgeBuilder; class LLMenuBarGL; class LLCheckBoxCtrl; class LLSpinCtrl; -class LLScrollableContainerView; +class LLScrollContainer; class LLTextBox; class LLIconCtrl; class LLSaveFolderState; -class LLSearchEditor; class LLInvPanelComplObserver; class LLInventoryPanel : public LLPanel @@ -127,7 +126,7 @@ public: // This method is called when something has changed about the inventory. void modelChanged(U32 mask); LLFolderView* getRootFolder(); - LLScrollableContainerView* getScrollableContainer() { return mScroller; } + LLScrollContainer* getScrollableContainer() { return mScroller; } void onSelectionChange(const std::deque &items, BOOL user_action); @@ -165,7 +164,7 @@ protected: BOOL mAllowMultiSelect; LLFolderView* mFolderRoot; - LLScrollableContainerView* mScroller; + LLScrollContainer* mScroller; /** * Pointer to LLInventoryFVBridgeBuilder. diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 8cd1abe58..76aa99775 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -2012,36 +2012,34 @@ LLVector3 LLManipScale::nearestAxis( const LLVector3& v ) const // Note: yes, this is a slow but easy implementation // assumes v is normalized - F32 coords[][3] = + static LLVector3 coords[] = { - { 1.f, 0.f, 0.f }, - { 0.f, 1.f, 0.f }, - { 0.f, 0.f, 1.f }, - {-1.f, 0.f, 0.f }, - { 0.f,-1.f, 0.f }, - { 0.f, 0.f,-1.f } + LLVector3( 1.f, 0.f, 0.f ), + LLVector3( 0.f, 1.f, 0.f ), + LLVector3( 0.f, 0.f, 1.f ), + LLVector3(-1.f, 0.f, 0.f ), + LLVector3( 0.f,-1.f, 0.f ), + LLVector3( 0.f, 0.f,-1.f ) }; F32 cosine[6]; - cosine[0] = v * LLVector3( coords[0] ); - cosine[1] = v * LLVector3( coords[1] ); - cosine[2] = v * LLVector3( coords[2] ); + cosine[0] = v * coords[0]; + cosine[1] = v * coords[1]; + cosine[2] = v * coords[2]; cosine[3] = -cosine[0]; cosine[4] = -cosine[1]; cosine[5] = -cosine[2]; - F32 greatest_cos = cosine[0]; S32 greatest_index = 0; for( S32 i=1; i<6; i++ ) { - if( greatest_cos < cosine[i] ) + if( cosine[greatest_index] < cosine[i] ) { - greatest_cos = cosine[i]; greatest_index = i; } } - return LLVector3( coords[greatest_index] ); + return coords[greatest_index]; } // virtual diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 620273289..17cf01b2f 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -63,7 +63,7 @@ const S32 MAX_TEXTURE_DIMENSION = 2048; static LLRegisterWidget r("web_browser"); LLMediaCtrl::LLMediaCtrl( const std::string& name, const LLRect& rect ) : - LLUICtrl( name, rect, FALSE, NULL, NULL), + LLUICtrl( name, rect, FALSE), LLInstanceTracker(LLUUID::generateNewID()), mTextureDepthBytes( 4 ), mWebBrowserImage( 0 ), @@ -718,17 +718,20 @@ void LLMediaCtrl::draw() } if(draw_media) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - if (mIgnoreUIScale) + /*if (mIgnoreUIScale) { + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + gGL.pushMatrix(); gGL.loadIdentity(); // font system stores true screen origin, need to scale this by UI scale factor // to get render origin for this view (with unit scale) gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::getScaleFactor().mV[VX]), floorf(LLFontGL::sCurOrigin.mY * LLUI::getScaleFactor().mV[VY]), LLFontGL::sCurDepth); - } + }*/ // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); @@ -776,13 +779,13 @@ void LLMediaCtrl::draw() x_offset = (r.getWidth() - width) / 2; y_offset = (r.getHeight() - height) / 2; - if (mIgnoreUIScale) + /*if (mIgnoreUIScale) { x_offset = llround((F32)x_offset * LLUI::getScaleFactor().mV[VX]); y_offset = llround((F32)y_offset * LLUI::getScaleFactor().mV[VY]); width = llround((F32)width * LLUI::getScaleFactor().mV[VX]); height = llround((F32)height * LLUI::getScaleFactor().mV[VY]); - } + }*/ // draw the browser gGL.setSceneBlendType(LLRender::BT_REPLACE); @@ -819,8 +822,13 @@ void LLMediaCtrl::draw() } gGL.end(); gGL.setSceneBlendType(LLRender::BT_ALPHA); + /*if (mIgnoreUIScale) + { + gGL.popUIMatrix(); + gGL.popMatrix(); + }*/ } - gGL.popMatrix(); + gGL.popUIMatrix(); } // highlight if keyboard focus here. (TODO: this needs some work) if ( mBorder && mBorder->getVisible() ) @@ -1370,9 +1378,9 @@ LLView* LLMediaCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory web_browser->setCaretColor( colorU.mV[0], colorU.mV[1], colorU.mV[2] ); } - BOOL ignore_ui_scale = web_browser->getIgnoreUIScale(); - node->getAttributeBOOL("ignore_ui_scale", ignore_ui_scale); - web_browser->setIgnoreUIScale((bool)ignore_ui_scale); + //BOOL ignore_ui_scale = web_browser->getIgnoreUIScale(); + //node->getAttributeBOOL("ignore_ui_scale", ignore_ui_scale); + //web_browser->setIgnoreUIScale((bool)ignore_ui_scale); web_browser->initFromXML(node, parent); diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 988496eeb..94f70d379 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -78,12 +78,6 @@ void handle_track_avatar(const LLUUID& agent_id, const std::string& name) LLFloaterWorldMap::show(true); } -void handle_pay_by_id(const LLUUID& agent_id) -{ - const BOOL is_group = FALSE; - LLFloaterPay::payDirectly(&give_money, agent_id, is_group); -} - void handle_mouselook(void*) { gAgentCamera.changeCameraToMouselook(); diff --git a/indra/newview/llmenucommands.h b/indra/newview/llmenucommands.h index 03f7a2571..1c4550b07 100644 --- a/indra/newview/llmenucommands.h +++ b/indra/newview/llmenucommands.h @@ -36,7 +36,6 @@ class LLUUID; void handle_track_avatar(const LLUUID& agent_id, const std::string& name); -void handle_pay_by_id(const LLUUID& agent_id); void handle_mouselook(void*); void handle_map(void*); void handle_mini_map(void*); diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index ef93e2602..1fac553c0 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -52,21 +52,11 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, const LLUUID& name_id, BOOL is_group, const LLFontGL* glfont, - S32 max_text_length, - void (*commit_callback)(LLUICtrl* caller, void* user_data), - void (*keystroke_callback)(LLLineEditor* caller, void* user_data), - void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data), - void* userdata, - LLLinePrevalidateFunc prevalidate_func) + S32 max_text_length) : LLLineEditor(name, rect, std::string("(retrieving)"), glfont, - max_text_length, - commit_callback, - keystroke_callback, - focus_lost_callback, - userdata, - prevalidate_func), + max_text_length), mNameID(name_id) { LLNameEditor::sInstances.insert(this); @@ -153,14 +143,11 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLFontGL* font = LLView::selectFont(node); - LLUICtrlCallback commit_callback = NULL; - LLNameEditor* line_editor = new LLNameEditor(name, rect, LLUUID::null, FALSE, font, - max_text_length, - commit_callback); + max_text_length); std::string label; if(node->getAttributeString("label", label)) diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index ca36cf7a0..6ac6e4538 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -50,12 +50,7 @@ public: const LLUUID& name_id = LLUUID::null, BOOL is_group = FALSE, const LLFontGL* glfont = NULL, - S32 max_text_length = 254, - void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, - void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, - void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data) = NULL, - void* userdata = NULL, - LLLinePrevalidateFunc prevalidate_func = NULL); + S32 max_text_length = 254); // By default, follows top and left and is mouse-opaque. // If no text, text = name. // If no font, uses default system font. diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 52fb33247..7c2b128d6 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -50,14 +50,12 @@ std::set LLNameListCtrl::sInstances; LLNameListCtrl::LLNameListCtrl(const std::string& name, const LLRect& rect, - LLUICtrlCallback cb, - void* userdata, BOOL allow_multiple_selection, BOOL draw_border, bool draw_heading, S32 name_column_index, const std::string& tooltip) -: LLScrollListCtrl(name, rect, cb, userdata, allow_multiple_selection, +: LLScrollListCtrl(name, rect, NULL, allow_multiple_selection, draw_border,draw_heading), mNameColumnIndex(name_column_index), mAllowCallingCardDrop(FALSE), @@ -339,12 +337,8 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto S32 name_column_index = 0; node->getAttributeS32("name_column_index", name_column_index); - LLUICtrlCallback callback = NULL; - LLNameListCtrl* name_list = new LLNameListCtrl(name, rect, - callback, - NULL, multi_select, draw_border, draw_heading, diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 8a4f4141d..9f672d1f1 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -52,8 +52,6 @@ public: LLNameListCtrl(const std::string& name, const LLRect& rect, - LLUICtrlCallback callback, - void* userdata, BOOL allow_multiple_selection, BOOL draw_border = TRUE, bool draw_heading = false, diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 2d206ee17..7094c67b1 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -35,8 +35,6 @@ #include "llnetmap.h" -#include "indra_constants.h" -#include "llui.h" #include "llmath.h" // clampf() #include "llfocusmgr.h" #include "lllocalcliprect.h" @@ -46,11 +44,10 @@ #include "llagent.h" #include "llagentcamera.h" +#include "llavataractions.h" #include "llavatarnamecache.h" #include "llcallingcard.h" #include "llcolorscheme.h" -#include "llviewercontrol.h" -#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llframetimer.h" #include "lltracker.h" @@ -58,7 +55,6 @@ #include "llsurface.h" #include "lltextbox.h" #include "lluictrlfactory.h" -#include "lluuid.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewermenu.h" @@ -208,6 +204,19 @@ void LLNetMap::draw() F32 rotation = 0; + + gGL.pushMatrix(); + gGL.pushUIMatrix(); + + LLVector3 offset = gGL.getUITranslation(); + LLVector3 scale = gGL.getUIScale(); + + gGL.loadIdentity(); + gGL.loadUIIdentity(); + + gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]); + gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); + // Prepare a scissor region { LLGLEnable scissor(GL_SCISSOR_TEST); @@ -419,7 +428,7 @@ void LLNetMap::draw() avColor = em_color; } //without these dots, SL would suck. - else if(is_agent_friend(id)) + else if(LLAvatarActions::isFriend(id)) { avColor = friend_color; } @@ -512,6 +521,9 @@ void LLNetMap::draw() } } + gGL.popMatrix(); + gGL.popUIMatrix(); + // Rotation of 0 means that North is up setDirectionPos( getChild("e_label"), rotation); setDirectionPos( getChild("n_label"), rotation + F_PI_BY_TWO); @@ -1134,10 +1146,10 @@ bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer event, const L // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick); + LLAvatarActions::showProfile(self->mClosestAgentAtLastRightClick); } // [/RLVa:KB] - //LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick); + //LLAvatarActions::showProfile(self->mClosestAgentAtLastRightClick); return true; } diff --git a/indra/newview/llnotify.cpp b/indra/newview/llnotify.cpp index 8b7f52afd..4f6cca008 100644 --- a/indra/newview/llnotify.cpp +++ b/indra/newview/llnotify.cpp @@ -48,7 +48,6 @@ #include "lluiconstants.h" #include "llui.h" #include "llxmlnode.h" -#include "llalertdialog.h" #include "llviewercontrol.h" #include "llviewerdisplay.h" #include "llviewertexturelist.h" @@ -323,8 +322,7 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification, std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, - onClickNext, - this, + boost::bind(&LLNotifyBox::onClickNext,this), sFont); btn->setScaleImage(TRUE); btn->setToolTip(LLTrans::getString("next")); @@ -398,7 +396,6 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification, // virtual LLNotifyBox::~LLNotifyBox() { - std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer()); } // virtual @@ -435,14 +432,7 @@ LLButton* LLNotifyBox::addButton(const std::string& name, const std::string& lab btn_width - 2*ignore_pad, btn_height); - InstanceAndS32* userdata = new InstanceAndS32; - userdata->mSelf = this; - userdata->mButtonName = is_option ? name : ""; - - mBtnCallbackData.push_back(userdata); - - - btn = new LLButton(name, btn_rect, "", onClickButton, userdata); + btn = new LLButton(name, btn_rect, "", boost::bind(&LLNotifyBox::onClickButton, this, is_option ? name : "")); btn->setLabel(label); btn->setFont(font); @@ -794,36 +784,29 @@ LLRect LLNotifyBox::getNotifyTipRect(const std::string &utf8message) } -// static -void LLNotifyBox::onClickButton(void* data) +void LLNotifyBox::onClickButton(const std::string name) { - InstanceAndS32* self_and_button = (InstanceAndS32*)data; - LLNotifyBox* self = self_and_button->mSelf; - std::string button_name = self_and_button->mButtonName; - - LLSD response = self->mNotification->getResponseTemplate(); - if (!self->mAddedDefaultBtn && !button_name.empty()) + LLSD response = mNotification->getResponseTemplate(); + if (!mAddedDefaultBtn && !name.empty()) { - response[button_name] = true; + response[name] = true; } - if (self->mUserInputBox) + if (mUserInputBox) { - response[self->mUserInputBox->getName()] = self->mUserInputBox->getValue(); + response[mUserInputBox->getName()] = mUserInputBox->getValue(); } - self->mNotification->respond(response); + mNotification->respond(response); } -// static -void LLNotifyBox::onClickNext(void* data) +void LLNotifyBox::onClickNext() { - LLNotifyBox* self = static_cast(data); - self->moveToBack(true); + moveToBack(true); } LLNotifyBoxView::LLNotifyBoxView(const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 follows) - : LLUICtrl(name,rect,mouse_opaque,NULL,NULL,follows) + : LLUICtrl(name,rect,mouse_opaque,NULL,follows) { } diff --git a/indra/newview/llnotify.h b/indra/newview/llnotify.h index 4047430a5..c0b03b8f9 100644 --- a/indra/newview/llnotify.h +++ b/indra/newview/llnotify.h @@ -90,10 +90,10 @@ protected: static LLRect getNotifyTipRect(const std::string &message); // internal handler for button being clicked - static void onClickButton(void* data); + void onClickButton(const std::string name); // for "next" button - static void onClickNext(void* data); + void onClickNext(); //static LLNotifyBox* findExistingNotify(LLPointer notify_template, const LLString::format_map_t& args); @@ -130,8 +130,6 @@ protected: LLNotifyBox* mSelf; std::string mButtonName; }; - std::vector mBtnCallbackData; - static S32 sNotifyBoxCount; static const LLFontGL* sFont; static const LLFontGL* sFontSmall; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 80bb82a65..524de0fb0 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -34,74 +34,48 @@ #include "llpanelavatar.h" -#include "llclassifiedflags.h" -#include "llfontgl.h" -#include "llcachename.h" - #include "llavatarconstants.h" -#include "lluiconstants.h" -#include "lltextbox.h" -#include "llviewertexteditor.h" -#include "lltexturectrl.h" -#include "llagent.h" -#include "llviewerwindow.h" +#include "llavatarnamecache.h" #include "llbutton.h" -#include "llcallingcard.h" #include "llcheckboxctrl.h" -#include "llfloater.h" +#include "llclassifiedflags.h" +#include "lltextbox.h" +#include "lltexteditor.h" +#include "lltexturectrl.h" +#include "llwindow.h" -#include "llfloaterfriends.h" +#include "llagent.h" +#include "llavataractions.h" +#include "llcallingcard.h" +#include "lldroptarget.h" #include "llfloatergroupinfo.h" -#include "llfloatergroups.h" -#include "llfloaterinventory.h" -#include "llfloaterworldmap.h" #include "llfloatermute.h" #include "llfloateravatarinfo.h" -#include "lliconctrl.h" +#include "llgroupactions.h" #include "lllineeditor.h" #include "llnameeditor.h" -#include "llmutelist.h" #include "llnotificationsutil.h" #include "llpanelclassified.h" #include "llpanelpick.h" #include "llpreviewtexture.h" #include "llpluginclassmedia.h" #include "llscrolllistctrl.h" -#include "llstatusbar.h" #include "lltabcontainer.h" -#include "llimview.h" -#include "llvoavatar.h" -#include "llviewercontrol.h" -#include "llviewergenericmessage.h" // send_generic_message -#include "llviewerobjectlist.h" -#include "llviewerregion.h" -#include "llweb.h" -#include "llinventorymodel.h" -#include "roles_constants.h" #include "lluictrlfactory.h" -#include "llavatarnamecache.h" -#include "lldroptarget.h" - +#include "llviewerwindow.h" +#include "llweb.h" #include #include - - // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] -#include "llavatarname.h" - // Statics std::list LLPanelAvatar::sAllPanels; BOOL LLPanelAvatar::sAllowFirstLife = FALSE; -extern void callback_invite_to_group(LLUUID group_id, void *user_data); -extern void handle_lure(const LLUUID& invitee); -extern void handle_pay_by_id(const LLUUID& payee); -BOOL is_agent_friend(const LLUUID& agent_id); BOOL is_agent_mappable(const LLUUID& agent_id); @@ -197,12 +171,6 @@ void LLPanelAvatarSecondLife::clearControls() { group_list->deleteAllItems(); } - /*LLScrollListCtrl* ratings_list = getChild("ratings"); createDummyWidget Making Dummy -HgB - if(ratings_list) - { - ratings_list->deleteAllItems(); - }*/ - } // virtual @@ -421,7 +389,7 @@ void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType void LLPanelAvatarSecondLife::onClickImage(void* data) { LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - LLNameEditor* name_ctrl = self->getChild("name"); + LLNameEditor* name_ctrl = self->getChild("dnname"); if(name_ctrl) { std::string name_text = name_ctrl->getText(); @@ -463,18 +431,14 @@ void LLPanelAvatarSecondLife::onClickImage(void* data) void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data) { LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - LLScrollListCtrl* group_list = self->getChild("groups"); if(group_list) { LLScrollListItem* item = group_list->getFirstSelected(); - - if(item && item->getUUID().notNull()) + if (item) { - llinfos << "Show group info " << item->getUUID() << llendl; - - LLFloaterGroupInfo::showFromUUID(item->getUUID()); + LLGroupActions::show(item->getUUID()); } } } @@ -506,11 +470,7 @@ bool LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(const LLSD& notification void LLPanelAvatarSecondLife::onClickPartnerInfo(void *data) { LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*) data; - if (self->mPartnerID.notNull()) - { - LLFloaterAvatarInfo::showFromProfile(self->mPartnerID, - self->calcScreenRect()); - } + LLAvatarActions::showProfile(self->mPartnerID); } //----------------------------------------------------------------------------- @@ -542,8 +502,8 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) childSetEnabled("partner_info", mPartnerID.notNull()); childSetAction("?",onClickPublishHelp,this); - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - enableControls(own_avatar); + LLPanelAvatar* pa = getPanelAvatar(); + enableControls(pa->getAvatarID() == gAgentID); childSetVisible("About:",LLPanelAvatar::sAllowFirstLife); childSetVisible("(500 chars)",LLPanelAvatar::sAllowFirstLife); @@ -554,16 +514,15 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) childSetVisible("online_yes",FALSE); - childSetAction("Find on Map", LLPanelAvatar::onClickTrack, getPanelAvatar()); - childSetAction("Instant Message...", LLPanelAvatar::onClickIM, getPanelAvatar()); - childSetAction("GroupInvite_Button", LLPanelAvatar::onClickGroupInvite, getPanelAvatar()); + getChild("Find on Map")->setCommitCallback(boost::bind(LLAvatarActions::showOnMap, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + getChild("Instant Message...")->setCommitCallback(boost::bind(LLAvatarActions::startIM, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + getChild("GroupInvite_Button")->setCommitCallback(boost::bind(LLAvatarActions::inviteToGroup, boost::bind(&LLPanelAvatar::getAvatarID, pa))); - childSetAction("Add Friend...", LLPanelAvatar::onClickAddFriend, getPanelAvatar()); - childSetAction("Pay...", LLPanelAvatar::onClickPay, getPanelAvatar()); - childSetAction("Mute", LLPanelAvatar::onClickMute, getPanelAvatar() ); + getChild("Add Friend...")->setCommitCallback(boost::bind(LLAvatarActions::requestFriendshipDialog, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + getChild("Pay...")->setCommitCallback(boost::bind(LLAvatarActions::pay, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + childSetAction("Mute", LLPanelAvatar::onClickMute, pa); - childSetAction("Offer Teleport...", LLPanelAvatar::onClickOfferTeleport, - getPanelAvatar() ); + getChild("Offer Teleport...")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLPanelAvatar::getAvatarID, pa))); getChild("groups")->setDoubleClickCallback(boost::bind(&LLPanelAvatarSecondLife::onDoubleClickGroup,this)); @@ -596,13 +555,12 @@ BOOL LLPanelAvatarNotes::postBuild(void) BOOL LLPanelAvatarWeb::postBuild(void) { - childSetKeystrokeCallback("url_edit", onURLKeystroke, this); - childSetCommitCallback("load", onCommitLoad, this); + LLLineEditor* url_edit = getChild("url_edit"); + url_edit->setKeystrokeCallback(boost::bind(&LLPanelAvatarWeb::onURLKeystroke,this,_1)); + url_edit->setCommitCallback(boost::bind(&LLPanelAvatarWeb::onCommitURL,this,_2)); childSetAction("web_profile_help",onClickWebProfileHelp,this); - childSetCommitCallback("url_edit",onCommitURL,this); - childSetControlName("auto_load","AutoLoadWebProfiles"); mWebBrowser = getChild("profile_html"); @@ -620,7 +578,7 @@ void LLPanelAvatarWeb::processProperties(void* data, EAvatarProcessorType type) if(type == APT_PROPERTIES) { const LLAvatarData* pAvatarData = static_cast( data ); - if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) + if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull())) { setWebURL(pAvatarData->profile_url); } @@ -752,14 +710,9 @@ void LLPanelAvatarWeb::setWebURL(std::string url) } -// static -void LLPanelAvatarWeb::onCommitURL(LLUICtrl* ctrl, void* data) +void LLPanelAvatarWeb::onCommitURL(const LLSD& value) { - LLPanelAvatarWeb* self = (LLPanelAvatarWeb*)data; - - if (!self) return; - - self->load( self->childGetText("url_edit") ); + load(value.asString()); } // static @@ -783,31 +736,20 @@ void LLPanelAvatarWeb::load(std::string url) } } - - - -//static -void LLPanelAvatarWeb::onURLKeystroke(LLLineEditor* editor, void* data) +void LLPanelAvatarWeb::onURLKeystroke(LLLineEditor* editor) { - LLPanelAvatarWeb* self = (LLPanelAvatarWeb*)data; - if (!self) return; LLSD::String url = editor->getText(); - self->childSetEnabled("load", url.length() > 0); + childSetEnabled("load", url.length() > 0); return; } -// static -void LLPanelAvatarWeb::onCommitLoad(LLUICtrl* ctrl, void* data) +void LLPanelAvatarWeb::onCommitLoad(const LLSD& value) { - LLPanelAvatarWeb* self = (LLPanelAvatarWeb*)data; - - if (!self) return; - - LLSD::String valstr = ctrl->getValue().asString(); - LLSD::String urlstr = self->childGetText("url_edit"); + LLSD::String valstr = value.asString(); + LLSD::String urlstr = childGetText("url_edit"); if (valstr == "") // load url string into browser panel { - self->load(urlstr); + load(urlstr); } else if (valstr == "open") // open in user's external browser { @@ -818,9 +760,9 @@ void LLPanelAvatarWeb::onCommitLoad(LLUICtrl* ctrl, void* data) } else if (valstr == "home") // reload profile owner's home page { - if (!self->mHome.empty()) + if (!mHome.empty()) { - self->load(self->mHome); + load(mHome); } } } @@ -1439,14 +1381,13 @@ LLPanelAvatar::LLPanelAvatar( mPanelNotes(NULL), mPanelFirstLife(NULL), mPanelWeb(NULL), - mAvatarID( LLUUID::null ), // mAvatarID is set with 'setAvatar' or 'setAvatarID' + mAvatarID(LLUUID::null), // mAvatarID is set with setAvatarID() mHaveProperties(FALSE), mHaveStatistics(FALSE), mHaveNotes(false), mLastNotes(), mAllowEdit(allow_edit) { - sAllPanels.push_back(this); LLCallbackMap::map_t factory_map; @@ -1462,22 +1403,19 @@ LLPanelAvatar::LLPanelAvatar( LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar.xml", &factory_map); selectTab(0); - - } BOOL LLPanelAvatar::postBuild(void) { mTab = getChild("tab"); - childSetAction("Kick",onClickKick,this); - childSetAction("Freeze",onClickFreeze, this); - childSetAction("Unfreeze", onClickUnfreeze, this); - childSetAction("csr_btn", onClickCSR, this); + getChild("Kick")->setCommitCallback(boost::bind(LLAvatarActions::kick, boost::bind(&LLPanelAvatar::getAvatarID, this))); + getChild("Freeze")->setCommitCallback(boost::bind(LLAvatarActions::freeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); + getChild("Unfreeze")->setCommitCallback(boost::bind(LLAvatarActions::unfreeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); + getChild("csr_btn")->setCommitCallback(boost::bind(LLAvatarActions::csr, boost::bind(&LLPanelAvatar::getAvatarID, this))); childSetAction("OK", onClickOK, this); childSetAction("Cancel", onClickCancel, this); childSetAction("copy_key",onClickGetKey,this); - childSetCommitCallback("avatar_key",onCommitKey,this); if(mTab && !sAllowFirstLife) { @@ -1517,38 +1455,6 @@ BOOL LLPanelAvatar::canClose() return !mPanelClassified || mPanelClassified->canClose(); } -void LLPanelAvatar::setAvatar(LLViewerObject *avatarp) -{ - // find the avatar and grab the name - LLNameValue *firstname = avatarp->getNVPair("FirstName"); - LLNameValue *lastname = avatarp->getNVPair("LastName"); - - std::string name; - if (firstname && lastname) - { - name.assign( firstname->getString() ); - name.append(" "); - name.append( lastname->getString() ); - } - else - { - name.assign(""); - } - - // If we have an avatar pointer, they must be online. - setAvatarID(avatarp->getID(), name, ONLINE_STATUS_YES); -} - -void LLPanelAvatar::onCommitKey(LLUICtrl* ctrl, void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*) data; - std::string keystring = self->getChild("avater_key")->getText(); - LLUUID av_key = LLUUID::null; - if(LLUUID::validate(keystring)) av_key = (LLUUID)keystring; - - self->setAvatarID(av_key, LLStringUtil::null, ONLINE_STATUS_NO); -} - void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) { // Online status NO could be because they are hidden @@ -1569,6 +1475,7 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) if (mAvatarID != gAgent.getID()) { childSetVisible("Offer Teleport...",TRUE); + childSetVisible("Find on Map", true); } BOOL in_prelude = gAgent.inPrelude(); @@ -1587,15 +1494,31 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) childSetEnabled("Offer Teleport...", TRUE /*(online_status == ONLINE_STATUS_YES)*/); childSetToolTip("Offer Teleport...", getString("TeleportNormal")); } + + // Note: we don't always know online status, so always allow gods to try to track + childSetEnabled("Find on Map", gAgent.isGodlike() || is_agent_mappable(mAvatarID)); + if (!mIsFriend) + { + childSetToolTip("Find on Map", getString("ShowOnMapNonFriend")); + } + else if (ONLINE_STATUS_YES != online_status) + { + childSetToolTip("Find on Map", getString("ShowOnMapFriendOffline")); + } + else + { + childSetToolTip("Find on Map", getString("ShowOnMapFriendOnline")); + } } -void LLPanelAvatar::onAvatarNameResponse(const LLUUID& agent_id, const LLAvatarName& av_name){ - LLLineEditor* dnname_edit = getChild("dnname"); - if(LLAvatarNameCache::useDisplayNames() && agent_id==mAvatarID) dnname_edit->setText(av_name.getCompleteName()); +void LLPanelAvatar::onAvatarNameResponse(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + std::string name; + LLAvatarNameCache::getPNSName(av_name, name); + getChild("dnname")->setText(name); } -void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name, - EOnlineStatus online_status) +void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) { if (avatar_id.isNull()) return; @@ -1613,13 +1536,12 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name LLAvatarPropertiesProcessor::getInstance()->addObserver(mAvatarID, this); // Determine if we have their calling card. - mIsFriend = is_agent_friend(mAvatarID); + mIsFriend = LLAvatarActions::isFriend(mAvatarID); // setOnlineStatus uses mIsFriend - setOnlineStatus(online_status); - + setOnlineStatus(ONLINE_STATUS_NO); + BOOL own_avatar = (mAvatarID == gAgent.getID() ); - BOOL avatar_is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; for(std::list::iterator it=mAvatarPanelList.begin();it!=mAvatarPanelList.end();++it) { @@ -1632,41 +1554,10 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name // Teens don't have this. if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit); - getChild("drop_target_rect")->setEntityID(mAvatarID); + if (LLDropTarget* drop_target = findChild("drop_target_rect")) + drop_target->setEntityID(mAvatarID); - LLNameEditor* name_edit = getChild("name"); - if(name_edit) - { - if (name.empty()) - { - name_edit->setNameID(avatar_id, FALSE); - } - else - { - name_edit->setText(name); - } - } - - LLLineEditor* dnname_edit = getChild("dnname"); - LLAvatarName av_name; - if(dnname_edit){ - if(LLAvatarNameCache::useDisplayNames()){ - if(LLAvatarNameCache::get(avatar_id, &av_name)){ - dnname_edit->setText(av_name.getCompleteName()); - } - else{ - dnname_edit->setText(name_edit->getText()); - LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); - } - childSetVisible("dnname",TRUE); - childSetVisible("name",FALSE); - } - else - { - childSetVisible("dnname",FALSE); - childSetVisible("name",TRUE); - } - } + LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); LLNameEditor* key_edit = getChild("avatar_key"); if(key_edit) @@ -1742,25 +1633,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name childSetVisible("Mute",TRUE); childSetEnabled("Mute",FALSE); - - childSetVisible("Find on Map",TRUE); - // Note: we don't always know online status, so always allow gods to try to track - BOOL enable_track = gAgent.isGodlike() || is_agent_mappable(mAvatarID); - childSetEnabled("Find on Map",enable_track); - if (!mIsFriend) - { - childSetToolTip("Find on Map", getString("ShowOnMapNonFriend")); - } - else if (ONLINE_STATUS_YES != online_status) - { - childSetToolTip("Find on Map", getString("ShowOnMapFriendOffline")); - } - else - { - childSetToolTip("Find on Map", getString("ShowOnMapFriendOnline")); - } childSetVisible("Add Friend...", true); - childSetEnabled("Add Friend...", !avatar_is_friend); + childSetEnabled("Add Friend...", !mIsFriend); childSetVisible("Pay...",TRUE); childSetEnabled("Pay...",FALSE); } @@ -1771,9 +1645,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name } } - BOOL is_god = FALSE; - if (gAgent.isGodlike()) is_god = TRUE; - + bool is_god = gAgent.isGodlike(); childSetVisible("Kick", is_god); childSetEnabled("Kick", is_god); childSetVisible("Freeze", is_god); @@ -1847,36 +1719,6 @@ void LLPanelAvatar::resetGroupList() } } -// static -//----------------------------------------------------------------------------- -// onClickIM() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickIM(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - gIMMgr->setFloaterOpen(TRUE); - - std::string name; - LLNameEditor* nameedit = self->mPanelSecondLife->getChild("name"); - if (nameedit) name = nameedit->getText(); - gIMMgr->addSession(name, IM_NOTHING_SPECIAL, self->mAvatarID); -} - -void LLPanelAvatar::onClickGroupInvite(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - if (self->getAvatarID().notNull()) - { - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - if (widget) - { - widget->center(); - widget->setPowersMask(GP_MEMBER_INVITE); - widget->setSelectCallback(callback_invite_to_group, (void *)&(self->getAvatarID())); - } - } -} //static void LLPanelAvatar::onClickGetKey(void *userdata) { @@ -1888,37 +1730,6 @@ void LLPanelAvatar::onClickGetKey(void *userdata) gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(agent_id.asString())); } -// static -//----------------------------------------------------------------------------- -// onClickTrack() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickTrack(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - if( gFloaterWorldMap ) - { - std::string name; - LLNameEditor* nameedit = self->mPanelSecondLife->getChild("name"); - if (nameedit) name = nameedit->getText(); - gFloaterWorldMap->trackAvatar(self->mAvatarID, name); - LLFloaterWorldMap::show(true); - } -} - - -// static -void LLPanelAvatar::onClickAddFriend(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLNameEditor* name_edit = self->mPanelSecondLife->getChild("name"); - if (name_edit) - { - LLPanelFriends::requestFriendshipDialog(self->getAvatarID(), - name_edit->getText()); - } -} - //----------------------------------------------------------------------------- // onClickMute() //----------------------------------------------------------------------------- @@ -1927,43 +1738,18 @@ void LLPanelAvatar::onClickMute(void *userdata) LLPanelAvatar* self = (LLPanelAvatar*) userdata; LLUUID agent_id = self->getAvatarID(); - LLNameEditor* name_edit = self->mPanelSecondLife->getChild("name"); - - if (name_edit) + + LLFloaterMute::showInstance(); + if (LLAvatarActions::isBlocked(agent_id)) { - std::string agent_name = name_edit->getText(); - LLFloaterMute::showInstance(); - - if (LLMuteList::getInstance()->isMuted(agent_id)) - { - LLFloaterMute::getInstance()->selectMute(agent_id); - } - else - { - LLMute mute(agent_id, agent_name, LLMute::AGENT); - LLMuteList::getInstance()->add(mute); - } + LLFloaterMute::getInstance()->selectMute(agent_id); + } + else + { + LLAvatarActions::toggleBlock(agent_id); } } - -// static -void LLPanelAvatar::onClickOfferTeleport(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - handle_lure(self->mAvatarID); -} - - -// static -void LLPanelAvatar::onClickPay(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - handle_pay_by_id(self->mAvatarID); -} - - // static void LLPanelAvatar::onClickOK(void *userdata) { @@ -2058,7 +1844,7 @@ void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) if(type == APT_PROPERTIES) { const LLAvatarData* pAvatarData = static_cast( data ); - if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) + if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull())) { childSetEnabled("Instant Message...",TRUE); childSetEnabled("GroupInvite_Button",TRUE); @@ -2181,136 +1967,6 @@ void LLPanelAvatar::selectTabByName(std::string tab_name) } } -// static -void LLPanelAvatar::onClickKick(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect(left, top, left+400, top-300); - - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotificationsUtil::add("KickUser", LLSD(), payload, finishKick); -} - -//static -bool LLPanelAvatar::finishKick(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); - msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickFreeze(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotificationsUtil::add("FreezeUser", LLSD(), payload, LLPanelAvatar::finishFreeze); -} - -// static -bool LLPanelAvatar::finishFreeze(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); - msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickUnfreeze(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotificationsUtil::add("UnFreezeUser", LLSD(), payload, LLPanelAvatar::finishUnfreeze); -} - -// static -bool LLPanelAvatar::finishUnfreeze(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - std::string text = response["message"].asString(); - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); - msg->addStringFast(_PREHASH_Reason, text ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickCSR(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*)userdata; - if (!self) return; - - LLNameEditor* name_edit = self->getChild("name"); - if (!name_edit) return; - - std::string name = name_edit->getText(); - if (name.empty()) return; - - std::string url = "http://csr.lindenlab.com/agent/"; - - // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) - { - if (name[i] == ' ') - { - url += "%20"; - } - else - { - url += name[i]; - } - } - - LLWeb::loadURL(url); -} - - void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 805826656..d43746308 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -162,9 +162,9 @@ public: void setWebURL(std::string url); void load(std::string url); - static void onURLKeystroke(LLLineEditor* editor, void* data); - static void onCommitLoad(LLUICtrl* ctrl, void* data); - static void onCommitURL(LLUICtrl* ctrl, void* data); + void onURLKeystroke(LLLineEditor* editor); + void onCommitLoad(const LLSD& value); + void onCommitURL(const LLSD& value); static void onClickWebProfileHelp(void *); // inherited from LLViewerMediaObserver @@ -303,8 +303,7 @@ public: // Fill in the avatar ID and handle some field fill-in, as well as // button enablement. - // Pass one of the ONLINE_STATUS_foo constants above. - void setAvatarID(const LLUUID &avatar_id, const std::string &name, EOnlineStatus online_status); + void setAvatarID(const LLUUID &avatar_id); void setOnlineStatus(EOnlineStatus online_status); @@ -328,30 +327,14 @@ public: BOOL haveData() { return mHaveProperties && mHaveStatistics; } BOOL isEditable() const { return mAllowEdit; } - static void onClickTrack( void *userdata); - static void onClickIM( void *userdata); - static void onClickGroupInvite( void *userdata); - static void onClickOfferTeleport( void *userdata); - static void onClickPay( void *userdata); static void onClickGetKey(void *userdata); - static void onClickAddFriend(void* userdata); static void onClickOK( void *userdata); static void onClickCancel( void *userdata); - static void onClickKick( void *userdata); - static void onClickFreeze( void *userdata); - static void onClickUnfreeze(void *userdata); - static void onClickCSR( void *userdata); static void onClickMute( void *userdata); - static void onCommitKey(LLUICtrl* ctrl, void* data); private: void enableOKIfReady(); - static bool finishKick(const LLSD& notification, const LLSD& response); - static bool finishFreeze(const LLSD& notification, const LLSD& response); - static bool finishUnfreeze(const LLSD& notification, const LLSD& response); - - static void showProfileCallback(S32 option, void *userdata); static void* createPanelAvatar(void* data); static void* createFloaterAvatarInfo(void* data); static void* createPanelAvatarSecondLife(void* data); @@ -393,8 +376,4 @@ private: static panel_list_t sAllPanels; }; -// helper funcs -void add_left_label(LLPanel *panel, const std::string& name, S32 y); - - #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 1ab3933e1..2b4b7f8eb 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -46,21 +46,18 @@ #include "message.h" #include "llagent.h" -#include "llalertdialog.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llclassifiedflags.h" #include "llclassifiedstatsresponder.h" #include "llcommandhandler.h" // for classified HTML detail page click tracking -#include "llviewercontrol.h" #include "lllineeditor.h" -#include "llfloateravatarinfo.h" #include "llfloaterclassified.h" #include "lltextbox.h" #include "llcombobox.h" #include "llviewertexteditor.h" #include "lltexturectrl.h" -#include "lluiconstants.h" #include "llurldispatcher.h" // for classified HTML detail click teleports #include "lluictrlfactory.h" #include "llviewerparcelmgr.h" @@ -895,7 +892,7 @@ void LLPanelClassified::onClickMap(void* data) void LLPanelClassified::onClickProfile(void* data) { LLPanelClassified* self = (LLPanelClassified*)data; - LLFloaterAvatarInfo::showFromDirectory(self->mCreatorID); + LLAvatarActions::showProfile(self->mCreatorID); self->sendClassifiedClickMessage("profile"); } diff --git a/indra/newview/llpaneldebug.cpp b/indra/newview/llpaneldebug.cpp deleted file mode 100644 index 745daf597..000000000 --- a/indra/newview/llpaneldebug.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file llpaneldebug.cpp - * @brief Debug preferences panel for preferences floater - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * 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 - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -// file include -#include "llpaneldebug.h" - -// linden library includes -#include "llerror.h" -#include "llrect.h" -#include "llstring.h" -#include "llfontgl.h" - -// project includes -#include "llaudioengine.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcolorswatch.h" -#include "llcombobox.h" -#include "llresmgr.h" -#include "llsky.h" -#include "llslider.h" -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "lltextbox.h" -#include "llui.h" -#include "llvosky.h" -#include "message.h" -#include "llagent.h" -#include "llviewercontrol.h" - -// -// Imported globals -// - - -// -// Globals -// - -// -// Static functions -// - -LLPanelDebug::LLPanelDebug(const std::string& name, const LLRect& rect) -: LLPanel(name, rect) -{ - LLCheckboxCtrl* check = NULL; - LLSliderCtrl *sliderctrl = NULL; - - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); - - const S32 HPAD = 10; - const S32 VPAD = 4; - - const S32 TOP_PAD = 10; - - // alignment "rulers" for buttons - const S32 SEGMENT_WIDTH = 128; - const S32 LEFT = HPAD; - const S32 RULER1 = LEFT + SEGMENT_WIDTH + 30; - const S32 RULER2 = RULER1 + HPAD; - const S32 RIGHT = RULER2 + SEGMENT_WIDTH; - const S32 LABEL_OFFSET = 60; - - S32 cur_y = rect.getHeight() - TOP_PAD; - - sliderctrl = new LLSliderCtrl(std::string("Drop Shadow Floater"), - LLRect( LEFT, cur_y, RIGHT, cur_y - SLIDERCTRL_HEIGHT ), - std::string("Drop Shadow Floater"), - font, - LABEL_OFFSET, - RULER2 + SPINCTRL_DEFAULT_LABEL_WIDTH + SPINCTRL_BTN_WIDTH, - TRUE, - TRUE, - FALSE, - NULL, NULL, - (F32)gSavedSettings.getS32("DropShadowFloater"), - 0.f, 10.f, 1.0f, - std::string("DropShadowFloater")); - sliderctrl->setFollowsTop(); - sliderctrl->setFollowsLeft(); - addChild(sliderctrl); - cur_y -= VPAD + SLIDERCTRL_HEIGHT; - - sliderctrl = new LLSliderCtrl(std::string("Drop Shadow Button"), - LLRect( LEFT, cur_y, RIGHT, cur_y - SLIDERCTRL_HEIGHT ), - std::string("Drop Shadow Button"), - font, - LABEL_OFFSET, - RULER2 + SPINCTRL_DEFAULT_LABEL_WIDTH + SPINCTRL_BTN_WIDTH, - TRUE, - TRUE, - FALSE, - NULL, NULL, - (F32)gSavedSettings.getS32("DropShadowButton"), - 0.f, 10.f, 1.0f, - std::string("DropShadowButton")); - sliderctrl->setFollowsTop(); - sliderctrl->setFollowsLeft(); - addChild(sliderctrl); - cur_y -= VPAD + SLIDERCTRL_HEIGHT; - - check = new LLCheckboxCtrl(std::string("left click"), - LLRect(LEFT, cur_y, RIGHT, cur_y - 20), - std::string("Left Click Shows Menu Unless Interactive"), - font, - NULL, NULL, - gSavedSettings.getBOOL("LeftClickShowMenu")); - check->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); - addChild(check); - mLeftClickCheck = check; - cur_y -= VPAD+20; -} - - -LLPanelDebug::~LLPanelDebug() -{ - // Children all cleaned up by default view destructor. -} - - -void LLPanelDebug::apply() -{ - gSavedSettings.setBOOL("LeftClickShowMenu", mLeftClickCheck->get() ); -} - -void LLPanelDebug::cancel() -{ -} diff --git a/indra/newview/llpaneldebug.h b/indra/newview/llpaneldebug.h deleted file mode 100644 index 10e82f5ca..000000000 --- a/indra/newview/llpaneldebug.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file llpaneldebug.h - * @brief Debug preferences panel for preferences floater - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * 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 - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLPANELDEBUG_H -#define LL_LLPANELDEBUG_H - -#include "llpanel.h" - -class LLCheckBoxCtrl; - -class LLPanelDebug : public LLPanel -{ -public: - LLPanelDebug(const std::string& name, const LLRect& rect); - virtual ~LLPanelDebug(); - - void apply(); // Apply the changed values. - void cancel(); // Cancel the changed values. - -protected: - LLCheckBoxCtrl* mLeftClickCheck; -}; - -#endif // LL_LLPANELDEBUG_H diff --git a/indra/newview/llpaneldirbrowser.cpp b/indra/newview/llpaneldirbrowser.cpp index 19201c56d..929b5c6b8 100644 --- a/indra/newview/llpaneldirbrowser.cpp +++ b/indra/newview/llpaneldirbrowser.cpp @@ -108,17 +108,19 @@ LLPanelDirBrowser::LLPanelDirBrowser(const std::string& name, LLFloaterDirectory BOOL LLPanelDirBrowser::postBuild() { if (LLUICtrl* ctrl = findChild("results")) - ctrl->setCommitCallback(onCommitList, this); + { + ctrl->setCommitCallback(boost::bind(&LLPanelDirBrowser::onCommitList,this)); + } if (LLButton* btn = findChild("< Prev")) { - childSetAction("< Prev", onClickPrev, this); + btn->setClickedCallback(boost::bind(&LLPanelDirBrowser::prevPage,this)); btn->setVisible(false); } if (LLButton* btn = findChild("Next >")) { - childSetAction("Next >", onClickNext, this); + btn->setClickedCallback(boost::bind(&LLPanelDirBrowser::nextPage,this)); btn->setVisible(false); } @@ -154,7 +156,7 @@ void LLPanelDirBrowser::draw() childSetFocus("results", TRUE); } // Request specific data from the server - onCommitList(NULL, this); + onCommitList(); } } mDidAutoSelect = TRUE; @@ -233,21 +235,6 @@ void LLPanelDirBrowser::updateResultCount() } } -// static -void LLPanelDirBrowser::onClickPrev(void* data) -{ - LLPanelDirBrowser* self = (LLPanelDirBrowser*)data; - self->prevPage(); -} - - -// static -void LLPanelDirBrowser::onClickNext(void* data) -{ - LLPanelDirBrowser* self = (LLPanelDirBrowser*)data; - self->nextPage(); -} - // static std::string LLPanelDirBrowser::filterShortWords( const std::string source_string, int shortest_word_length, @@ -339,7 +326,7 @@ void LLPanelDirBrowser::selectByUUID(const LLUUID& id) // Don't bother looking for this in the draw loop. mWantSelectID.setNull(); // Make sure UI updates. - onCommitList(NULL, this); + onCommitList(); } else { @@ -385,18 +372,15 @@ void LLPanelDirBrowser::getSelectedInfo(LLUUID* id, S32 *type) *type = mResultsContents[id_str]["type"]; } - -// static -void LLPanelDirBrowser::onCommitList(LLUICtrl* ctrl, void* data) +void LLPanelDirBrowser::onCommitList() { - LLPanelDirBrowser* self = (LLPanelDirBrowser*)data; - LLScrollListCtrl* list = self->findChild("results"); + LLScrollListCtrl* list = findChild("results"); if (!list) return; // Start with everyone invisible - if (self->mFloaterDirectory) + if (mFloaterDirectory) { - self->mFloaterDirectory->hideAllDetailPanels(); + mFloaterDirectory->hideAllDetailPanels(); } if (FALSE == list->getCanSelect()) @@ -404,28 +388,28 @@ void LLPanelDirBrowser::onCommitList(LLUICtrl* ctrl, void* data) return; } - std::string id_str = self->childGetValue("results").asString(); + std::string id_str = childGetValue("results").asString(); if (id_str.empty()) { return; } LLSD item_id = list->getCurrentID(); - S32 type = self->mResultsContents[id_str]["type"]; + S32 type = mResultsContents[id_str]["type"]; if (type == EVENT_CODE) { // all but events use the UUID above - item_id = self->mResultsContents[id_str]["event_id"]; + item_id = mResultsContents[id_str]["event_id"]; } //std::string name = self->mResultsContents[id_str]["name"].asString(); - self->showDetailPanel(type, item_id); + showDetailPanel(type, item_id); if (type == FOR_SALE_CODE) { - std::string land_type = self->mResultsContents[id_str]["landtype"].asString(); - if (self->mFloaterDirectory && self->mFloaterDirectory->mPanelPlaceSmallp) + std::string land_type = mResultsContents[id_str]["landtype"].asString(); + if (mFloaterDirectory && mFloaterDirectory->mPanelPlaceSmallp) { - self->mFloaterDirectory->mPanelPlaceSmallp->setLandTypeString(land_type); + mFloaterDirectory->mPanelPlaceSmallp->setLandTypeString(land_type); } } } @@ -438,7 +422,7 @@ void LLPanelDirBrowser::showDetailPanel(S32 type, LLSD id) if (mFloaterDirectory && mFloaterDirectory->mPanelAvatarp) { mFloaterDirectory->mPanelAvatarp->setVisible(TRUE); - mFloaterDirectory->mPanelAvatarp->setAvatarID(id.asUUID(), LLStringUtil::null, ONLINE_STATUS_NO); + mFloaterDirectory->mPanelAvatarp->setAvatarID(id.asUUID()); } break; case EVENT_CODE: @@ -1247,15 +1231,11 @@ void LLPanelDirBrowser::setupNewSearch() } -// static // called from calssifieds, events, groups, land, people, and places -void LLPanelDirBrowser::onClickSearchCore(void* userdata) +void LLPanelDirBrowser::onClickSearchCore() { - LLPanelDirBrowser* self = (LLPanelDirBrowser*)userdata; - if (!self) return; - - self->resetSearchStart(); - self->performQuery(); + resetSearchStart(); + performQuery(); LLFloaterDirectory::sOldSearchCount++; } @@ -1282,18 +1262,17 @@ void LLPanelDirBrowser::sendDirFindQuery( } -void LLPanelDirBrowser::onKeystrokeName(LLLineEditor* line, void* data) +void LLPanelDirBrowser::onKeystrokeName(LLLineEditor* line) { - LLPanelDirBrowser *self = (LLPanelDirBrowser*)data; - if (line->getLength() >= (S32)self->mMinSearchChars) + if (line->getLength() >= (S32)mMinSearchChars) { - self->setDefaultBtn( "Search" ); - self->childEnable("Search"); + setDefaultBtn( "Search" ); + childEnable("Search"); } else { - self->setDefaultBtn(); - self->childDisable("Search"); + setDefaultBtn(); + childDisable("Search"); } } @@ -1302,7 +1281,7 @@ void LLPanelDirBrowser::handleVisibilityChange(BOOL new_visibility) { if (new_visibility) { - onCommitList(NULL, this); + onCommitList(); } LLPanel::handleVisibilityChange(new_visibility); } diff --git a/indra/newview/llpaneldirbrowser.h b/indra/newview/llpaneldirbrowser.h index 6fa6d7c47..07ffc92f1 100644 --- a/indra/newview/llpaneldirbrowser.h +++ b/indra/newview/llpaneldirbrowser.h @@ -87,7 +87,8 @@ public: // default handler for clicking the search button resets the // next/prev state and performs the query. // Expects a pointer to an LLPanelDirBrowser object. - static void onClickSearchCore(void* userdata); + void onClickSearchCore(); + void onKeystrokeName(LLLineEditor* line); // query_start indicates the first result row to // return, usually 0 or 100 or 200 because the searches @@ -103,11 +104,7 @@ public: void showEvent(const U32 event_id); - // Prev/Next page buttons - static void onClickNext(void* data); - static void onClickPrev(void* data); - - static void onCommitList(LLUICtrl* ctrl, void* data); + void onCommitList(); static void processDirPeopleReply(LLMessageSystem* msg, void**); static void processDirPlacesReply(LLMessageSystem* msg, void**); @@ -120,15 +117,12 @@ public: // Logic to control maturity checkboxes in Classified/Events/Places/'Land for Sale' tabs. void updateMaturityCheckbox(); - protected: void updateResultCount(); void addClassified(LLCtrlListInterface *list, const LLUUID& classified_id, const std::string& name, const U32 creation_date, const S32 price_for_listing); LLSD createLandSale(const LLUUID& parcel_id, BOOL is_auction, BOOL is_for_sale, const std::string& name, S32 *type); - static void onKeystrokeName(LLLineEditor* line, void* data); - // If this is a search for a panel like "people_panel" (and not the "all" panel) // optionally show the "Next" button. Return the actual number of // rows to display. diff --git a/indra/newview/llpaneldirclassified.cpp b/indra/newview/llpaneldirclassified.cpp index dbc2f8afa..2bc854864 100644 --- a/indra/newview/llpaneldirclassified.cpp +++ b/indra/newview/llpaneldirclassified.cpp @@ -106,15 +106,13 @@ BOOL LLPanelDirClassified::postBuild() } // 0 or 3+ character searches allowed, exciting - childSetKeystrokeCallback("name", onKeystrokeNameClassified, this); - - childSetAction("Search", onClickSearchCore, this); - childSetAction("Browse", onClickSearchCore, this); + getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirClassified::onKeystrokeNameClassified,this,_1)); + + getChild("Search")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); + getChild("Browse")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); setDefaultBtn( "Browse" ); - childSetAction("Place an Ad...", onClickCreateNewClassified, this); - - childSetAction("Delete", onClickDelete, this); + getChild("Delete")->setClickedCallback(boost::bind(&LLPanelDirClassified::onClickDelete,this)); childDisable("Delete"); childHide("Delete"); @@ -149,25 +147,16 @@ void LLPanelDirClassified::refresh() updateMaturityCheckbox(); } -//Open Profile to Classifieds tab -void LLPanelDirClassified::onClickCreateNewClassified(void *userdata) +void LLPanelDirClassified::onClickDelete() { - LLFloaterAvatarInfo::showFromObject(gAgent.getID(), "Classified"); -} - -// static -void LLPanelDirClassified::onClickDelete(void *userdata) -{ - LLPanelDirClassified *self = (LLPanelDirClassified *)userdata; - LLUUID classified_id; S32 type; - self->getSelectedInfo(&classified_id, &type); + getSelectedInfo(&classified_id, &type); // Clear out the list. Deleting a classified will cause a refresh to be // sent. - self->setupNewSearch(); + setupNewSearch(); LLMessageSystem* msg = gMessageSystem; @@ -177,7 +166,7 @@ void LLPanelDirClassified::onClickDelete(void *userdata) msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Data); msg->addUUIDFast(_PREHASH_ClassifiedID, classified_id); - msg->addUUIDFast(_PREHASH_QueryID, self->mSearchID); + msg->addUUIDFast(_PREHASH_QueryID, mSearchID); gAgent.sendReliableMessage(); } @@ -222,34 +211,32 @@ void LLPanelDirClassified::performQuery() gAgent.sendReliableMessage(); } -void LLPanelDirClassified::onKeystrokeNameClassified(LLLineEditor* line, void* data) +void LLPanelDirClassified::onKeystrokeNameClassified(LLLineEditor* line) { - LLPanelDirClassified *self = (LLPanelDirClassified*)data; - S32 len = line->getLength(); if (len == 0 || len >= 3) { // no text searches are cheap, as are longer searches - self->setDefaultBtn( "Search" ); - self->childEnable("Search"); + setDefaultBtn( "Search" ); + childEnable("Search"); } else { - self->setDefaultBtn(); - self->childDisable("Search"); + setDefaultBtn(); + childDisable("Search"); } // Change the Browse to Search or vice versa if (len > 0) { - self->childSetVisible("Search", TRUE); - self->childSetVisible("Browse", FALSE); + childSetVisible("Search", TRUE); + childSetVisible("Browse", FALSE); } else { - self->setDefaultBtn( "Browse" ); - self->childSetVisible("Search", FALSE); - self->childSetVisible("Browse", TRUE); + setDefaultBtn( "Browse" ); + childSetVisible("Search", FALSE); + childSetVisible("Browse", TRUE); } } diff --git a/indra/newview/llpaneldirclassified.h b/indra/newview/llpaneldirclassified.h index 089e75fb4..6e0f73c8b 100644 --- a/indra/newview/llpaneldirclassified.h +++ b/indra/newview/llpaneldirclassified.h @@ -59,15 +59,12 @@ public: protected: //static void onClickNewClassified(void* data); - static void onClickDelete(void* data); + void onClickDelete(); // onClickNext and onClickPrev are special case searches - static void onClickSearch(void *userdata); + void onClickSearch(); - static void onKeystrokeNameClassified(LLLineEditor* line, void* data); - - // - static void onClickCreateNewClassified(void* data); + void onKeystrokeNameClassified(LLLineEditor* line); protected: }; diff --git a/indra/newview/llpaneldirevents.cpp b/indra/newview/llpaneldirevents.cpp index 7f087d9dc..347cf5b62 100644 --- a/indra/newview/llpaneldirevents.cpp +++ b/indra/newview/llpaneldirevents.cpp @@ -68,21 +68,21 @@ BOOL LLPanelDirEvents::postBuild() { LLPanelDirBrowser::postBuild(); - childSetCommitCallback("date_mode", onDateModeCallback, this); + getChild("date_mode")->setCommitCallback(boost::bind(&LLPanelDirEvents::onDateModeCallback,this)); - childSetAction("<<", onBackBtn, this); - childSetAction(">>", onForwardBtn, this); + getChild("<<")->setClickedCallback(boost::bind(&LLPanelDirEvents::onBackBtn,this)); + getChild(">>")->setClickedCallback(boost::bind(&LLPanelDirEvents::onForwardBtn,this)); - childSetAction("Today", onClickToday, this); + getChild("Today")->setClickedCallback(boost::bind(&LLPanelDirEvents::onClickToday,this)); - childSetAction("Search", LLPanelDirBrowser::onClickSearchCore, this); + getChild("Search")->setClickedCallback(boost::bind(&LLPanelDirEvents::onClickSearchCore,this)); setDefaultBtn("Search"); - childSetAction("Delete", onClickDelete, this); + getChild("Delete")->setClickedCallback(boost::bind(&LLPanelDirEvents::onClickDelete,this)); childDisable("Delete"); childHide("Delete"); - onDateModeCallback(NULL, this); + onDateModeCallback(); mCurrentSortColumn = "time"; @@ -246,63 +246,48 @@ void LLPanelDirEvents::performQueryOrDelete(U32 event_id) } } -// static -void LLPanelDirEvents::onDateModeCallback(LLUICtrl* ctrl, void *data) +void LLPanelDirEvents::onDateModeCallback() { - LLPanelDirEvents* self = (LLPanelDirEvents*)data; - if (self->childGetValue("date_mode").asString() == "date") + if (childGetValue("date_mode").asString() == "date") { - self->childEnable("Today"); - self->childEnable(">>"); - self->childEnable("<<"); + childEnable("Today"); + childEnable(">>"); + childEnable("<<"); } else { - self->childDisable("Today"); - self->childDisable(">>"); - self->childDisable("<<"); + childDisable("Today"); + childDisable(">>"); + childDisable("<<"); } } -// static -void LLPanelDirEvents::onClickToday(void *userdata) +void LLPanelDirEvents::onClickToday() { - LLPanelDirEvents *self = (LLPanelDirEvents *)userdata; - self->resetSearchStart(); - self->setDay(0); - self->performQuery(); + resetSearchStart(); + setDay(0); + performQuery(); } - -// static -void LLPanelDirEvents::onBackBtn(void* data) +void LLPanelDirEvents::onBackBtn() { - LLPanelDirEvents* self = (LLPanelDirEvents*)data; - self->resetSearchStart(); - self->setDay(self->mDay - 1); - self->performQuery(); + resetSearchStart(); + setDay(mDay - 1); + performQuery(); } - -// static -void LLPanelDirEvents::onForwardBtn(void* data) +void LLPanelDirEvents::onForwardBtn() { - LLPanelDirEvents* self = (LLPanelDirEvents*)data; - self->resetSearchStart(); - self->setDay(self->mDay + 1); - self->performQuery(); + resetSearchStart(); + setDay(mDay + 1); + performQuery(); } - -// static -void LLPanelDirEvents::onClickDelete(void *userdata) +void LLPanelDirEvents::onClickDelete() { - LLPanelDirEvents *self = (LLPanelDirEvents *)userdata; - if (!self) return; - U32 event_id; - event_id = self->getSelectedEventID(); + event_id = getSelectedEventID(); if (!event_id) return; - self->performQueryOrDelete(event_id); + performQueryOrDelete(event_id); } diff --git a/indra/newview/llpaneldirevents.h b/indra/newview/llpaneldirevents.h index a74f1b3a4..f6f7db34f 100644 --- a/indra/newview/llpaneldirevents.h +++ b/indra/newview/llpaneldirevents.h @@ -57,12 +57,12 @@ public: void setDay(S32 day); protected: - static void onDateModeCallback(LLUICtrl* ctrl, void *data); - static void onBackBtn(void* data); - static void onForwardBtn(void* data); - static void onClickToday(void *userdata); - static void onClickSearch(void *data); - static void onClickDelete(void *data); + void onDateModeCallback(); + void onBackBtn(); + void onForwardBtn(); + void onClickToday(); + void onClickSearch(); + void onClickDelete(); protected: BOOL mDoneQuery; diff --git a/indra/newview/llpaneldirfind.cpp b/indra/newview/llpaneldirfind.cpp index a442a40a0..b380942f7 100644 --- a/indra/newview/llpaneldirfind.cpp +++ b/indra/newview/llpaneldirfind.cpp @@ -107,17 +107,17 @@ BOOL LLPanelDirFind::postBuild() { LLPanelDirBrowser::postBuild(); - childSetAction("back_btn", onClickBack, this); + getChild("back_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickBack,this)); if (hasChild("home_btn")) - childSetAction("home_btn", onClickHome, this); - childSetAction("forward_btn", onClickForward, this); - childSetAction("reload_btn", onClickRefresh, this); + getChild("home_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickHome,this)); + getChild("forward_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickForward,this)); + getChild("reload_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickRefresh,this)); if (hasChild("search_editor")) - childSetCommitCallback("search_editor", onCommitSearch, this); + getChild("search_editor")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickSearch,this)); if (hasChild("search_btn")) - childSetAction("search_btn", onClickSearch, this); + getChild("search_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickSearch,this)); if (hasChild("?")) - childSetAction("?", onClickHelp, this); + getChild("?")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickHelp,this)); // showcase doesn't have maturity flags -- it's all PG if (hasChild("incmature")) @@ -450,65 +450,47 @@ const std::string LLPanelDirFind::getSearchURLSuffix(bool inc_pg, bool inc_matur return url; } - -// static -void LLPanelDirFind::onClickBack( void* data ) +void LLPanelDirFind::onClickBack() { - LLPanelDirFind* self = ( LLPanelDirFind* )data; - if ( self->mWebBrowser ) + if ( mWebBrowser ) { - self->mWebBrowser->navigateBack(); + mWebBrowser->navigateBack(); } } -// static -void LLPanelDirFind::onClickHelp( void* data ) +void LLPanelDirFind::onClickHelp() { LLNotificationsUtil::add("ClickSearchHelpAll"); } -// static -void LLPanelDirFind::onClickForward( void* data ) +void LLPanelDirFind::onClickForward() { - LLPanelDirFind* self = ( LLPanelDirFind* )data; - if ( self->mWebBrowser ) + if ( mWebBrowser ) { - self->mWebBrowser->navigateForward(); + mWebBrowser->navigateForward(); } } -// static -void LLPanelDirFind::onClickHome( void* data ) +void LLPanelDirFind::onClickHome() { - LLPanelDirFind* self = ( LLPanelDirFind* )data; - if ( self->mWebBrowser ) + if ( mWebBrowser ) { - self->mWebBrowser->navigateHome(); + mWebBrowser->navigateHome(); } } -// static -void LLPanelDirFind::onClickRefresh( void* data ) +void LLPanelDirFind::onClickRefresh() { - LLPanelDirFind* self = ( LLPanelDirFind* )data; - if ( self->mWebBrowser ) + if ( mWebBrowser ) { - self->mWebBrowser->navigateTo(self->mWebBrowser->getCurrentNavUrl()); + mWebBrowser->navigateTo(mWebBrowser->getCurrentNavUrl()); } } -// static -void LLPanelDirFind::onCommitSearch(LLUICtrl*, void* data) +void LLPanelDirFind::onClickSearch() { - onClickSearch(data); -} - -// static -void LLPanelDirFind::onClickSearch(void* data) -{ - LLPanelDirFind* self = ( LLPanelDirFind* )data; - std::string search_text = self->childGetText("search_editor"); - self->search(search_text); + std::string search_text = childGetText("search_editor"); + search(search_text); LLFloaterDirectory::sNewSearchCount++; } @@ -573,9 +555,9 @@ BOOL LLPanelDirFindAllOld::postBuild() { LLPanelDirBrowser::postBuild(); - childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); + getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName,this,_1)); - childSetAction("Search", onClickSearch, this); + getChild("Search")->setCommitCallback(boost::bind(&LLPanelDirFindAllOld::onClickSearch,this)); childDisable("Search"); setDefaultBtn( "Search" ); @@ -597,33 +579,23 @@ void LLPanelDirFindAllOld::draw() LLPanelDirBrowser::draw(); } -// static -void LLPanelDirFindAllOld::onCommitScope(LLUICtrl* ctrl, void* data) +void LLPanelDirFindAllOld::onClickSearch() { - LLPanelDirFindAllOld* self = (LLPanelDirFindAllOld*)data; - self->setFocus(TRUE); -} - -// static -void LLPanelDirFindAllOld::onClickSearch(void *userdata) -{ - LLPanelDirFindAllOld *self = (LLPanelDirFindAllOld *)userdata; - - if (self->childGetValue("name").asString().length() < self->mMinSearchChars) + if (childGetValue("name").asString().length() < mMinSearchChars) { return; }; - BOOL inc_pg = self->childGetValue("incpg").asBoolean(); - BOOL inc_mature = self->childGetValue("incmature").asBoolean(); - BOOL inc_adult = self->childGetValue("incadult").asBoolean(); + BOOL inc_pg = childGetValue("incpg").asBoolean(); + BOOL inc_mature = childGetValue("incmature").asBoolean(); + BOOL inc_adult = childGetValue("incadult").asBoolean(); if (!(inc_pg || inc_mature || inc_adult)) { LLNotificationsUtil::add("NoContentToSearch"); return; } - self->setupNewSearch(); + setupNewSearch(); // Figure out scope U32 scope = 0x0; @@ -644,7 +616,7 @@ void LLPanelDirFindAllOld::onClickSearch(void *userdata) scope |= DFQ_INC_ADULT; } - if (self->hasChild("filter_gaming") && self->childGetValue("filter_gaming").asBoolean()) + if (hasChild("filter_gaming") && childGetValue("filter_gaming").asBoolean()) { scope |= DFQ_FILTER_GAMING; } @@ -652,7 +624,7 @@ void LLPanelDirFindAllOld::onClickSearch(void *userdata) // send the message LLMessageSystem *msg = gMessageSystem; S32 start_row = 0; - sendDirFindQuery(msg, self->mSearchID, self->childGetValue("name").asString(), scope, start_row); + sendDirFindQuery(msg, mSearchID, childGetValue("name").asString(), scope, start_row); // Also look up classified ads. JC 12/2005 BOOL filter_auto_renew = FALSE; @@ -662,8 +634,8 @@ void LLPanelDirFindAllOld::onClickSearch(void *userdata) msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); - msg->addUUID("QueryID", self->mSearchID); - msg->addString("QueryText", self->childGetValue("name").asString()); + msg->addUUID("QueryID", mSearchID); + msg->addString("QueryText", childGetValue("name").asString()); msg->addU32("QueryFlags", classified_flags); msg->addU32("Category", 0); // all categories msg->addS32("QueryStart", 0); @@ -689,8 +661,8 @@ void LLPanelDirFindAllOld::onClickSearch(void *userdata) msg->addUUID("AgentID", gAgent.getID() ); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); - msg->addUUID("QueryID", self->mSearchID ); - msg->addString("QueryText", self->childGetValue("name").asString()); + msg->addUUID("QueryID", mSearchID ); + msg->addString("QueryText", childGetValue("name").asString()); msg->addU32("QueryFlags", query_flags ); msg->addS32("QueryStart", 0 ); // Always get the first 100 when using find ALL msg->addS8("Category", LLParcel::C_ANY); diff --git a/indra/newview/llpaneldirfind.h b/indra/newview/llpaneldirfind.h index 931ab0737..8ec0e51aa 100644 --- a/indra/newview/llpaneldirfind.h +++ b/indra/newview/llpaneldirfind.h @@ -65,13 +65,12 @@ public: const std::string getSearchURLSuffix(bool inc_pg, bool inc_mature, bool inc_adult, bool is_web) const; private: - static void onClickBack( void* data ); - static void onClickForward( void* data ); - static void onClickHome( void* data ); - static void onClickRefresh( void* data ); - static void onClickSearch( void* data ); - static void onCommitSearch(LLUICtrl*, void* data); - static void onClickHelp( void* data ); + void onClickBack(); + void onClickForward(); + void onClickHome(); + void onClickRefresh(); + void onClickSearch(); + void onClickHelp(); // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); @@ -100,9 +99,7 @@ public: /*virtual*/ void draw(); - static void onClickSearch(void *userdata); - static void onCommitScope(LLUICtrl* ctrl, void* data); - static void onKeystrokeName(LLLineEditor* line, void* data); + void onClickSearch(); }; #endif diff --git a/indra/newview/llpaneldirgroups.cpp b/indra/newview/llpaneldirgroups.cpp index ac7102a30..6cdcdd538 100644 --- a/indra/newview/llpaneldirgroups.cpp +++ b/indra/newview/llpaneldirgroups.cpp @@ -55,9 +55,9 @@ BOOL LLPanelDirGroups::postBuild() { LLPanelDirBrowser::postBuild(); - childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); + getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName,this,_1)); - childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + getChild("Search")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); childDisable("Search"); setDefaultBtn( "Search" ); diff --git a/indra/newview/llpaneldirland.cpp b/indra/newview/llpaneldirland.cpp index 06b34570d..79c3a60a2 100644 --- a/indra/newview/llpaneldirland.cpp +++ b/indra/newview/llpaneldirland.cpp @@ -90,17 +90,17 @@ BOOL LLPanelDirLand::postBuild() childDisable("incadult"); } - childSetCommitCallback("pricecheck", onCommitPrice, this); - childSetCommitCallback("areacheck", onCommitArea, this); + getChild("pricecheck")->setCommitCallback(boost::bind(&LLPanelDirLand::onCommitPrice,this,_2)); + getChild("areacheck")->setCommitCallback(boost::bind(&LLPanelDirLand::onCommitArea, this,_2)); childSetValue("priceedit", gStatusBar->getBalance()); childSetEnabled("priceedit", gSavedSettings.getBOOL("FindLandPrice")); - childSetPrevalidate("priceedit", LLLineEditor::prevalidateNonNegativeS32); + getChild("priceedit")->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); childSetEnabled("areaedit", gSavedSettings.getBOOL("FindLandArea")); - childSetPrevalidate("areaedit", LLLineEditor::prevalidateNonNegativeS32); + getChild("areaedit")->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); - childSetAction("Search", onClickSearchCore, this); + getChild("Search")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); setDefaultBtn("Search"); childSetTextArg("pricecheck_symbol", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); @@ -111,7 +111,7 @@ BOOL LLPanelDirLand::postBuild() LLScrollListCtrl* results = getChild("results"); if (results) { - results->setSortChangedCallback(boost::bind(&LLPanelDirLand::onClickSort,this)); + results->setSortChangedCallback(boost::bind(&LLPanelDirLand::performQuery,this)); results->sortByColumn(mCurrentSortColumn,mCurrentSortAscending); LLStringUtil::format_map_t args; @@ -143,31 +143,14 @@ void LLPanelDirLand::draw() LLPanelDirBrowser::draw(); } -void LLPanelDirLand::onClickSort(void* data) +void LLPanelDirLand::onCommitPrice(const LLSD& value) { - LLPanelDirLand* self = (LLPanelDirLand*)data; - if (!self) return; - self->performQuery(); + childSetEnabled("priceedit", value.asBoolean()); } -// static -void LLPanelDirLand::onCommitPrice(LLUICtrl* ctrl, void* data) +void LLPanelDirLand::onCommitArea(const LLSD& value) { - LLPanelDirLand* self = (LLPanelDirLand*)data; - LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; - - if (!self || !check) return; - self->childSetEnabled("priceedit", check->get()); -} - -// static -void LLPanelDirLand::onCommitArea(LLUICtrl* ctrl, void* data) -{ - LLPanelDirLand* self = (LLPanelDirLand*)data; - LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; - - if (!self || !check) return; - self->childSetEnabled("areaedit", check->get()); + childSetEnabled("areaedit", value.asBoolean()); } void LLPanelDirLand::performQuery() diff --git a/indra/newview/llpaneldirland.h b/indra/newview/llpaneldirland.h index 9d1b5ac91..2f814f37e 100644 --- a/indra/newview/llpaneldirland.h +++ b/indra/newview/llpaneldirland.h @@ -50,9 +50,8 @@ public: void performQuery(); protected: - static void onClickSort(void* data); - static void onCommitPrice(LLUICtrl* ctrl, void* data); - static void onCommitArea(LLUICtrl* ctrl, void* data); + void onCommitPrice(const LLSD& value); + void onCommitArea(const LLSD& value); }; diff --git a/indra/newview/llpaneldirpeople.cpp b/indra/newview/llpaneldirpeople.cpp index a771db70c..308bad48f 100644 --- a/indra/newview/llpaneldirpeople.cpp +++ b/indra/newview/llpaneldirpeople.cpp @@ -52,9 +52,9 @@ BOOL LLPanelDirPeople::postBuild() { LLPanelDirBrowser::postBuild(); - childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); + getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName,this,_1)); - childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + getChild("Search")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); childDisable("Search"); setDefaultBtn( "Search" ); diff --git a/indra/newview/llpaneldirpeople.h b/indra/newview/llpaneldirpeople.h index fcc14149d..0e0b373a5 100644 --- a/indra/newview/llpaneldirpeople.h +++ b/indra/newview/llpaneldirpeople.h @@ -45,9 +45,6 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void performQuery(); - - static void onClickSearch(void *userdata); - static void onKeystrokeName(LLLineEditor* line, void* data); }; #endif diff --git a/indra/newview/llpaneldirplaces.cpp b/indra/newview/llpaneldirplaces.cpp index 43824da90..706d9013c 100644 --- a/indra/newview/llpaneldirplaces.cpp +++ b/indra/newview/llpaneldirplaces.cpp @@ -76,9 +76,9 @@ BOOL LLPanelDirPlaces::postBuild() { LLPanelDirBrowser::postBuild(); - childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); + getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName,this,_1)); - childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + getChild("Search")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); childDisable("Search"); mCurrentSortColumn = "dwell"; diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index a6a181014..fe381e59c 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -193,8 +193,7 @@ BOOL LLPanelDisplay::postBuild() } mCtrlAspectRatio = getChild( "aspect_ratio"); - mCtrlAspectRatio->setTextEntryCallback(&LLPanelDisplay::onKeystrokeAspectRatio); - mCtrlAspectRatio->setCallbackUserData(this); + mCtrlAspectRatio->setTextEntryCallback(boost::bind(&LLPanelDisplay::onKeystrokeAspectRatio,this)); mCtrlAspectRatio->setCommitCallback(boost::bind(&LLPanelDisplay::onSelectAspectRatio,this)); // add default aspect ratios mCtrlAspectRatio->add(aspect_ratio_text, &mAspectRatio, ADD_TOP); @@ -1031,11 +1030,9 @@ void LLPanelDisplay::onCommitAutoDetectAspect(const LLSD& value) } } -void LLPanelDisplay::onKeystrokeAspectRatio(LLLineEditor* caller, void *user_data) +void LLPanelDisplay::onKeystrokeAspectRatio() { - LLPanelDisplay* panel = (LLPanelDisplay*)user_data; - - panel->mCtrlAutoDetectAspect->set(FALSE); + mCtrlAutoDetectAspect->set(FALSE); } void LLPanelDisplay::onSelectAspectRatio() diff --git a/indra/newview/llpaneldisplay.h b/indra/newview/llpaneldisplay.h index 07b6b6dbe..9b39ee555 100644 --- a/indra/newview/llpaneldisplay.h +++ b/indra/newview/llpaneldisplay.h @@ -202,7 +202,7 @@ protected: static void onChangeCustom(); void onCommitAutoDetectAspect(const LLSD& value); - static void onKeystrokeAspectRatio(LLLineEditor* caller, void *user_data); + void onKeystrokeAspectRatio(); void onSelectAspectRatio(); void onCommitWindowedMode(); static void updateSliderText(LLUICtrl* ctrl, LLTextBox* text_box); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index e45f0608a..619f89e84 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -125,18 +125,14 @@ void LLPanelGroupTab::handleClickHelp() } } -LLPanelGroup::LLPanelGroup(const std::string& filename, - const std::string& name, - const LLUUID& group_id, - const std::string& initial_tab_selected) -: LLPanel(name, LLRect(), FALSE), +LLPanelGroup::LLPanelGroup(const LLUUID& group_id) +: LLPanel("PanelGroup", LLRect(), FALSE), LLGroupMgrObserver( group_id ), mCurrentTab( NULL ), mRequestedTab( NULL ), mTabContainer( NULL ), mIgnoreTransition( FALSE ), mForceClose( FALSE ), - mInitialTab(initial_tab_selected), mAllowEdit( TRUE ), mShowingNotifyDialog( FALSE ) { @@ -159,18 +155,14 @@ LLPanelGroup::LLPanelGroup(const std::string& filename, LLGroupMgr::getInstance()->addObserver(this); // Pass on construction of this panel to the control factory. - LLUICtrlFactory::getInstance()->buildPanel(this, filename, &getFactoryMap()); - mFilename = filename; + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap()); } LLPanelGroup::~LLPanelGroup() { LLGroupMgr::getInstance()->removeObserver(this); - int i; - int tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); @@ -181,10 +173,7 @@ LLPanelGroup::~LLPanelGroup() void LLPanelGroup::updateTabVisibility() { - S32 i; - S32 tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); @@ -211,38 +200,23 @@ BOOL LLPanelGroup::postBuild() if (mTabContainer) { - // Select the initial tab specified via constructor - const BOOL recurse = TRUE; - LLPanelGroupTab* tabp = - getChild(mInitialTab, recurse); + //our initial tab selection was invalid, just select the + //first tab then or default to selecting the initial + //selected tab specified in the layout file + LLPanelGroupTab* tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); + //no tab was initially selected through constructor + //or the XML, select the first tab if (!tabp) { - //our initial tab selection was invalid, just select the - //first tab then or default to selecting the initial - //selected tab specified in the layout file + mTabContainer->selectFirstTab(); tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); - - //no tab was initially selected through constructor - //or the XML, select the first tab - if (!tabp) - { - mTabContainer->selectFirstTab(); - tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); - } - } - else - { - mTabContainer->selectTabPanel(tabp); } mCurrentTab = tabp; // Add click callbacks. - S32 i; - S32 tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack @@ -342,8 +316,6 @@ void LLPanelGroup::handleClickTab() void LLPanelGroup::setGroupID(const LLUUID& group_id) { - LLRect rect(getRect()); - LLGroupMgr::getInstance()->removeObserver(this); mID = group_id; LLGroupMgr::getInstance()->addObserver(this); @@ -355,7 +327,7 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) // For now, rebuild panel //delete children and rebuild panel deleteAllChildren(); - LLUICtrlFactory::getInstance()->buildPanel(this, mFilename, &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap()); } void LLPanelGroup::selectTab(std::string tab_name) diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 52cb72f36..e652b96b6 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -38,7 +38,7 @@ struct LLOfferInfo; -const S32 UPDATE_MEMBERS_PER_FRAME = 500; +const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005; // 5ms // Forward declares class LLPanelGroupTab; @@ -58,10 +58,7 @@ class LLPanelGroup : public LLPanel, public LLPanelGroupTabObserver { public: - LLPanelGroup(const std::string& filename, - const std::string& name, - const LLUUID& group_id, - const std::string& initial_tab_selected = std::string()); + LLPanelGroup(const LLUUID& group_id); virtual ~LLPanelGroup(); virtual BOOL postBuild(); @@ -119,9 +116,6 @@ protected: BOOL mForceClose; - std::string mInitialTab; - std::string mFilename; - std::string mDefaultNeedsApplyMesg; std::string mWantApplyMesg; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 776f7fb9f..55b5b70ad 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -36,9 +36,10 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llavataractions.h" +#include "llfloatergroups.h" +#include "llgroupactions.h" #include "roles_constants.h" -#include "llfloateravatarinfo.h" -#include "llfloatergroupinfo.h" // UI elements #include "llbutton.h" @@ -133,13 +134,13 @@ BOOL LLPanelGroupGeneral::postBuild() mBtnJoinGroup = getChild("join_button", recurse); if ( mBtnJoinGroup ) { - mBtnJoinGroup->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickJoin, this)); + mBtnJoinGroup->setClickedCallback(boost::bind(LLGroupActions::join, mGroupID)); } mBtnInfo = getChild("info_button", recurse); if ( mBtnInfo ) { - mBtnInfo->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickInfo, this)); + mBtnInfo->setClickedCallback(boost::bind(LLGroupActions::show, mGroupID)); } LLTextBox* founder = getChild("founder_name"); @@ -154,7 +155,7 @@ BOOL LLPanelGroupGeneral::postBuild() mListVisibleMembers = getChild("visible_members", recurse); if (mListVisibleMembers) { - mListVisibleMembers->setDoubleClickCallback(boost::bind(&LLPanelGroupGeneral::openProfile,this)); + mListVisibleMembers->setDoubleClickCallback(boost::bind(LLAvatarActions::showProfile, boost::bind(&LLScrollListCtrl::getCurrentID, mListVisibleMembers))); } // Options @@ -322,83 +323,6 @@ void LLPanelGroupGeneral::onCommitTitle() mComboActiveTitle->resetDirty(); } -// static -void LLPanelGroupGeneral::onClickInfo(void *userdata) -{ - LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata; - - if ( !self ) return; - - lldebugs << "open group info: " << self->mGroupID << llendl; - - LLFloaterGroupInfo::showFromUUID(self->mGroupID); -} - -// static -void LLPanelGroupGeneral::onClickJoin(void *userdata) -{ - LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata; - - if ( !self ) return; - - lldebugs << "joining group: " << self->mGroupID << llendl; - - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID); - - if (gdatap) - { - S32 cost = gdatap->mMembershipFee; - LLSD args; - args["COST"] = llformat("%d", cost); - LLSD payload; - payload["group_id"] = self->mGroupID; - - if (can_afford_transaction(cost)) - { - LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, LLPanelGroupGeneral::joinDlgCB); - } - else - { - LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload); - } - } - else - { - llwarns << "LLGroupMgr::getInstance()->getGroupData(" << self->mGroupID - << ") was NULL" << llendl; - } -} - -// static -bool LLPanelGroupGeneral::joinDlgCB(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 1) - { - // user clicked cancel - return false; - } - - LLGroupMgr::getInstance()->sendGroupMemberJoin(notification["payload"]["group_id"].asUUID()); - return false; -} - -// static -void LLPanelGroupGeneral::openProfile(void* data) -{ - LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; - - if (self && self->mListVisibleMembers) - { - LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected(); - if (selected) - { - LLFloaterAvatarInfo::showFromDirectory( selected->getUUID() ); - } - } -} - bool LLPanelGroupGeneral::needsApply(std::string& mesg) { updateChanged(); @@ -568,7 +492,7 @@ void LLPanelGroupGeneral::cancel() // invoked from callbackConfirmMature bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); // 0 == Yes // 1 == No // 2 == Cancel @@ -593,7 +517,7 @@ bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLS // static bool LLPanelGroupGeneral::createGroupCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch(option) { case 0: @@ -684,6 +608,11 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) mComboActiveTitle->resetDirty(); } + // After role member data was changed in Roles->Members + // need to update role titles. See STORM-918. + if (gc == GC_ROLE_MEMBER_DATA) + LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID); + // If this was just a titles update, we are done. if (gc == GC_TITLES) return; @@ -867,71 +796,45 @@ void LLPanelGroupGeneral::updateMembers() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - if (!mListVisibleMembers || !gdatap - || !gdatap->isMemberDataComplete()) + if (!mListVisibleMembers + || !gdatap + || !gdatap->isMemberDataComplete() + || gdatap->mMembers.empty()) { return; } - static LLTimer all_timer; - static LLTimer sd_timer; - static LLTimer element_timer; + LLTimer update_time; + update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME); - all_timer.reset(); - S32 i = 0; + LLAvatarName av_name; - for( ; mMemberProgress != gdatap->mMembers.end() && imMembers.end() && !update_time.hasExpired(); + ++mMemberProgress) { - lldebugs << "Adding " << mMemberProgress->first << ", " << mMemberProgress->second->getTitle() << llendl; LLGroupMemberData* member = mMemberProgress->second; if (!member) { continue; } - // Owners show up in bold. - std::string style = "NORMAL"; - if ( member->isOwner() ) + + if (LLAvatarNameCache::get(mMemberProgress->first, &av_name)) { - style = "BOLD"; + addMember(mMemberProgress->second); + } + else + { + // If name is not cached, onNameCache() should be called when it is cached and add this member to list. + LLAvatarNameCache::get(mMemberProgress->first, + boost::bind(&LLPanelGroupGeneral::onNameCache, + this, gdatap->getMemberVersion(), member, _2)); } - - sd_timer.reset(); - LLSD row; - row["id"] = member->getID(); - - row["columns"][0]["column"] = "name"; - row["columns"][0]["font-style"] = style; - - // value is filled in by name list control - - row["columns"][1]["column"] = "title"; - row["columns"][1]["value"] = member->getTitle(); - row["columns"][1]["font-style"] = style; - - - row["columns"][2]["column"] = "online"; - row["columns"][2]["value"] = member->getOnlineStatus(); - row["columns"][2]["font-style"] = style; - - - sSDTime += sd_timer.getElapsedTimeF32(); - - element_timer.reset(); - mListVisibleMembers->addNameItem(row); - sElementTime += element_timer.getElapsedTimeF32(); } - sAllTime += all_timer.getElapsedTimeF32(); - lldebugs << "Updated " << i << " of " << UPDATE_MEMBERS_PER_FRAME << "members in the list." << llendl; if (mMemberProgress == gdatap->mMembers.end()) { lldebugs << " member list completed." << llendl; mListVisibleMembers->setEnabled(TRUE); - - lldebugs << "All Time: " << sAllTime << llendl; - lldebugs << "SD Time: " << sSDTime << llendl; - lldebugs << "Element Time: " << sElementTime << llendl; } else { @@ -940,6 +843,48 @@ void LLPanelGroupGeneral::updateMembers() } } +void LLPanelGroupGeneral::addMember(LLGroupMemberData* member) +{ + // Owners show up in bold. + std::string style = "NORMAL"; + if ( member->isOwner() ) + { + style = "BOLD"; + } + LLSD row; + row["id"] = member->getID(); + + row["columns"][0]["column"] = "name"; + row["columns"][0]["font-style"] = style; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + row["columns"][1]["column"] = "title"; + row["columns"][1]["value"] = member->getTitle(); + row["columns"][1]["font-style"] = style; + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + + row["columns"][2]["column"] = "online"; + row["columns"][2]["value"] = member->getOnlineStatus(); + row["columns"][2]["font-style"] = style; + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + + mListVisibleMembers->addNameItemRow(row); +} + +void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name) +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); + + if (!gdatap + || !gdatap->isMemberDataComplete() + || gdatap->getMemberVersion() != update_id) + { + // Stale data + return; + } + + addMember(member); +} + void LLPanelGroupGeneral::updateChanged() { // List all the controls we want to check for changes... diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 1c275d9aa..84058ac84 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -34,6 +34,7 @@ #define LL_LLPANELGROUPGENERAL_H #include "llpanelgroup.h" +#include "llavatarnamecache.h" class LLLineEditor; class LLTextBox; @@ -45,6 +46,7 @@ class LLCheckBoxCtrl; class LLComboBox; class LLNameBox; class LLSpinCtrl; +class LLGroupMemberData; class LLPanelGroupGeneral : public LLPanelGroupTab { @@ -66,18 +68,15 @@ public: virtual void draw(); + void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name); private: void onFocusEdit(); void onCommitAny(); void onCommitUserOnly(); void onCommitTitle(); void onCommitEnrollment(); - static void onClickJoin(void* userdata); - static void onClickInfo(void* userdata); static void onReceiveNotices(LLUICtrl* ctrl, void* data); - static void openProfile(void* data); - - static bool joinDlgCB(const LLSD& notification, const LLSD& response); + void addMember(LLGroupMemberData* member); void updateMembers(); void updateChanged(); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index c1c29be8d..6b4d0e680 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -39,6 +39,7 @@ #include "llbutton.h" #include "llcallingcard.h" #include "llcombobox.h" +#include "llgroupactions.h" #include "llgroupmgr.h" #include "llnamelistctrl.h" #include "llnotificationsutil.h" @@ -49,8 +50,6 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" -#include - class LLPanelGroupInvite::impl : public boost::signals2::trackable { public: @@ -183,7 +182,7 @@ void LLPanelGroupInvite::impl::submitInvitations() iter != items.end(); ++iter) { LLScrollListItem* item = *iter; - if(gdatap->mMembers.find(item->getUUID()) != gdatap->mMembers.end()) + if(LLGroupActions::isAvatarMemberOfGroup(mGroupID, item->getUUID())) { already_in_group = true; continue; diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 2f53e830c..26e77c6ba 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -47,8 +47,10 @@ #include "llscrolllistctrl.h" #include "lltextbox.h" #include "lltabcontainer.h" +#include "lltexteditor.h" #include "lltrans.h" #include "lltransactiontypes.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llstatusbar.h" @@ -57,7 +59,50 @@ #include "hippogridmanager.h" + //////////////////////////////////////////////////////////////////////////// +//************************************************* +//** LLGroupMoneyTabEventHandler::impl Functions ** +//************************************************* + +class LLGroupMoneyTabEventHandlerImpl +{ +public: + LLGroupMoneyTabEventHandlerImpl(LLButton* earlier_buttonp, + LLButton* later_buttonp, + LLTextEditor* text_editorp, + LLPanel* tabpanelp, + const std::string& loading_text, + const LLUUID& group_id, + S32 interval_length_days, + S32 max_interval_days); + ~LLGroupMoneyTabEventHandlerImpl(); + + bool getCanClickLater(); + bool getCanClickEarlier(); + + void updateButtons(); + + const LLUUID& getGroupID() const { return mGroupID;} + + +//member variables +public: + LLUUID mPanelID; + LLUUID mGroupID; + + LLPanel* mTabPanelp; + + int mIntervalLength; + int mMaxInterval; + int mCurrentInterval; + + LLTextEditor* mTextEditorp; + LLButton* mEarlierButtonp; + LLButton* mLaterButtonp; + + std::string mLoadingText; +}; class LLGroupMoneyTabEventHandler { @@ -84,11 +129,12 @@ public: static void clickLaterCallback(void* data); void clickTabCallback(const LLSD ¶m); + + static LLMap sInstanceIDs; static std::map sTabsToHandlers; protected: - class impl; - impl* mImplementationp; + LLGroupMoneyTabEventHandlerImpl* mImplementationp; }; class LLGroupMoneyDetailsTabEventHandler : public LLGroupMoneyTabEventHandler @@ -157,8 +203,8 @@ public: virtual void processGroupLand(LLMessageSystem* msg); static void mapCallback(void* data); - static void contributionCommitCallback(LLUICtrl* ctrl, void* userdata); - static void contributionKeystrokeCallback(LLLineEditor* caller, void* userdata); + void contributionCommitCallback(const LLSD& value); + void contributionKeystrokeCallback(LLLineEditor* caller); //member variables public: @@ -177,7 +223,6 @@ public: LLScrollListCtrl* mGroupParcelsp; - LLUUID mGroupID; LLUUID mTransID; bool mBeenActivated; @@ -186,14 +231,14 @@ public: std::string mCantViewParcelsText; std::string mCantViewAccountsText; + std::string mEmptyParcelsText; }; // ******************************************* // ** LLPanelGroupLandMoney::impl Functions ** // ******************************************* LLPanelGroupLandMoney::impl::impl(LLPanelGroupLandMoney& panel, const LLUUID& group_id) - : mPanel(panel), - mGroupID(group_id) + : mPanel(panel) { mTransID = LLUUID::null; @@ -226,7 +271,7 @@ void LLPanelGroupLandMoney::impl::requestGroupLandInfo() mTransID.generate(); mGroupParcelsp->deleteAllItems(); - send_places_query(mGroupID, mTransID, "", query_flags, LLParcel::C_ANY, ""); + send_places_query(mPanel.mGroupID, mTransID, "", query_flags, LLParcel::C_ANY, ""); } void LLPanelGroupLandMoney::impl::onMapButton() @@ -273,7 +318,7 @@ bool LLPanelGroupLandMoney::impl::applyContribution() new_contribution <= sqm_avail ) { // update group info and server - if(!gAgent.setGroupContribution(mGroupID, new_contribution)) + if(!gAgent.setGroupContribution(mPanel.mGroupID, new_contribution)) { // should never happen... llwarns << "Unable to set contribution." << llendl; @@ -300,7 +345,7 @@ int LLPanelGroupLandMoney::impl::getStoredContribution() LLGroupData group_data; group_data.mContribution = 0; - gAgent.getGroupData(mGroupID, group_data); + gAgent.getGroupData(mPanel.mGroupID, group_data); return group_data.mContribution; } @@ -318,7 +363,7 @@ void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib) void LLPanelGroupLandMoney::impl::setYourMaxContributionTextBox(int max) { - mPanel.childSetTextArg("your_contribution_max_value", "[AMOUNT]", llformat("%d", max)); + mPanel.getChild("your_contribution_max_value")->setTextArg("[AMOUNT]", llformat("%d", max)); } //static @@ -329,34 +374,25 @@ void LLPanelGroupLandMoney::impl::mapCallback(void* data) if ( selfp ) selfp->onMapButton(); } -void LLPanelGroupLandMoney::impl::contributionCommitCallback(LLUICtrl* ctrl, - void* userdata) +void LLPanelGroupLandMoney::impl::contributionCommitCallback(const LLSD& value) { - LLPanelGroupLandMoney* tabp = (LLPanelGroupLandMoney*) userdata; - LLLineEditor* editorp = (LLLineEditor*) ctrl; + int your_contribution = 0; + int new_contribution = 0; - if ( tabp && editorp ) - { - impl* self = tabp->mImplementationp; - int your_contribution = 0; - int new_contribution = 0; + new_contribution= value.asInteger(); + your_contribution = getStoredContribution(); - new_contribution= atoi(editorp->getText().c_str()); - your_contribution = self->getStoredContribution(); + //reset their junk data to be "good" data to us + setYourContributionTextField(new_contribution); - //reset their junk data to be "good" data to us - self->setYourContributionTextField(new_contribution); - - //check to see if they're contribution text has changed - self->mNeedsApply = new_contribution != your_contribution; - tabp->notifyObservers(); - } + //check to see if they're contribution text has changed + mNeedsApply = new_contribution != your_contribution; + mPanel.notifyObservers(); } -void LLPanelGroupLandMoney::impl::contributionKeystrokeCallback(LLLineEditor* caller, - void* userdata) +void LLPanelGroupLandMoney::impl::contributionKeystrokeCallback(LLLineEditor* caller) { - impl::contributionCommitCallback(caller, userdata); + contributionCommitCallback(caller->getValue()); } //static @@ -380,14 +416,14 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) S32 total_contribution; msg->getS32("QueryData", "ActualArea", total_contribution, 0); - mPanel.childSetTextArg("total_contributed_land_value", "[AREA]", llformat("%d", total_contribution)); + mPanel.getChild("total_contributed_land_value")->setTextArg("[AREA]", llformat("%d", total_contribution)); S32 committed; msg->getS32("QueryData", "BillableArea", committed, 0); - mPanel.childSetTextArg("total_land_in_use_value", "[AREA]", llformat("%d", committed)); + mPanel.getChild("total_land_in_use_value")->setTextArg("[AREA]", llformat("%d", committed)); S32 available = total_contribution - committed; - mPanel.childSetTextArg("land_available_value", "[AREA]", llformat("%d", available)); + mPanel.getChild("land_available_value")->setTextArg("[AREA]", llformat("%d", available)); if ( mGroupOverLimitTextp && mGroupOverLimitIconp ) { @@ -399,13 +435,8 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) if ( trans_id != mTransID ) return; // This power was removed to make group roles simpler //if ( !gAgent.hasPowerInGroup(mGroupID, GP_LAND_VIEW_OWNED) ) return; - if (!gAgent.isInGroup(mGroupID)) return; - - //we updated more than just the available area special block - if ( count > 1) - { - mMapButtonp->setEnabled(TRUE); - } + if (!gAgent.isInGroup(mPanel.mGroupID)) return; + mGroupParcelsp->setCommentText(mEmptyParcelsText); std::string name; std::string desc; @@ -558,6 +589,7 @@ void LLPanelGroupLandMoney::activate() mImplementationp->setYourMaxContributionTextBox(max_avail); } + mImplementationp->mMapButtonp->setEnabled(false); update(GC_ALL); } @@ -639,9 +671,8 @@ BOOL LLPanelGroupLandMoney::postBuild() { LLLineEditor* editor = mImplementationp->mYourContributionEditorp; - editor->setCommitCallback(mImplementationp->contributionCommitCallback); - editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback); - editor->setCallbackUserData(this); + editor->setCommitCallback(boost::bind(&LLPanelGroupLandMoney::impl::contributionCommitCallback, mImplementationp, _2)); + editor->setKeystrokeCallback(boost::bind(&LLPanelGroupLandMoney::impl::contributionKeystrokeCallback, mImplementationp, _1)); } mImplementationp->mMapButtonp = getChild("map_button"); @@ -649,6 +680,12 @@ BOOL LLPanelGroupLandMoney::postBuild() mImplementationp->mGroupParcelsp = getChild("group_parcel_list"); + if ( mImplementationp->mGroupParcelsp ) + { + mImplementationp->mGroupParcelsp->setCommitCallback(boost::bind(&LLPanelGroupLandMoney::onLandSelectionChanged, this)); + mImplementationp->mGroupParcelsp->setCommitOnSelectionChange(true); + } + mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text"); mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text"); @@ -771,6 +808,11 @@ BOOL LLPanelGroupLandMoney::postBuild() return LLPanelGroupTab::postBuild(); } +void LLPanelGroupLandMoney::onLandSelectionChanged() +{ + mImplementationp->mMapButtonp->setEnabled( mImplementationp->mGroupParcelsp->getItemCount() > 0 ); +} + BOOL LLPanelGroupLandMoney::isVisibleByAgent(LLAgent* agentp) { return mAllowEdit && agentp->isInGroup(mGroupID); @@ -794,47 +836,7 @@ void LLPanelGroupLandMoney::processPlacesReply(LLMessageSystem* msg, void**) selfp->mImplementationp->processGroupLand(msg); } -// ************************************************* -// ** LLGroupMoneyTabEventHandler::impl Functions ** -// ************************************************* - -class LLGroupMoneyTabEventHandler::impl -{ -public: - impl(LLButton* earlier_buttonp, - LLButton* later_buttonp, - LLTextEditor* text_editorp, - LLPanel* tabpanelp, - const std::string& loading_text, - const LLUUID& group_id, - S32 interval_length_days, - S32 max_interval_days); - ~impl(); - - bool getCanClickLater(); - bool getCanClickEarlier(); - - void updateButtons(); - -//member variables -public: - LLUUID mGroupID; - LLUUID mPanelID; - - LLPanel* mTabPanelp; - - int mIntervalLength; - int mMaxInterval; - int mCurrentInterval; - - LLTextEditor* mTextEditorp; - LLButton* mEarlierButtonp; - LLButton* mLaterButtonp; - - std::string mLoadingText; -}; - -LLGroupMoneyTabEventHandler::impl::impl(LLButton* earlier_buttonp, +LLGroupMoneyTabEventHandlerImpl::LLGroupMoneyTabEventHandlerImpl(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, LLPanel* tabpanelp, @@ -858,21 +860,21 @@ LLGroupMoneyTabEventHandler::impl::impl(LLButton* earlier_buttonp, mLoadingText = loading_text; } -LLGroupMoneyTabEventHandler::impl::~impl() +LLGroupMoneyTabEventHandlerImpl::~LLGroupMoneyTabEventHandlerImpl() { } -bool LLGroupMoneyTabEventHandler::impl::getCanClickEarlier() +bool LLGroupMoneyTabEventHandlerImpl::getCanClickEarlier() { return (mCurrentInterval < mMaxInterval); } -bool LLGroupMoneyTabEventHandler::impl::getCanClickLater() +bool LLGroupMoneyTabEventHandlerImpl::getCanClickLater() { return ( mCurrentInterval > 0 ); } -void LLGroupMoneyTabEventHandler::impl::updateButtons() +void LLGroupMoneyTabEventHandlerImpl::updateButtons() { if ( mEarlierButtonp ) { @@ -901,7 +903,7 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto S32 interval_length_days, S32 max_interval_days) { - mImplementationp = new impl(earlier_buttonp, + mImplementationp = new LLGroupMoneyTabEventHandlerImpl(earlier_buttonp, later_buttonp, text_editorp, panelp, @@ -924,7 +926,7 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto if ( tab_containerp && panelp ) { - tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::clickTabCallback, this, _2)); + tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::onClickTab, this)); } sInstanceIDs.addData(mImplementationp->mPanelID, this); @@ -996,14 +998,8 @@ void LLGroupMoneyTabEventHandler::clickLaterCallback(void* data) if ( selfp ) selfp->onClickLater(); } -void LLGroupMoneyTabEventHandler::clickTabCallback(const LLSD& param) -{ - if(param.asString() == "group_money_details_tab") - onClickTab(); -} - -// ************************************************** -// ** LLGroupMoneyDetailsTabEventHandler Functions ** +//************************************************** +//** LLGroupMoneyDetailsTabEventHandler Functions ** // ************************************************** LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp, @@ -1035,7 +1031,7 @@ void LLGroupMoneyDetailsTabEventHandler::requestData(LLMessageSystem* msg) msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->mGroupID ); + msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() ); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID ); msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength ); @@ -1056,7 +1052,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, { LLUUID group_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); - if (mImplementationp->mGroupID != group_id) + if (mImplementationp->getGroupID() != group_id) { llwarns << "Group Account details not for this group!" << llendl; return; @@ -1172,7 +1168,7 @@ void LLGroupMoneySalesTabEventHandler::requestData(LLMessageSystem* msg) msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->mGroupID ); + msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() ); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID ); msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength ); @@ -1193,7 +1189,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, { LLUUID group_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); - if (mImplementationp->mGroupID != group_id) + if (mImplementationp->getGroupID() != group_id) { llwarns << "Group Account Transactions not for this group!" << llendl; return; @@ -1346,7 +1342,7 @@ void LLGroupMoneyPlanningTabEventHandler::requestData(LLMessageSystem* msg) msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->mGroupID ); + msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() ); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID ); msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength); @@ -1367,7 +1363,7 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, { LLUUID group_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); - if (mImplementationp->mGroupID != group_id) + if (mImplementationp->getGroupID() != group_id) { llwarns << "Group Account Summary received not for this group!" << llendl; return; diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h index 591511a5f..86278b426 100644 --- a/indra/newview/llpanelgrouplandmoney.h +++ b/indra/newview/llpanelgrouplandmoney.h @@ -37,10 +37,6 @@ #include "llmap.h" #include "lluuid.h" -#include "llbutton.h" -#include "lltexteditor.h" -#include "llpanel.h" - class LLPanelGroupLandMoney : public LLPanelGroupTab { public: @@ -64,6 +60,8 @@ public: static void processGroupAccountDetailsReply(LLMessageSystem* msg, void** data); static void processGroupAccountTransactionsReply(LLMessageSystem* msg, void** data); static void processGroupAccountSummaryReply(LLMessageSystem* msg, void** data); + + virtual void onLandSelectionChanged(); protected: class impl; diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 630a28128..d341d3ce8 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -3,10 +3,9 @@ * @brief Panel for roles information about a particular group. * * $LicenseInfo:firstyear=2006&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2006-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 @@ -35,12 +34,15 @@ #include "llcheckboxctrl.h" #include "llagent.h" +#include "llavataractions.h" +#include "llavatarnamecache.h" #include "llbutton.h" -#include "llfloateravatarinfo.h" +#include "llfiltereditor.h" #include "llfloatergroupinvite.h" #include "lliconctrl.h" #include "lllineeditor.h" #include "llnamelistctrl.h" +#include "llnotifications.h" #include "llnotificationsutil.h" #include "llpanelgrouproles.h" #include "llscrolllistctrl.h" @@ -117,15 +119,13 @@ LLPanelGroupRoles::LLPanelGroupRoles(const std::string& name, const LLUUID& grou mCurrentTab(NULL), mRequestedTab( NULL ), mSubTabContainer( NULL ), - mFirstUse( TRUE ), - mIgnoreTransition( FALSE ) + mFirstUse( TRUE ) { } LLPanelGroupRoles::~LLPanelGroupRoles() { - int i; - for (i = 0; i < mSubTabContainer->getTabCount(); ++i) + for (S32 i = 0; i < mSubTabContainer->getTabCount(); ++i) { LLPanelGroupSubTab* subtabp = (LLPanelGroupSubTab*) mSubTabContainer->getPanelByIndex(i); @@ -142,20 +142,25 @@ BOOL LLPanelGroupRoles::postBuild() if (!mSubTabContainer) return FALSE; // Hook up each sub-tabs callback and widgets. - S32 i; - for (i = 0; i < mSubTabContainer->getTabCount(); ++i) + for (S32 i = 0; i < mSubTabContainer->getTabCount(); ++i) { - LLPanelGroupSubTab* subtabp = (LLPanelGroupSubTab*) mSubTabContainer->getPanelByIndex(i); + LLPanel* panel = mSubTabContainer->getPanelByIndex(i); + LLPanelGroupSubTab* subtabp = dynamic_cast(panel); + if (!subtabp) + { + llwarns << "Invalid subtab panel: " << panel->getName() << llendl; + return FALSE; + } // Hand the subtab a pointer to this LLPanelGroupRoles, so that it can // look around for the widgets it is interested in. - if (!subtabp->postBuildSubTab(this)) return FALSE; + if (!subtabp->postBuildSubTab(this)) + return FALSE; subtabp->addObserver(this); } - - // Add click callbacks to all the tabs. - mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab,this)); + // Add click callbacks to tab switching. + mSubTabContainer->setValidateBeforeCommit(boost::bind(&LLPanelGroupRoles::handleSubTabSwitch, this, _1)); // Set the current tab to whatever is currently being shown. mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); @@ -197,30 +202,17 @@ BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp) } -void LLPanelGroupRoles::handleClickSubTab() +bool LLPanelGroupRoles::handleSubTabSwitch(const LLSD& data) { - // If we are already handling a transition, - // ignore this. - if (mIgnoreTransition) + std::string panel_name = data.asString(); + + if(mRequestedTab != NULL)//we already have tab change request { - return; + return false; } - mRequestedTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); + mRequestedTab = static_cast(mSubTabContainer->getPanelByName(panel_name)); - // Make sure they aren't just clicking the same tab... - if (mRequestedTab == mCurrentTab) - { - return; - } - - // Try to switch from the current panel to the panel the user selected. - attemptTransition(); -} - -BOOL LLPanelGroupRoles::attemptTransition() -{ - // Check if the current tab needs to be applied. std::string mesg; if (mCurrentTab && mCurrentTab->needsApply(mesg)) { @@ -236,26 +228,14 @@ BOOL LLPanelGroupRoles::attemptTransition() LLNotificationsUtil::add("PanelGroupApply", args, LLSD(), boost::bind(&LLPanelGroupRoles::handleNotifyCallback, this, _1, _2)); mHasModal = TRUE; - // We need to reselect the current tab, since it isn't finished. - if (mSubTabContainer) - { - mIgnoreTransition = TRUE; - mSubTabContainer->selectTabPanel( mCurrentTab ); - mIgnoreTransition = FALSE; - } + // Returning FALSE will block a close action from finishing until // we get a response back from the user. - return FALSE; - } - else - { - // The current panel didn't have anything it needed to apply. - if (mRequestedTab) - { - transitionToTab(); - } - return TRUE; + return false; } + + transitionToTab(); + return true; } void LLPanelGroupRoles::transitionToTab() @@ -272,13 +252,15 @@ void LLPanelGroupRoles::transitionToTab() // This is now the current tab; mCurrentTab = mRequestedTab; mCurrentTab->activate(); + mRequestedTab = 0; } } bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); mHasModal = FALSE; + LLPanelGroupTab* transition_tab = mRequestedTab; switch (option) { case 0: // "Apply Changes" @@ -298,26 +280,20 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS // Skip switching tabs. break; } - - // This panel's info successfully applied. - // Switch to the next panel. - // No break! Continue into 'Ignore Changes' which just switches tabs. - mIgnoreTransition = TRUE; - mSubTabContainer->selectTabPanel( mRequestedTab ); - mIgnoreTransition = FALSE; transitionToTab(); + mSubTabContainer->selectTabPanel( transition_tab ); + break; } case 1: // "Ignore Changes" // Switch to the requested panel without applying changes cancel(); - mIgnoreTransition = TRUE; - mSubTabContainer->selectTabPanel( mRequestedTab ); - mIgnoreTransition = FALSE; transitionToTab(); + mSubTabContainer->selectTabPanel( transition_tab ); break; case 2: // "Cancel" default: + mRequestedTab = NULL; // Do nothing. The user is canceling the action. break; } @@ -470,9 +446,8 @@ LLPanelGroupSubTab::LLPanelGroupSubTab(const std::string& name, const LLUUID& gr : LLPanelGroupTab(name, group_id), mHeader(NULL), mFooter(NULL), - mSearchLineEditor(NULL), - mSearchButton(NULL), - mShowAllButton(NULL) + mActivated(false), + mSearchEditor(NULL) { } @@ -480,121 +455,47 @@ LLPanelGroupSubTab::~LLPanelGroupSubTab() { } +BOOL LLPanelGroupSubTab::postBuildSubTab(LLView* root) +{ + // Get icons for later use. + mActionIcons.clear(); + + if (hasString("power_folder_icon")) + { + mActionIcons["folder"] = getString("power_folder_icon"); + } + + if (hasString("power_all_have_icon")) + { + mActionIcons["full"] = getString("power_all_have_icon"); + } + + if (hasString("power_partial_icon")) + { + mActionIcons["partial"] = getString("power_partial_icon"); + } + return TRUE; +} + BOOL LLPanelGroupSubTab::postBuild() { // Hook up the search widgets. bool recurse = true; - mSearchLineEditor = getChild("search_text", recurse); + mSearchEditor = getChild("filter_input", recurse); - if (!mSearchLineEditor) return FALSE; - mSearchLineEditor->setKeystrokeCallback(onSearchKeystroke); - mSearchLineEditor->setCallbackUserData(this); + if (!mSearchEditor) + return FALSE; - mSearchButton = getChild("search_button", recurse); - - if (!mSearchButton) return FALSE; - mSearchButton->setClickedCallback(boost::bind(&LLPanelGroupSubTab::onClickSearch,this)); - mSearchButton->setEnabled(FALSE); - - mShowAllButton = getChild("show_all_button", recurse); - - if (!mShowAllButton) return FALSE; - mShowAllButton->setClickedCallback(boost::bind(&LLPanelGroupSubTab::onClickShowAll,this)); - mShowAllButton->setEnabled(FALSE); - - // Get icons for later use. - mActionIcons.clear(); - - bool no_recurse = false; - - LLIconCtrl* icon = getChild("power_folder_icon",no_recurse); - if (icon && !icon->getImageName().empty()) - { - mActionIcons["folder"] = icon->getImageName(); - removeChild(icon); - delete icon; - } - - icon = getChild("power_all_have_icon",no_recurse, false); - if (icon && !icon->getImageName().empty()) - { - mActionIcons["full"] = icon->getImageName(); - removeChild(icon); - delete icon; - } - - icon = getChild("power_partial_icon",no_recurse, false); - if (icon && !icon->getImageName().empty()) - { - mActionIcons["partial"] = icon->getImageName(); - removeChild(icon); - delete icon; - } + mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2)); return LLPanelGroupTab::postBuild(); } -// static -void LLPanelGroupSubTab::onSearchKeystroke(LLLineEditor* caller, void* user_data) -{ - LLPanelGroupSubTab* self = static_cast(user_data); - self->handleSearchKeystroke(caller); -} - -void LLPanelGroupSubTab::handleSearchKeystroke(LLLineEditor* caller) -{ - if (caller->getText().size()) - { - setDefaultBtn( mSearchButton ); - mSearchButton->setEnabled(TRUE); - } - else - { - setDefaultBtn( NULL ); - mSearchButton->setEnabled(FALSE); - } -} - -// static -void LLPanelGroupSubTab::onClickSearch(void* user_data) -{ - LLPanelGroupSubTab* self = static_cast(user_data); - self->handleClickSearch(); -} - -void LLPanelGroupSubTab::handleClickSearch() -{ - lldebugs << "LLPanelGroupSubTab::handleClickSearch()" << llendl; - - if (0 == mSearchLineEditor->getText().size()) - { - // No search text. (This shouldn't happen... the search button should have been disabled). - llwarns << "handleClickSearch with no search text!" << llendl; - mSearchButton->setEnabled(FALSE); - return; - } - - setSearchFilter( mSearchLineEditor->getText() ); - mShowAllButton->setEnabled(TRUE); -} - -// static -void LLPanelGroupSubTab::onClickShowAll(void* user_data) -{ - LLPanelGroupSubTab* self = static_cast(user_data); - self->handleClickShowAll(); -} - -void LLPanelGroupSubTab::handleClickShowAll() -{ - lldebugs << "LLPanelGroupSubTab::handleClickShowAll()" << llendl; - setSearchFilter( LLStringUtil::null ); - mShowAllButton->setEnabled(FALSE); -} void LLPanelGroupSubTab::setSearchFilter(const std::string& filter) { - lldebugs << "LLPanelGroupSubTab::setSearchFilter() ==> '" << filter << "'" << llendl; + if(mSearchFilter == filter) + return; mSearchFilter = filter; LLStringUtil::toLower(mSearchFilter); update(GC_ALL); @@ -875,6 +776,8 @@ LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab() BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) { + LLPanelGroupSubTab::postBuildSubTab(root); + // Upcast parent so we can ask it for sibling controls. LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root; @@ -1174,7 +1077,8 @@ void LLPanelGroupMembersSubTab::handleEjectMembers() for (itor = selection.begin() ; itor != selection.end(); ++itor) { - selected_members.push_back((*itor)->getUUID()); + LLUUID member_id = (*itor)->getUUID(); + selected_members.push_back( member_id ); } mMembersList->deleteSelectedItems(); @@ -1298,15 +1202,18 @@ void LLPanelGroupMembersSubTab::handleMemberDoubleClick() LLScrollListItem* selected = mMembersList->getFirstSelected(); if (selected) { - LLFloaterAvatarInfo::showFromDirectory( selected->getUUID() ); + LLAvatarActions::showProfile(selected->getUUID()); } } void LLPanelGroupMembersSubTab::activate() { LLPanelGroupSubTab::activate(); - - update(GC_ALL); + if(!mActivated) + { + update(GC_ALL); + mActivated = true; + } } void LLPanelGroupMembersSubTab::deactivate() @@ -1382,7 +1289,7 @@ bool LLPanelGroupMembersSubTab::apply(std::string& mesg) bool LLPanelGroupMembersSubTab::addOwnerCB(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); mHasModal = FALSE; if (0 == option) @@ -1468,13 +1375,20 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag return GP_NO_POWERS; } - LLGroupMemberData* member_data = gdatap->mMembers[agent_id]; - if ( !member_data ) + LLGroupMgrGroupData::member_list_t::iterator iter = gdatap->mMembers.find(agent_id); + if ( iter == gdatap->mMembers.end() ) { llwarns << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No member data for member with UUID " << agent_id << llendl; return GP_NO_POWERS; } + LLGroupMemberData* member_data = (*iter).second; + if (!member_data) + { + llwarns << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- Null member data for member with UUID " << agent_id << llendl; + return GP_NO_POWERS; + } + //see if there are unsaved role changes for this agent role_change_data_map_t* role_change_datap = NULL; member_role_changes_map_t::iterator member = mMemberRoleChangeData.find(agent_id); @@ -1581,9 +1495,6 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) return; } - // Rebuild the members list. - mMembersList->deleteAllItems(); - // Wait for both all data to be retrieved before displaying anything. if ( gdatap->isMemberDataComplete() && gdatap->isRoleDataComplete() @@ -1619,11 +1530,57 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) } } +void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) +{ + if (!data) return; + LLUIString donated = getString("donation_area"); + donated.setArg("[AREA]", llformat("%d", data->getContribution())); + + LLSD row; + row["id"] = data->getID(); + + row["columns"][0]["column"] = "name"; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + + row["columns"][1]["column"] = "donated"; + row["columns"][1]["value"] = donated.getString(); + + row["columns"][2]["column"] = "online"; + row["columns"][2]["value"] = data->getOnlineStatus(); + row["columns"][2]["font"] = "SANSSERIF_SMALL"; + mMembersList->addNameItemRow(row); + + mHasMatch = TRUE; +} + +void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name) +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); + if (!gdatap + || gdatap->getMemberVersion() != update_id + || !member) + { + return; + } + + // trying to avoid unnecessary hash lookups + std::string name; + LLAvatarNameCache::getPNSName(av_name, name); // Singu Note: Diverge from LL Viewer and filter by name displayed + if (matchesSearchFilter(name)) + { + addMemberToList(member); + if(!mMembersList->getEnabled()) + { + mMembersList->setEnabled(TRUE); + } + } +} + void LLPanelGroupMembersSubTab::updateMembers() { mPendingMemberUpdate = FALSE; - lldebugs << "LLPanelGroupMembersSubTab::updateMembers()" << llendl; + // Rebuild the members list. LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) @@ -1640,48 +1597,39 @@ void LLPanelGroupMembersSubTab::updateMembers() { return; } - + + //cleanup list only for first iteration + if(mMemberProgress == gdatap->mMembers.begin()) + { + mMembersList->deleteAllItems(); + } + + LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end(); - S32 i = 0; - for( ; mMemberProgress != end && isecond) continue; - // Do filtering on name if it is already in the cache. - bool add_member = true; + // Do filtering on name if it is already in the cache. + // Singu Note: Diverge from LL Viewer and filter by name displayed std::string fullname; - if (gCacheName->getFullName(mMemberProgress->first, fullname)) + if (LLAvatarNameCache::getPNSName(mMemberProgress->first, fullname)) { - if ( !matchesSearchFilter(fullname) ) + if (matchesSearchFilter(fullname)) { - add_member = false; + addMemberToList(mMemberProgress->second); } } - - if (add_member) + else { - // Build the donated tier string. - std::ostringstream donated; - donated << mMemberProgress->second->getContribution() << " sq. m."; - - LLSD row; - row["id"] = (*mMemberProgress).first; - - row["columns"][0]["column"] = "name"; - // value is filled in by name list control - - row["columns"][1]["column"] = "donated"; - row["columns"][1]["value"] = donated.str(); - - row["columns"][2]["column"] = "online"; - row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus(); - row["columns"][2]["font"] = "SANSSERIF_SMALL"; - - mMembersList->addNameItem(row); - mHasMatch = TRUE; + // If name is not cached, onNameCache() should be called when it is cached and add this member to list. + LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache, + this, gdatap->getMemberVersion(), mMemberProgress->second, _2)); } } @@ -1720,7 +1668,17 @@ void* LLPanelGroupRolesSubTab::createTab(void* data) } LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab(const std::string& name, const LLUUID& group_id) -: LLPanelGroupSubTab(name, group_id), mHasRoleChange(FALSE) +: LLPanelGroupSubTab(name, group_id), + mRolesList(NULL), + mAssignedMembersList(NULL), + mAllowedActionsList(NULL), + mRoleName(NULL), + mRoleTitle(NULL), + mRoleDescription(NULL), + mMemberVisibleCheck(NULL), + mDeleteRoleButton(NULL), + mCreateRoleButton(NULL), + mHasRoleChange(FALSE) { } @@ -1730,6 +1688,8 @@ LLPanelGroupRolesSubTab::~LLPanelGroupRolesSubTab() BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) { + LLPanelGroupSubTab::postBuildSubTab(root); + // Upcast parent so we can ask it for sibling controls. LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root; @@ -1775,27 +1735,20 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) } mRolesList->setCommitOnSelectionChange(TRUE); - mRolesList->setCallbackUserData(this); - mRolesList->setCommitCallback(onRoleSelect); + mRolesList->setCommitCallback(boost::bind(&LLPanelGroupRolesSubTab::onRoleSelect,_1,this)); - mMemberVisibleCheck->setCallbackUserData(this); - mMemberVisibleCheck->setCommitCallback(onMemberVisibilityChange); + mMemberVisibleCheck->setCommitCallback(boost::bind(&LLPanelGroupRolesSubTab::onMemberVisibilityChange,_1,this)); mAllowedActionsList->setCommitOnSelectionChange(TRUE); - mAllowedActionsList->setCallbackUserData(this); mRoleName->setCommitOnFocusLost(TRUE); - mRoleName->setCallbackUserData(this); - mRoleName->setKeystrokeCallback(onPropertiesKey); + mRoleName->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onPropertiesKey,_1,this)); mRoleTitle->setCommitOnFocusLost(TRUE); - mRoleTitle->setCallbackUserData(this); - mRoleTitle->setKeystrokeCallback(onPropertiesKey); + mRoleTitle->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onPropertiesKey,_1,this)); mRoleDescription->setCommitOnFocusLost(TRUE); - mRoleDescription->setCallbackUserData(this); - mRoleDescription->setCommitCallback(onDescriptionCommit); - mRoleDescription->setFocusReceivedCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionFocus, this)); + mRoleDescription->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionKeyStroke, this, _1)); setFooterEnabled(FALSE); @@ -1840,7 +1793,8 @@ bool LLPanelGroupRolesSubTab::apply(std::string& mesg) { lldebugs << "LLPanelGroupRolesSubTab::apply()" << llendl; - saveRoleChanges(); + saveRoleChanges(true); + LLGroupMgr::getInstance()->sendGroupRoleChanges(mGroupID); notifyObservers(); @@ -2019,7 +1973,7 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() return; } - saveRoleChanges(); + saveRoleChanges(false); // Check if there is anything selected. LLScrollListItem* item = mRolesList->getFirstSelected(); @@ -2201,7 +2155,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) { warning = "AssignDangerousAbilityWarning"; } - LLNotifications::instance().add(warning, args, LLSD(), boost::bind(&LLPanelGroupRolesSubTab::addActionCB, this, _1, _2, check)); + LLNotificationsUtil::add(warning, args, LLSD(), boost::bind(&LLPanelGroupRolesSubTab::addActionCB, this, _1, _2, check)); } else { @@ -2229,7 +2183,7 @@ bool LLPanelGroupRolesSubTab::addActionCB(const LLSD& notification, const LLSD& mHasModal = FALSE; - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { // User clicked "Yes" @@ -2251,7 +2205,7 @@ void LLPanelGroupRolesSubTab::onPropertiesKey(LLLineEditor* ctrl, void* user_dat self->notifyObservers(); } -void LLPanelGroupRolesSubTab::onDescriptionFocus() +void LLPanelGroupRolesSubTab::onDescriptionKeyStroke(LLTextEditor* caller) { mHasRoleChange = TRUE; notifyObservers(); @@ -2382,7 +2336,7 @@ void LLPanelGroupRolesSubTab::handleDeleteRole() notifyObservers(); } -void LLPanelGroupRolesSubTab::saveRoleChanges() +void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role) { LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); @@ -2397,13 +2351,23 @@ void LLPanelGroupRolesSubTab::saveRoleChanges() rd.mRoleDescription = mRoleDescription->getText(); rd.mRoleTitle = mRoleTitle->getText(); + S32 role_members_count = 0; + if (mSelectedRole.isNull()) + { + role_members_count = gdatap->mMemberCount; + } + else if(LLGroupRoleData* grd = get_ptr_in_map(gdatap->mRoles, mSelectedRole)) + { + role_members_count = grd->getTotalMembersInRole(); + } + gdatap->setRoleData(mSelectedRole,rd); mRolesList->deleteSingleItem(mRolesList->getItemIndex(mSelectedRole)); - LLSD row = createRoleItem(mSelectedRole,rd.mRoleName,rd.mRoleTitle,0); + LLSD row = createRoleItem(mSelectedRole,rd.mRoleName,rd.mRoleTitle,role_members_count); LLScrollListItem* item = mRolesList->addElement(row, ADD_BOTTOM, this); - item->setSelected(TRUE); + item->setSelected(select_saved_role); mHasRoleChange = FALSE; } @@ -2430,6 +2394,8 @@ LLPanelGroupActionsSubTab::~LLPanelGroupActionsSubTab() BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) { + LLPanelGroupSubTab::postBuildSubTab(root); + // Upcast parent so we can ask it for sibling controls. LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root; @@ -2446,13 +2412,9 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE; - mActionList->setCallbackUserData(this); mActionList->setCommitOnSelectionChange(TRUE); mActionList->setCommitCallback(boost::bind(&LLPanelGroupActionsSubTab::handleActionSelect, this)); - mActionMembers->setCallbackUserData(this); - mActionRoles->setCallbackUserData(this); - update(GC_ALL); return TRUE; @@ -2463,10 +2425,8 @@ void LLPanelGroupActionsSubTab::activate() LLPanelGroupSubTab::activate(); lldebugs << "LLPanelGroupActionsSubTab::activate()" << llendl; - mActionList->deselectAllItems(); - mActionMembers->deleteAllItems(); - mActionRoles->deleteAllItems(); - mActionDescription->clear(); + + update(GC_ALL); } void LLPanelGroupActionsSubTab::deactivate() diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 8ceac9b44..fe1103f2f 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -3,10 +3,9 @@ * @brief Panel for roles information about a particular group. * * $LicenseInfo:firstyear=2006&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2006-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 @@ -35,6 +34,8 @@ #include "llpanelgroup.h" +class LLAvatarName; +class LLFilterEditor; class LLNameListCtrl; class LLPanelGroupSubTab; class LLPanelGroupMembersSubTab; @@ -42,6 +43,8 @@ class LLPanelGroupRolesSubTab; class LLPanelGroupActionsSubTab; class LLScrollListCtrl; class LLScrollListItem; +class LLTextEditor; +class LLGroupMemberData; // Forward declare for friend usage. //virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*); @@ -64,7 +67,7 @@ public: virtual BOOL isVisibleByAgent(LLAgent* agentp); static void* createTab(void* data); - void handleClickSubTab(); + bool handleSubTabSwitch(const LLSD& data); // Checks if the current tab needs to be applied, and tries to switch to the requested tab. BOOL attemptTransition(); @@ -109,15 +112,7 @@ public: virtual BOOL postBuild(); // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy. - virtual BOOL postBuildSubTab(LLView* root) { return TRUE; } - - static void onSearchKeystroke(LLLineEditor* caller, void* user_data); - void handleSearchKeystroke(LLLineEditor* caller); - - static void onClickSearch(void*); - void handleClickSearch(); - static void onClickShowAll(void*); - void handleClickShowAll(); + virtual BOOL postBuildSubTab(LLView* root); virtual void setSearchFilter( const std::string& filter ); @@ -126,6 +121,9 @@ public: // Helper functions bool matchesActionSearchFilter(std::string action); + + void setFooterEnabled(BOOL enable); +protected: void buildActionsList(LLScrollListCtrl* ctrl, U64 allowed_by_some, U64 allowed_by_all, @@ -142,19 +140,18 @@ public: BOOL filter, BOOL is_owner_role); - void setFooterEnabled(BOOL enable); protected: LLPanel* mHeader; LLPanel* mFooter; - LLLineEditor* mSearchLineEditor; - LLButton* mSearchButton; - LLButton* mShowAllButton; + LLFilterEditor* mSearchEditor; std::string mSearchFilter; icon_map_t mActionIcons; + bool mActivated; + void setOthersVisible(BOOL b); }; @@ -197,6 +194,9 @@ public: virtual void draw(); + void addMemberToList(LLGroupMemberData* data); + void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name); + protected: typedef std::map role_change_data_map_t; typedef std::map member_role_changes_map_t; @@ -249,8 +249,9 @@ public: static void onPropertiesKey(LLLineEditor*, void*); + void onDescriptionKeyStroke(LLTextEditor* caller); + static void onDescriptionCommit(LLUICtrl*, void*); - void onDescriptionFocus(); static void onMemberVisibilityChange(LLUICtrl*, void*); void handleMemberVisibilityChange(bool value); @@ -261,7 +262,7 @@ public: static void onDeleteRole(void*); void handleDeleteRole(); - void saveRoleChanges(); + void saveRoleChanges(bool select_saved_role); protected: void handleActionCheck(LLUICtrl* ctrl, bool force); LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 1b2600a19..f2523b505 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -227,11 +227,11 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // instance management if (LLPanelLogin::sInstance) { - llwarns << "Duplicate instance of login view deleted" << llendl; - delete LLPanelLogin::sInstance; - + LL_WARNS("AppInit") << "Duplicate instance of login view deleted" << LL_ENDL; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); + + delete LLPanelLogin::sInstance; } LLPanelLogin::sInstance = this; @@ -259,17 +259,17 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, name_combo->setSuppressAutoComplete(true); childSetCommitCallback("remember_name_check", onNameCheckChanged); - childSetCommitCallback("password_edit", mungePassword); - childSetKeystrokeCallback("password_edit", onPassKey, this); - childSetUserData("password_edit", this); + + LLLineEditor* password_edit(getChild("password_edit")); + password_edit->setKeystrokeCallback(onPassKey); + // STEAM-14: When user presses Enter with this field in focus, initiate login + password_edit->setCommitCallback(mungePassword, this); + password_edit->setDrawAsterixes(TRUE); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); - LLLineEditor* edit = getChild("password_edit"); - if (edit) edit->setDrawAsterixes(TRUE); - //OGPX : This keeps the uris in a history file //OGPX TODO: should this be inside an OGP only check? LLComboBox* regioncombo = getChild("regionuri_edit"); @@ -347,14 +347,14 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLTextBox* channel_text = getChild("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); - channel_text->setClickedCallback(onClickVersion); - channel_text->setCallbackUserData(this); + channel_text->setClickedCallback(boost::bind(&LLPanelLogin::onClickVersion,(void*)NULL)); LLTextBox* forgot_password_text = getChild("forgot_password_text"); - forgot_password_text->setClickedCallback(onClickForgotPassword); + forgot_password_text->setClickedCallback(boost::bind(&onClickForgotPassword)); + LLTextBox* create_new_account_text = getChild("create_new_account_text"); - create_new_account_text->setClickedCallback(onClickNewAccount); + create_new_account_text->setClickedCallback(boost::bind(&onClickNewAccount)); #endif // get the web browser control @@ -371,16 +371,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // make links open in external browser web_browser->setOpenInExternalBrowser( true ); - // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) - LLRect htmlRect = getRect(); -#if USE_VIEWER_AUTH - htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); -#else - htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); -#endif - web_browser->setRect( htmlRect ); - web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); - reshape( getRect().getWidth(), getRect().getHeight(), 1 ); + reshapeBrowser(); updateGridCombo(); @@ -455,6 +446,26 @@ void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data) } } +// force the size to be correct (XML doesn't seem to be sufficient to do this) +// (with some padding so the other login screen doesn't show through) +void LLPanelLogin::reshapeBrowser() +{ + LLMediaCtrl* web_browser = getChild("login_html"); + LLRect rect = gViewerWindow->getWindowRectScaled(); + LLRect html_rect; + html_rect.setCenterAndSize( +#if USE_VIEWER_AUTH + rect.getCenterX() - 2, rect.getCenterY(), + rect.getWidth() + 6, rect.getHeight()); +#else + rect.getCenterX() - 2, rect.getCenterY() + 40, + rect.getWidth() + 6, rect.getHeight() - 78 ); +#endif + web_browser->setRect( html_rect ); + web_browser->reshape( html_rect.getWidth(), html_rect.getHeight(), TRUE ); + reshape( rect.getWidth(), rect.getHeight(), 1 ); +} + LLPanelLogin::~LLPanelLogin() { LLPanelLogin::sInstance = NULL; @@ -603,33 +614,37 @@ void LLPanelLogin::giveFocus() if( sInstance ) { // Grab focus and move cursor to first blank input field - std::string first = sInstance->getChild("name_combo")->getTextEntry(); - std::string pass = sInstance->childGetText("password_edit"); + std::string username = sInstance->getChild("username_combo")->getValue().asString(); + std::string pass = sInstance->getChild("password_edit")->getValue().asString(); - BOOL have_first = !first.empty(); + BOOL have_username = !username.empty(); BOOL have_pass = !pass.empty(); - if (!have_first) + LLLineEditor* edit = NULL; + LLUICtrl* combo = NULL; + if (have_username) { - // User doesn't have a name, so start there. - LLComboBox* combo = sInstance->getChild("name_combo"); - combo->setFocusText(TRUE); - } - else if (!have_pass) - { - LLLineEditor* edit = NULL; + if(have_pass) + combo = sInstance->getChild("connect_btn"); + else // User saved his name but not his password. Move // focus to password field. edit = sInstance->getChild("password_edit"); - edit->setFocus(TRUE); - edit->selectAll(); } else { - // else, we have both name and password. - // We get here waiting for the login to happen. - LLButton* connect_btn = sInstance->getChild("connect_btn"); - connect_btn->setFocus(TRUE); + // User doesn't have a name, so start there. + combo = sInstance->getChild("username_combo"); + } + + if (edit) + { + edit->setFocus(TRUE); + edit->selectAll(); + } + else if (combo) + { + combo->setFocus(TRUE); } } #endif @@ -827,13 +842,14 @@ void LLPanelLogin::close() // static void LLPanelLogin::setAlwaysRefresh(bool refresh) { - if (LLStartUp::getStartupState() >= STATE_LOGIN_CLEANUP) return; - - LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - - if (web_browser) + if (sInstance && LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) { - web_browser->setAlwaysRefresh(refresh); + LLMediaCtrl* web_browser = sInstance->getChild("login_html"); + + if (web_browser) + { + web_browser->setAlwaysRefresh(refresh); + } } } @@ -893,7 +909,7 @@ void LLPanelLogin::loadLoginPage() if (!sInstance) return; sInstance->updateGridCombo(); - std::ostringstream oStr; + std::ostringstream login_uri; std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage(); if (login_page.empty()) @@ -902,7 +918,7 @@ void LLPanelLogin::loadLoginPage() return; } - oStr << login_page; + login_uri << login_page; // Use the right delimeter depending on how LLURI parses the URL LLURI login_page_uri = LLURI(login_page); @@ -914,20 +930,20 @@ void LLPanelLogin::loadLoginPage() // Language std::string language = LLUI::getLanguage(); - oStr << first_query_delimiter<<"lang=" << language; + login_uri << first_query_delimiter<<"lang=" << language; // First Login? if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { - oStr << "&firstlogin=TRUE"; + login_uri << "&firstlogin=TRUE"; } std::string version = llformat("%d.%d.%d (%d)", gVersionMajor, gVersionMinor, gVersionPatch, gVersionBuild); if(login_page.find("secondlife.com") == -1) { - oStr << "&channel=" << LLWeb::curlEscape(gVersionChannel); - oStr << "&version=" << LLWeb::curlEscape(version); + login_uri << "&channel=" << LLWeb::curlEscape(gVersionChannel); + login_uri << "&version=" << LLWeb::curlEscape(version); } // Grid @@ -944,16 +960,16 @@ void LLPanelLogin::loadLoginPage() i = tmp.rfind('/'); if (i != std::string::npos) { tmp = tmp.substr(i+1); - oStr << "&grid=" << LLWeb::curlEscape(tmp); + login_uri << "&grid=" << LLWeb::curlEscape(tmp); } } } else if (gHippoGridManager->getConnectedGrid()->isOpenSimulator()){ - oStr << "&grid=" << gHippoGridManager->getConnectedGrid()->getGridNick(); + login_uri << "&grid=" << gHippoGridManager->getConnectedGrid()->getGridNick(); } else if (gHippoGridManager->getConnectedGrid()->getPlatform() == HippoGridInfo::PLATFORM_AURORA) { - oStr << "&grid=" << LLWeb::curlEscape(LLViewerLogin::getInstance()->getGridLabel()); + login_uri << "&grid=" << LLWeb::curlEscape(LLViewerLogin::getInstance()->getGridLabel()); } @@ -1011,59 +1027,47 @@ void LLPanelLogin::loadLoginPage() std::string curl_region = LLWeb::curlEscape(region); - oStr <<"firstname=" << firstname << + login_uri <<"firstname=" << firstname << "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region; if (!password.empty()) { - oStr << "&password=" << password; + login_uri << "&password=" << password; } else if (!(password = load_password_from_disk()).empty()) { - oStr << "&password=$1$" << password; + login_uri << "&password=$1$" << password; } if (gAutoLogin) { - oStr << "&auto_login=TRUE"; + login_uri << "&auto_login=TRUE"; } if (gSavedSettings.getBOOL("ShowStartLocation")) { - oStr << "&show_start_location=TRUE"; + login_uri << "&show_start_location=TRUE"; } if (gSavedSettings.getBOOL("RememberPassword")) { - oStr << "&remember_password=TRUE"; + login_uri << "&remember_password=TRUE"; } BOOL show_server = sInstance ? sInstance->mShowServerCombo : FALSE; if (show_server || gSavedSettings.getBOOL("ForceShowGrid")) { - oStr << "&show_grid=TRUE"; + login_uri << "&show_grid=TRUE"; } #endif LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - // navigate to the "real" page - web_browser->navigateTo( oStr.str(), "text/html" ); + if (web_browser->getCurrentNavUrl() != login_uri.str()) + { + LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL; + web_browser->navigateTo( login_uri.str(), "text/html" ); + } } void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent event) { - if(event == MEDIA_EVENT_NAVIGATE_COMPLETE) - { - LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - if (web_browser) - { - // *HACK HACK HACK HACK! - /* Stuff a Tab key into the browser now so that the first field will - ** get the focus! The embedded javascript on the page that properly - ** sets the initial focus in a real web browser is not working inside - ** the viewer, so this is an UGLY HACK WORKAROUND for now. - */ - // Commented out as it's not reliable - //web_browser->handleKey(KEY_TAB, MASK_NONE, false); - } - } } @@ -1141,7 +1145,7 @@ bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& // static -void LLPanelLogin::onClickNewAccount(void*) +void LLPanelLogin::onClickNewAccount() { const std::string &url = gHippoGridManager->getConnectedGrid()->getRegisterUrl(); if (!url.empty()) { @@ -1191,7 +1195,7 @@ void LLPanelLogin::onClickVersion(void*) } //static -void LLPanelLogin::onClickForgotPassword(void*) +void LLPanelLogin::onClickForgotPassword() { if (sInstance ) { @@ -1205,7 +1209,7 @@ void LLPanelLogin::onClickForgotPassword(void*) } // static -void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) +void LLPanelLogin::onPassKey(LLLineEditor* caller) { if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) { diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 1812b6fc7..a8cbecde7 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -103,15 +103,16 @@ public: /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); private: + void reshapeBrowser(); static void onClickConnect(void*); - static void onClickNewAccount(void*); + static void onClickNewAccount(); static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response); static void onClickGrids(void*); static void onSelectGrid(LLUICtrl *ctrl, void*); static void onClickQuit(void*); static void onClickVersion(void*); - static void onClickForgotPassword(void*); - static void onPassKey(LLLineEditor* caller, void* user_data); + static void onClickForgotPassword(); + static void onPassKey(LLLineEditor* caller); //static void onSelectServer(LLUICtrl*, void*); //static void onServerComboLostFocus(LLFocusableElement*, void*); static void onSelectLoginEntry(LLUICtrl*, void*); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index dac3c99ce..eb5e430b8 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -30,6 +30,7 @@ #include "llagent.h" #include "llagentcamera.h" #include "lleconomy.h" +#include "llfiltereditor.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" @@ -198,10 +199,10 @@ BOOL LLInventoryView::postBuild() } - mSearchEditor = getChild("inventory search editor"); - if (mSearchEditor) + mFilterEditor = getChild("inventory search editor"); + if (mFilterEditor) { - mSearchEditor->setSearchCallback(onSearchEdit, this); + mFilterEditor->setCommitCallback(boost::bind(&LLInventoryView::onFilterEdit, this, _2)); } mQuickFilterCombo = getChild("Quick Filter"); @@ -281,9 +282,9 @@ LLInventoryView::~LLInventoryView( void ) void LLInventoryView::startSearch() { // this forces focus to line editor portion of search editor - if (mSearchEditor) + if (mFilterEditor) { - mSearchEditor->focusFirstItem(TRUE); + mFilterEditor->focusFirstItem(TRUE); } } @@ -338,8 +339,8 @@ BOOL LLInventoryView::handleKeyHere(KEY key, MASK mask) if (root_folder) { // first check for user accepting current search results - if (mSearchEditor - && mSearchEditor->hasFocus() + if (mFilterEditor + && mFilterEditor->hasFocus() && (key == KEY_RETURN || key == KEY_DOWN) && mask == MASK_NONE) @@ -513,17 +514,13 @@ BOOL LLInventoryView::filtersVisible(void* user_data) return self->getFinder() != NULL; } -// static -void LLInventoryView::onClearSearch(void* user_data) +void LLInventoryView::onClearSearch() { - LLInventoryView* self = (LLInventoryView*)user_data; - if(!self) return; - - LLFloater *finder = self->getFinder(); - if (self->mActivePanel) + LLFloater *finder = getFinder(); + if (mActivePanel) { - self->mActivePanel->setFilterSubString(LLStringUtil::null); - self->mActivePanel->setFilterTypes(0xffffffff); + mActivePanel->setFilterSubString(LLStringUtil::null); + mActivePanel->setFilterTypes(0xffffffffffffffffULL); } if (finder) @@ -532,26 +529,24 @@ void LLInventoryView::onClearSearch(void* user_data) } // re-open folders that were initially open - if (self->mActivePanel) + if (mActivePanel) { - self->mSavedFolderState->setApply(TRUE); - self->mActivePanel->getRootFolder()->applyFunctorRecursively(*self->mSavedFolderState); + mSavedFolderState->setApply(TRUE); + mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; - self->mActivePanel->getRootFolder()->applyFunctorRecursively(opener); - self->mActivePanel->getRootFolder()->scrollToShowSelection(); + mActivePanel->getRootFolder()->applyFunctorRecursively(opener); + mActivePanel->getRootFolder()->scrollToShowSelection(); } //self->mFilterSubString = ""; } -//static -void LLInventoryView::onSearchEdit(const std::string& search_string, void* user_data ) +void LLInventoryView::onFilterEdit(const std::string& search_string ) { if (search_string == "") { - onClearSearch(user_data); + onClearSearch(); } - LLInventoryView* self = (LLInventoryView*)user_data; - if (!self->mActivePanel) + if (!mActivePanel) { return; } @@ -562,21 +557,21 @@ void LLInventoryView::onSearchEdit(const std::string& search_string, void* user_ std::string filter_text = search_string; std::string uppercase_search_string = filter_text; LLStringUtil::toUpper(uppercase_search_string); - if (self->mActivePanel->getFilterSubString().empty() && uppercase_search_string.empty() /*self->mFilterSubString.empty()*/) + if (mActivePanel->getFilterSubString().empty() && uppercase_search_string.empty() /*self->mFilterSubString.empty()*/) { // current filter and new filter empty, do nothing return; } // save current folder open state if no filter currently applied - if (!self->mActivePanel->getRootFolder()->isFilterModified()) + if (!mActivePanel->getRootFolder()->isFilterModified()) { - self->mSavedFolderState->setApply(FALSE); - self->mActivePanel->getRootFolder()->applyFunctorRecursively(*self->mSavedFolderState); + mSavedFolderState->setApply(FALSE); + mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); } // set new filter string - self->mActivePanel->setFilterSubString(uppercase_search_string/*self->mFilterSubString*/); + mActivePanel->setFilterSubString(uppercase_search_string/*self->mFilterSubString*/); } struct FilterEntry : public LLDictionaryEntry @@ -726,11 +721,11 @@ void LLInventoryView::onResetAll(void* userdata) { return; } - if (self->mActivePanel && self->mSearchEditor) + if (self->mActivePanel && self->mFilterEditor) { - self->mSearchEditor->setText(LLStringUtil::null); + self->mFilterEditor->setText(LLStringUtil::null); } - self->onSearchEdit("",userdata); + self->onFilterEdit(""); self->mActivePanel->closeAllFolders(); } @@ -827,9 +822,9 @@ void LLInventoryView::changed(U32 mask) void LLInventoryView::draw() { - if (mActivePanel && mSearchEditor) + if (mActivePanel && mFilterEditor) { - mSearchEditor->setText(mActivePanel->getFilterSubString()); + mFilterEditor->setText(mActivePanel->getFilterSubString()); } if (mActivePanel && mQuickFilterCombo) @@ -989,55 +984,56 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() // update the ui elements LLFloater::setTitle(mFilter->getName()); - childSetValue("check_animation", (S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION)); - childSetValue("check_calling_card", (S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD)); - childSetValue("check_clothing", (S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE)); - childSetValue("check_gesture", (S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE)); - childSetValue("check_landmark", (S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK)); - childSetValue("check_notecard", (S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD)); - childSetValue("check_object", (S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT)); - childSetValue("check_script", (S32) (filter_types & 0x1 << LLInventoryType::IT_LSL)); - childSetValue("check_sound", (S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND)); - childSetValue("check_texture", (S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE)); - childSetValue("check_snapshot", (S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT)); - childSetValue("check_show_empty", show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); - childSetValue("check_since_logoff", mFilter->isSinceLogoff()); + getChild("check_animation")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION)); + + getChild("check_calling_card")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD)); + getChild("check_clothing")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE)); + getChild("check_gesture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE)); + getChild("check_landmark")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK)); + getChild("check_notecard")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD)); + getChild("check_object")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT)); + getChild("check_script")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL)); + getChild("check_sound")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND)); + getChild("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE)); + getChild("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT)); + getChild("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); + getChild("check_since_logoff")->setValue(mFilter->isSinceLogoff()); mSpinSinceHours->set((F32)(hours % 24)); mSpinSinceDays->set((F32)(hours / 24)); } void LLFloaterInventoryFinder::draw() { - U32 filter = 0xffffffff; + U64 filter = 0xffffffffffffffffULL; BOOL filtered_by_all_types = TRUE; - if (!childGetValue("check_animation")) + if (!getChild("check_animation")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_ANIMATION); filtered_by_all_types = FALSE; } - if (!childGetValue("check_calling_card")) + if (!getChild("check_calling_card")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD); filtered_by_all_types = FALSE; } - if (!childGetValue("check_clothing")) + if (!getChild("check_clothing")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_WEARABLE); filtered_by_all_types = FALSE; } - if (!childGetValue("check_gesture")) + if (!getChild("check_gesture")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_GESTURE); filtered_by_all_types = FALSE; } - if (!childGetValue("check_landmark")) + if (!getChild("check_landmark")->getValue()) { @@ -1045,38 +1041,39 @@ void LLFloaterInventoryFinder::draw() filtered_by_all_types = FALSE; } - if (!childGetValue("check_notecard")) + + if (!getChild("check_notecard")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_NOTECARD); filtered_by_all_types = FALSE; } - if (!childGetValue("check_object")) + if (!getChild("check_object")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_OBJECT); filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT); filtered_by_all_types = FALSE; } - if (!childGetValue("check_script")) + if (!getChild("check_script")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_LSL); filtered_by_all_types = FALSE; } - if (!childGetValue("check_sound")) + if (!getChild("check_sound")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SOUND); filtered_by_all_types = FALSE; } - if (!childGetValue("check_texture")) + if (!getChild("check_texture")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_TEXTURE); filtered_by_all_types = FALSE; } - if (!childGetValue("check_snapshot")) + if (!getChild("check_snapshot")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT); filtered_by_all_types = FALSE; @@ -1131,12 +1128,12 @@ void LLFloaterInventoryFinder::onClose(bool app_quitting) BOOL LLFloaterInventoryFinder::getCheckShowEmpty() { - return childGetValue("check_show_empty"); + return getChild("check_show_empty")->getValue(); } BOOL LLFloaterInventoryFinder::getCheckSinceLogoff() { - return childGetValue("check_since_logoff"); + return getChild("check_since_logoff")->getValue(); } void LLFloaterInventoryFinder::onCloseBtn(void* user_data) @@ -1151,17 +1148,17 @@ void LLFloaterInventoryFinder::selectAllTypes(void* user_data) LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data; if(!self) return; - self->childSetValue("check_animation", TRUE); - self->childSetValue("check_calling_card", TRUE); - self->childSetValue("check_clothing", TRUE); - self->childSetValue("check_gesture", TRUE); - self->childSetValue("check_landmark", TRUE); - self->childSetValue("check_notecard", TRUE); - self->childSetValue("check_object", TRUE); - self->childSetValue("check_script", TRUE); - self->childSetValue("check_sound", TRUE); - self->childSetValue("check_texture", TRUE); - self->childSetValue("check_snapshot", TRUE); + self->getChild("check_animation")->setValue(TRUE); + self->getChild("check_calling_card")->setValue(TRUE); + self->getChild("check_clothing")->setValue(TRUE); + self->getChild("check_gesture")->setValue(TRUE); + self->getChild("check_landmark")->setValue(TRUE); + self->getChild("check_notecard")->setValue(TRUE); + self->getChild("check_object")->setValue(TRUE); + self->getChild("check_script")->setValue(TRUE); + self->getChild("check_sound")->setValue(TRUE); + self->getChild("check_texture")->setValue(TRUE); + self->getChild("check_snapshot")->setValue(TRUE); } //static @@ -1170,15 +1167,15 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data) LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data; if(!self) return; - self->childSetValue("check_animation", FALSE); - self->childSetValue("check_calling_card", FALSE); - self->childSetValue("check_clothing", FALSE); - self->childSetValue("check_gesture", FALSE); - self->childSetValue("check_landmark", FALSE); - self->childSetValue("check_notecard", FALSE); - self->childSetValue("check_object", FALSE); - self->childSetValue("check_script", FALSE); - self->childSetValue("check_sound", FALSE); - self->childSetValue("check_texture", FALSE); - self->childSetValue("check_snapshot", FALSE); + self->getChild("check_animation")->setValue(FALSE); + self->getChild("check_calling_card")->setValue(FALSE); + self->getChild("check_clothing")->setValue(FALSE); + self->getChild("check_gesture")->setValue(FALSE); + self->getChild("check_landmark")->setValue(FALSE); + self->getChild("check_notecard")->setValue(FALSE); + self->getChild("check_object")->setValue(FALSE); + self->getChild("check_script")->setValue(FALSE); + self->getChild("check_sound")->setValue(FALSE); + self->getChild("check_texture")->setValue(FALSE); + self->getChild("check_snapshot")->setValue(FALSE); } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index dee764118..c19befd78 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -42,7 +42,7 @@ class LLMenuButton; class LLMenuGL; class LLToggleableMenu; class LLFloater; -class LLSearchEditor; +class LLFilterEditor; class LLComboBox; class LLFloaterInventoryFinder; @@ -91,7 +91,7 @@ public: const std::string& getFilterText() const { return mFilterText; } void setSelectCallback(const LLFolderView::signal_t::slot_type& cb); - static void onSearchEdit(const std::string& search_string, void* user_data ); + void onFilterEdit(const std::string& search_string); // // Misc functions // @@ -102,7 +102,7 @@ public: void onSelectionChange(LLInventoryPanel *panel, const std::deque& items, BOOL user_action); static BOOL filtersVisible(void* user_data); - static void onClearSearch(void* user_data); + void onClearSearch(); static void onFoldersByName(void *user_data); static BOOL checkFoldersByName(void *user_data); @@ -161,7 +161,7 @@ protected: protected: LLFloaterInventoryFinder* getFinder(); - LLSearchEditor* mSearchEditor; + LLFilterEditor* mFilterEditor; LLComboBox* mQuickFilterCombo; LLTabContainer* mFilterTabs; LLHandle mFinderHandle; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 41563bfc1..53ca90be4 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1629,7 +1629,7 @@ void LLPanelObjectInventory::reset() mFolders->getFilter()->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); LLRect scroller_rect(0, getRect().getHeight(), getRect().getWidth(), 0); - mScroller = new LLScrollableContainerView(std::string("task inventory scroller"), scroller_rect, mFolders ); + mScroller = new LLScrollContainer(std::string("task inventory scroller"), scroller_rect, mFolders ); mScroller->setFollowsAll(); addChild(mScroller); diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index 74a8ff7d3..736900c76 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -32,7 +32,7 @@ #include "llinventory.h" -class LLScrollableContainerView; +class LLScrollContainer; class LLFolderView; class LLFolderViewFolder; class LLViewerObject; @@ -81,7 +81,7 @@ protected: void clearContents(); private: - LLScrollableContainerView* mScroller; + LLScrollContainer* mScroller; LLFolderView* mFolders; LLUUID mTaskUUID; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 1d4c39294..40a79bcef 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -36,16 +36,14 @@ #include "llpanelpermissions.h" -#include "lluuid.h" #include "llpermissions.h" -#include "llcategory.h" #include "llclickaction.h" #include "llfocusmgr.h" #include "llnotificationsutil.h" -#include "llstring.h" +#include "lltrans.h" +#include "llwindow.h" #include "llviewerwindow.h" -#include "llwindow.h" #include "llresmgr.h" #include "lltextbox.h" #include "llbutton.h" @@ -53,20 +51,16 @@ #include "llviewerobject.h" #include "llselectmgr.h" #include "llagent.h" -#include "llstatusbar.h" // for getBalance() +#include "llavataractions.h" +#include "llfloatergroups.h" +#include "llgroupactions.h" #include "lllineeditor.h" #include "llradiogroup.h" #include "llcombobox.h" -#include "llfloateravatarinfo.h" -#include "lluiconstants.h" #include "lldbstrings.h" -#include "llfloatergroupinfo.h" -#include "llfloatergroups.h" #include "llnamebox.h" -#include "llviewercontrol.h" #include "lluictrlfactory.h" #include "roles_constants.h" -#include "lltrans.h" #include "llinventoryfunctions.h" #include "lfsimfeaturehandler.h" @@ -118,9 +112,9 @@ LLPanelPermissions::LLPanelPermissions(const std::string& title) : BOOL LLPanelPermissions::postBuild() { childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); - childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); + getChild("Object Name")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this); - childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe); + getChild("Object Description")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); childSetAction("button owner profile",LLPanelPermissions::onClickOwner,this); @@ -145,7 +139,7 @@ BOOL LLPanelPermissions::postBuild() childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this); - childSetPrevalidate("Edit Cost",LLLineEditor::prevalidateNonNegativeS32); + getChild("Edit Cost")->setPrevalidate(&LLLineEditor::prevalidateNonNegativeS32); childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); @@ -154,17 +148,9 @@ BOOL LLPanelPermissions::postBuild() childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); - - LLTextBox* group_rect_proxy = getChild("Group Name Proxy"); - if(group_rect_proxy ) - { - mLabelGroupName = new LLNameBox("Group Name", group_rect_proxy->getRect()); - addChild(mLabelGroupName); - } - else - { - mLabelGroupName = NULL; - } + + mLabelGroupName = new LLNameBox("Group Name", getChild("Group Name Proxy")->getRect()); + addChild(mLabelGroupName); if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this)); @@ -186,6 +172,103 @@ void LLPanelPermissions::handleVisibilityChange(BOOL new_visibility) LLPanel::handleVisibilityChange(new_visibility); } +void LLPanelPermissions::disableAll() +{ + getChildView("perm_modify")->setEnabled(FALSE); + getChild("perm_modify")->setValue(LLStringUtil::null); + + getChildView("pathfinding_attributes_value")->setEnabled(FALSE); + getChild("pathfinding_attributes_value")->setValue(LLStringUtil::null); + + getChildView("Creator:")->setEnabled(FALSE); + getChild("Creator Name")->setValue(LLStringUtil::null); + getChildView("Creator Name")->setEnabled(FALSE); + getChildView("button creator profile")->setEnabled(FALSE); + + getChildView("Owner:")->setEnabled(FALSE); + getChild("Owner Name")->setValue(LLStringUtil::null); + getChildView("Owner Name")->setEnabled(FALSE); + getChildView("button owner profile")->setEnabled(FALSE); + + getChildView("Last Owner:")->setEnabled(FALSE); + getChild("Last Owner Name")->setValue(LLStringUtil::null); + getChildView("Last Owner Name")->setEnabled(FALSE); + getChildView("button last owner profile")->setEnabled(FALSE); + + getChildView("Group:")->setEnabled(FALSE); + getChild("Group Name")->setValue(LLStringUtil::null); + getChildView("Group Name")->setEnabled(FALSE); + getChildView("button set group")->setEnabled(FALSE); + getChildView("button open group")->setEnabled(FALSE); + + getChild("Object Name")->setValue(LLStringUtil::null); + getChildView("Object Name")->setEnabled(FALSE); + getChildView("Name:")->setEnabled(FALSE); + getChild("Group Name")->setValue(LLStringUtil::null); + getChildView("Group Name")->setEnabled(FALSE); + getChildView("Description:")->setEnabled(FALSE); + getChild("Object Description")->setValue(LLStringUtil::null); + getChildView("Object Description")->setEnabled(FALSE); + + getChildView("Permissions:")->setEnabled(FALSE); + + getChild("checkbox share with group")->setValue(FALSE); + getChildView("checkbox share with group")->setEnabled(FALSE); + getChildView("button deed")->setEnabled(FALSE); + + getChildView("text anyone can")->setEnabled(FALSE); + getChild("checkbox allow everyone move")->setValue(FALSE); + getChildView("checkbox allow everyone move")->setEnabled(FALSE); + getChild("checkbox allow everyone copy")->setValue(FALSE); + getChildView("checkbox allow everyone copy")->setEnabled(FALSE); + getChild("checkbox allow export")->setValue(FALSE); + getChildView("checkbox allow export")->setEnabled(FALSE); + + //Next owner can: + getChildView("Next owner can:")->setEnabled(FALSE); + getChild("checkbox next owner can modify")->setValue(FALSE); + getChildView("checkbox next owner can modify")->setEnabled(FALSE); + getChild("checkbox next owner can copy")->setValue(FALSE); + getChildView("checkbox next owner can copy")->setEnabled(FALSE); + getChild("checkbox next owner can transfer")->setValue(FALSE); + getChildView("checkbox next owner can transfer")->setEnabled(FALSE); + + //checkbox for sale + getChild("checkbox for sale")->setValue(FALSE); + getChildView("checkbox for sale")->setEnabled(FALSE); + + //checkbox include in search + getChild("search_check")->setValue(FALSE); + getChildView("search_check")->setEnabled(FALSE); + + + LLRadioGroup* RadioSaleType = getChild("sale type"); + if(RadioSaleType) + { + RadioSaleType->setSelectedIndex(-1); + RadioSaleType->setEnabled(FALSE); + } + + getChildView("Cost")->setEnabled(FALSE); + getChild("Cost")->setValue(getString("Cost Default")); + getChild("Edit Cost")->setValue(LLStringUtil::null); + getChildView("Edit Cost")->setEnabled(FALSE); + + getChildView("label click action")->setEnabled(FALSE); + LLComboBox* combo_click_action = getChild("clickaction"); + if (combo_click_action) + { + combo_click_action->setEnabled(FALSE); + combo_click_action->clear(); + } + getChildView("B:")->setVisible( FALSE); + //getChildView("O:")->setVisible( FALSE); + getChildView("G:")->setVisible( FALSE); + getChildView("E:")->setVisible( FALSE); + getChildView("N:")->setVisible( FALSE); + getChildView("F:")->setVisible( FALSE); +} + void LLPanelPermissions::refresh() { @@ -224,99 +307,11 @@ void LLPanelPermissions::refresh() if(!nodep || !objectp)// || attachment_selected) { // ...nothing selected - childSetEnabled("perm_modify",false); - childSetText("perm_modify",LLStringUtil::null); - - childSetEnabled("Creator:",false); - childSetText("Creator Name",LLStringUtil::null); - childSetEnabled("Creator Name",false); - childSetEnabled("button creator profile",false); - - childSetEnabled("Owner:",false); - childSetText("Owner Name",LLStringUtil::null); - childSetEnabled("Owner Name",false); - childSetEnabled("button owner profile",false); - - childSetEnabled("Last Owner:",false); - childSetText("Last Owner Name",LLStringUtil::null); - childSetEnabled("Last Owner Name",false); - childSetEnabled("button last owner profile",false); - - childSetEnabled("Group:",false); - childSetText("Group Name",LLStringUtil::null); - childSetEnabled("Group Name",false); - childSetEnabled("button set group",false); - childSetEnabled("button open group",false); - - childSetText("Object Name",LLStringUtil::null); - childSetEnabled("Object Name",false); - childSetEnabled("Name:",false); - childSetText("Group Name",LLStringUtil::null); - childSetEnabled("Group Name",false); - childSetEnabled("Description:",false); - childSetText("Object Description",LLStringUtil::null); - childSetEnabled("Object Description",false); - - childSetEnabled("Permissions:",false); - - childSetValue("checkbox share with group",FALSE); - childSetEnabled("checkbox share with group",false); - childSetEnabled("button deed",false); - - childSetEnabled("text anyone can", false); - childSetValue("checkbox allow everyone move",FALSE); - childSetEnabled("checkbox allow everyone move",false); - childSetValue("checkbox allow everyone copy",FALSE); - childSetEnabled("checkbox allow everyone copy",false); - childSetValue("checkbox allow export", false); - childSetEnabled("checkbox allow export", false); - - //Next owner can: - childSetEnabled("Next owner can:",false); - childSetValue("checkbox next owner can modify",FALSE); - childSetEnabled("checkbox next owner can modify",false); - childSetValue("checkbox next owner can copy",FALSE); - childSetEnabled("checkbox next owner can copy",false); - childSetValue("checkbox next owner can transfer",FALSE); - childSetEnabled("checkbox next owner can transfer",false); - - //checkbox for sale - childSetValue("checkbox for sale",FALSE); - childSetEnabled("checkbox for sale",false); - - //checkbox include in search - childSetValue("search_check", FALSE); - childSetEnabled("search_check", false); - - LLRadioGroup* RadioSaleType = getChild("sale type"); - if(RadioSaleType) - { - RadioSaleType->setSelectedIndex(-1); - RadioSaleType->setEnabled(FALSE); - } - - childSetEnabled("Cost",false); - childSetText("Cost", getString("Cost Default", argsCurrency)); - childSetText("Edit Cost",LLStringUtil::null); - childSetEnabled("Edit Cost",false); - - childSetEnabled("label click action",false); - LLComboBox* ComboClickAction = getChild("clickaction"); - if(ComboClickAction) - { - ComboClickAction->setEnabled(FALSE); - ComboClickAction->clear(); - } - childSetVisible("B:",false); - childSetVisible("O:",false); - childSetVisible("G:",false); - childSetVisible("E:",false); - childSetVisible("N:",false); - childSetVisible("F:",false); - + disableAll(); return; } + // figure out a few variables BOOL is_one_object = (object_count == 1); @@ -351,8 +346,8 @@ void LLPanelPermissions::refresh() { ++string_index; } - childSetEnabled("perm_modify",true); - childSetText("perm_modify",MODIFY_INFO_STRINGS[string_index]); + getChildView("perm_modify")->setEnabled(TRUE); + getChild("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]); std::string pfAttrName; @@ -382,19 +377,19 @@ void LLPanelPermissions::refresh() getChildView("pathfinding_attributes_value")->setEnabled(TRUE); getChild("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); - childSetEnabled("Permissions:",true); + getChildView("Permissions:")->setEnabled(TRUE); // Update creator text field - childSetEnabled("Creator:",true); + getChildView("Creator:")->setEnabled(TRUE); std::string creator_name; bool creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); - childSetText("Creator Name",creator_name); - childSetEnabled("Creator Name",TRUE); - childSetEnabled("button creator profile", creators_identical && mCreatorID.notNull() ); + getChild("Creator Name")->setValue(creator_name); + getChildView("Creator Name")->setEnabled(TRUE); + getChildView("button creator profile")->setEnabled(creators_identical && mCreatorID.notNull()); // Update owner text field - childSetEnabled("Owner:",true); + getChildView("Owner:")->setEnabled(TRUE); std::string owner_name; const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); @@ -438,21 +433,21 @@ void LLPanelPermissions::refresh() } // [/RLVa:KB] - childSetText("Owner Name",owner_name); - childSetEnabled("Owner Name",TRUE); + getChild("Owner Name")->setValue(owner_name); + getChildView("Owner Name")->setEnabled(TRUE); // childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) childSetEnabled("button owner profile", fRlvEnableOwner && owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // [/RLVa:KB] - childSetText("Last Owner Name",last_owner_name); - childSetEnabled("Last Owner Name",TRUE); - childSetEnabled("button last owner profile",owners_identical && mLastOwnerID.notNull()); + getChild("Last Owner Name")->setValue(last_owner_name); + getChildView("Last Owner Name")->setEnabled(TRUE); + getChildView("button last owner profile")->setEnabled(owners_identical && mLastOwnerID.notNull()); // update group text field - childSetEnabled("Group:",true); - childSetText("Group Name",LLStringUtil::null); + getChildView("Group:")->setEnabled(TRUE); + getChild("Group Name")->setValue(LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) @@ -468,31 +463,24 @@ void LLPanelPermissions::refresh() if(mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); - mLabelGroupName->refresh(LLUUID::null, LLStringUtil::null, true); + mLabelGroupName->refresh(LLUUID::null, std::string(), true); mLabelGroupName->setEnabled(FALSE); } } - childSetEnabled("button set group",root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); - childSetEnabled("button open group", group_id.notNull()); + getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); + getChildView("button open group")->setEnabled(group_id.notNull()); - // figure out the contents of the name, description, & category - BOOL edit_name_desc = FALSE; - if(is_one_object && objectp->permModify() && !objectp->isPermanentEnforced()) - { - edit_name_desc = TRUE; - } - - childSetEnabled("Name:",true); + getChildView("Name:")->setEnabled(TRUE); LLLineEditor* LineEditorObjectName = getChild("Object Name"); - childSetEnabled("Description:",true); - LLLineEditor* LineEditorObjectDesc = getChild("Object Description"); + getChildView("Description:")->setEnabled(TRUE); + LLLineEditor* LineEditorObjectDesc = getChild("Object Description"); if(is_one_object) { if(keyboard_focus_view != LineEditorObjectName) { - childSetText("Object Name",nodep->mName); + getChild("Object Name")->setValue(nodep->mName); } if(LineEditorObjectDesc) @@ -505,19 +493,25 @@ void LLPanelPermissions::refresh() } else { - childSetText("Object Name",LLStringUtil::null); + getChild("Object Name")->setValue(LLStringUtil::null); LineEditorObjectDesc->setText(LLStringUtil::null); } + // figure out the contents of the name, description, & category + BOOL edit_name_desc = FALSE; + if(is_one_object && objectp->permModify() && !objectp->isPermanentEnforced()) + { + edit_name_desc = TRUE; + } if(edit_name_desc) { - childSetEnabled("Object Name",true); - childSetEnabled("Object Description",true); + getChildView("Object Name")->setEnabled(TRUE); + getChildView("Object Description")->setEnabled(TRUE); } else { - childSetEnabled("Object Name",false); - childSetEnabled("Object Description",false); + getChildView("Object Name")->setEnabled(FALSE); + getChildView("Object Description")->setEnabled(FALSE); } S32 total_sale_price = 0; @@ -537,11 +531,11 @@ void LLPanelPermissions::refresh() const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); - if(!owners_identical) + if (!owners_identical) { - childSetEnabled("Cost",false); - childSetText("Edit Cost",LLStringUtil::null); - childSetEnabled("Edit Cost",false); + getChildView("Cost")->setEnabled(FALSE); + getChild("Edit Cost")->setValue(LLStringUtil::null); + getChildView("Edit Cost")->setEnabled(FALSE); } // You own these objects. else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) @@ -549,63 +543,63 @@ void LLPanelPermissions::refresh() // If there are multiple items for sale then set text to PRICE PER UNIT. if (num_for_sale > 1) { - childSetText("Cost",getString("Cost Per Unit", argsCurrency)); + getChild("Cost")->setValue(getString("Cost Per Unit")); } else { - childSetText("Cost",getString("Cost Default", argsCurrency)); + getChild("Cost")->setValue(getString("Cost Default")); } - LLLineEditor *editPrice = getChild("Edit Cost"); - if(keyboard_focus_view != editPrice) + LLLineEditor *edit_price = getChild("Edit Cost"); + if(keyboard_focus_view != edit_price) { // If the sale price is mixed then set the cost to MIXED, otherwise // set to the actual cost. if (num_for_sale > 0 && is_for_sale_mixed) { - childSetText("Edit Cost",getString("Sale Mixed")); + edit_price->setValue(getString("Sale Mixed")); } else if (num_for_sale > 0 && is_sale_price_mixed) { - childSetText("Edit Cost",getString("Cost Mixed")); + edit_price->setValue(getString("Cost Mixed")); } else { - childSetText("Edit Cost",llformat("%d",individual_sale_price)); + edit_price->setValue(individual_sale_price); } } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. - bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; - childSetEnabled("Cost",enable_edit); - childSetEnabled("Edit Cost",enable_edit); + BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE; + getChildView("Cost")->setEnabled(enable_edit); + getChildView("Edit Cost")->setEnabled(enable_edit); } // Someone, not you, owns these objects. else if(!public_owned) { - childSetEnabled("Cost",false); - childSetEnabled("Edit Cost",false); + getChildView("Cost")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(FALSE); // Don't show a price if none of the items are for sale. if (num_for_sale) - childSetText("Edit Cost",llformat("%d",total_sale_price)); + getChild("Edit Cost")->setValue(llformat("%d",total_sale_price)); else - childSetText("Edit Cost",LLStringUtil::null); + getChild("Edit Cost")->setValue(LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) - childSetText("Cost", getString("Cost Total", argsCurrency)); + getChild("Cost")->setValue(getString("Cost Total", argsCurrency)); else - childSetText("Cost", getString("Cost Default", argsCurrency)); + getChild("Cost")->setValue(getString("Cost Default", argsCurrency)); } // This is a public object. else { - childSetEnabled("Cost",false); - childSetText("Cost", getString("Cost Default", argsCurrency)); + getChildView("Cost")->setEnabled(FALSE); + getChild("Cost")->setValue(getString("Cost Default", argsCurrency)); - childSetText("Edit Cost",LLStringUtil::null); - childSetEnabled("Edit Cost",false); + getChild("Edit Cost")->setValue(LLStringUtil::null); + getChildView("Edit Cost")->setEnabled(FALSE); } // Enable and disable the permissions checkboxes @@ -649,11 +643,9 @@ void LLPanelPermissions::refresh() if( gSavedSettings.getBOOL("DebugPermissions") ) { childSetVisible("perm_modify", false); - std::string perm_string; if (valid_base_perms) { - perm_string = "B: "; - perm_string += mask_to_string(base_mask_on); + std::string perm_string = mask_to_string(base_mask_on); if (!supports_export && base_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); if (U32 diff_mask = base_mask_on ^ owner_mask_on) // When different, show the user's potential permissions lowercase. @@ -669,87 +661,81 @@ void LLPanelPermissions::refresh() if (diff_mask & PERM_EXPORT) LLStringUtil::replaceChar(perm_string, 'E', 'e'); } - childSetText("B:",perm_string); - childSetVisible("B:",true); + getChild("B:")->setValue("B: " + perm_string); + getChildView("B:")->setVisible( TRUE); - perm_string = "O: "; - perm_string += mask_to_string(owner_mask_on); + perm_string = mask_to_string(owner_mask_on); if (!supports_export && owner_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); - childSetText("O:",perm_string); - childSetVisible("O:",true); + //getChild("O:")->setValue("O: " + perm_string); + //getChildView("O:")->setVisible( TRUE); - perm_string = "G: "; - perm_string += mask_to_string(group_mask_on); - childSetText("G:",perm_string); - childSetVisible("G:",true); + getChild("G:")->setValue("G: " + mask_to_string(group_mask_on)); + getChildView("G:")->setVisible( TRUE); - perm_string = "E: "; - perm_string += mask_to_string(everyone_mask_on); + perm_string = mask_to_string(owner_mask_on); if (!supports_export && everyone_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); - childSetText("E:",perm_string); - childSetVisible("E:",true); + getChild("E:")->setValue("E: " + perm_string); + getChildView("E:")->setVisible( TRUE); - perm_string = "N: "; - perm_string += mask_to_string(next_owner_mask_on); - childSetText("N:",perm_string); - childSetVisible("N:",true); + getChild("N:")->setValue("N: " + mask_to_string(next_owner_mask_on)); + getChildView("N:")->setVisible( TRUE); } - perm_string = "F: "; + U32 flag_mask = 0x0; - if (objectp->permMove()) flag_mask |= PERM_MOVE; - if (objectp->permModify()) flag_mask |= PERM_MODIFY; - if (objectp->permCopy()) flag_mask |= PERM_COPY; - if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; - perm_string += mask_to_string(flag_mask); - childSetText("F:",perm_string); - childSetVisible("F:",true); + if (objectp->permMove()) flag_mask |= PERM_MOVE; + if (objectp->permModify()) flag_mask |= PERM_MODIFY; + if (objectp->permCopy()) flag_mask |= PERM_COPY; + if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; + + getChild("F:")->setValue("F:" + mask_to_string(flag_mask)); + getChildView("F:")->setVisible( TRUE); } else { childSetVisible("perm_modify", true); - childSetVisible("B:",false); - childSetVisible("O:",false); - childSetVisible("G:",false); - childSetVisible("E:",false); - childSetVisible("N:",false); - childSetVisible("F:",false); + getChildView("B:")->setVisible( FALSE); + //getChildView("O:")->setVisible( FALSE); + getChildView("G:")->setVisible( FALSE); + getChildView("E:")->setVisible( FALSE); + getChildView("N:")->setVisible( FALSE); + getChildView("F:")->setVisible( FALSE); } - bool has_change_perm_ability = false; - bool has_change_sale_ability = false; + BOOL has_change_perm_ability = FALSE; + BOOL has_change_sale_ability = FALSE; - if(valid_base_perms && is_nonpermanent_enforced && + if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { - has_change_perm_ability = true; + has_change_perm_ability = TRUE; } - if(valid_base_perms && is_nonpermanent_enforced && - (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) + if (valid_base_perms && is_nonpermanent_enforced && + (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { - has_change_sale_ability = true; + has_change_sale_ability = TRUE; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions - childSetValue("perm_modify", getString("text modify warning")); + getChild("perm_modify")->setValue(getString("text modify warning")); } if (has_change_perm_ability) { - childSetEnabled("checkbox share with group",true); - childSetEnabled("text anyone can", true); - childSetEnabled("checkbox allow everyone move",owner_mask_on & PERM_MOVE); - childSetEnabled("checkbox allow everyone copy",owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); + getChildView("checkbox share with group")->setEnabled(TRUE); + getChildView("text anyone can")->setEnabled(true); + getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE); + getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { - childSetEnabled("checkbox share with group", FALSE); - childSetEnabled("text anyone can", false); - childSetEnabled("checkbox allow everyone move", FALSE); - childSetEnabled("checkbox allow everyone copy", FALSE); + getChildView("checkbox share with group")->setEnabled(FALSE); + getChildView("text anyone can")->setEnabled(false); + getChildView("checkbox allow everyone move")->setEnabled(FALSE); + getChildView("checkbox allow everyone copy")->setEnabled(FALSE); } // Is this user allowed to toggle export on this object? @@ -766,96 +752,97 @@ void LLPanelPermissions::refresh() for (U8 i = 0; can_export && i < objectp->getNumTEs(); ++i) // Can the textures be exported? if (LLTextureEntry* texture = objectp->getTE(i)) can_export = is_asset_exportable(texture->getID()); - childSetEnabled("checkbox allow export", can_export); + getChildView("checkbox allow export")->setEnabled(can_export); } else { - childSetEnabled("checkbox allow export", false); + getChildView("checkbox allow export")->setEnabled(false); if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) - childSetVisible("checkbox allow export", true); + getChildView("checkbox allow everyone copy")->setVisible(true); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { - childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); + getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale)); // Set the checkbox to tentative if the prices of each object selected // are not the same. - childSetTentative("checkbox for sale", is_for_sale_mixed); - childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed); + getChild("checkbox for sale")->setTentative( is_for_sale_mixed); + getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed); + bool no_export = everyone_mask_off & PERM_EXPORT; // Next owner perms can't be changed if set - childSetEnabled("Next owner can:", no_export); - childSetEnabled("checkbox next owner can modify", no_export && base_mask_on & PERM_MODIFY); - childSetEnabled("checkbox next owner can copy", no_export && base_mask_on & PERM_COPY); - childSetEnabled("checkbox next owner can transfer", no_export && next_owner_mask_on & PERM_COPY); + getChildView("Next owner can:")->setEnabled(no_export); + getChildView("checkbox next owner can modify")->setEnabled(no_export && base_mask_on & PERM_MODIFY); + getChildView("checkbox next owner can copy")->setEnabled(no_export && base_mask_on & PERM_COPY); + getChildView("checkbox next owner can transfer")->setEnabled(no_export && next_owner_mask_on & PERM_COPY); } else { - childSetEnabled("checkbox for sale",FALSE); - childSetEnabled("sale type",FALSE); + getChildView("checkbox for sale")->setEnabled(FALSE); + getChildView("sale type")->setEnabled(FALSE); - childSetEnabled("Next owner can:",FALSE); - childSetEnabled("checkbox next owner can modify",FALSE); - childSetEnabled("checkbox next owner can copy",FALSE); - childSetEnabled("checkbox next owner can transfer",FALSE); + getChildView("Next owner can:")->setEnabled(FALSE); + getChildView("checkbox next owner can modify")->setEnabled(FALSE); + getChildView("checkbox next owner can copy")->setEnabled(FALSE); + getChildView("checkbox next owner can transfer")->setEnabled(FALSE); } - if(valid_group_perms) + if (valid_group_perms) { - if((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) + if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { - childSetValue("checkbox share with group",TRUE); - childSetTentative("checkbox share with group",FALSE); - childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); + getChild("checkbox share with group")->setValue(TRUE); + getChild("checkbox share with group")->setTentative( FALSE); + getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } - else if((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) + else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { - childSetValue("checkbox share with group",FALSE); - childSetTentative("checkbox share with group",false); - childSetEnabled("button deed",false); + getChild("checkbox share with group")->setValue(FALSE); + getChild("checkbox share with group")->setTentative( FALSE); + getChildView("button deed")->setEnabled(FALSE); } else { - childSetValue("checkbox share with group",TRUE); - childSetTentative("checkbox share with group",true); - childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); + getChild("checkbox share with group")->setValue(TRUE); + getChild("checkbox share with group")->setTentative( TRUE); + getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } - if(valid_everyone_perms) + if (valid_everyone_perms) { // Move - if(everyone_mask_on & PERM_MOVE) + if (everyone_mask_on & PERM_MOVE) { - childSetValue("checkbox allow everyone move",TRUE); - childSetTentative("checkbox allow everyone move",false); + getChild("checkbox allow everyone move")->setValue(TRUE); + getChild("checkbox allow everyone move")->setTentative( FALSE); } - else if(everyone_mask_off & PERM_MOVE) + else if (everyone_mask_off & PERM_MOVE) { - childSetValue("checkbox allow everyone move",FALSE); - childSetTentative("checkbox allow everyone move",false); + getChild("checkbox allow everyone move")->setValue(FALSE); + getChild("checkbox allow everyone move")->setTentative( FALSE); } else { - childSetValue("checkbox allow everyone move",TRUE); - childSetTentative("checkbox allow everyone move",true); + getChild("checkbox allow everyone move")->setValue(TRUE); + getChild("checkbox allow everyone move")->setTentative( TRUE); } // Copy == everyone can't copy - if(everyone_mask_on & PERM_COPY) + if (everyone_mask_on & PERM_COPY) { - childSetValue("checkbox allow everyone copy",TRUE); - childSetTentative("checkbox allow everyone copy",!can_copy || !can_transfer); + getChild("checkbox allow everyone copy")->setValue(TRUE); + getChild("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer); } - else if(everyone_mask_off & PERM_COPY) + else if (everyone_mask_off & PERM_COPY) { - childSetValue("checkbox allow everyone copy",FALSE); - childSetTentative("checkbox allow everyone copy",false); + getChild("checkbox allow everyone copy")->setValue(FALSE); + getChild("checkbox allow everyone copy")->setTentative( FALSE); } else { - childSetValue("checkbox allow everyone copy",TRUE); - childSetTentative("checkbox allow everyone copy",true); + getChild("checkbox allow everyone copy")->setValue(TRUE); + getChild("checkbox allow everyone copy")->setTentative( TRUE); } // Export @@ -863,18 +850,18 @@ void LLPanelPermissions::refresh() { if(everyone_mask_on & PERM_EXPORT) { - childSetValue("checkbox allow export", true); - childSetTentative("checkbox allow export", false); + getChild("checkbox allow export")->setValue(TRUE); + getChild("checkbox allow export")->setTentative( FALSE); } else if(everyone_mask_off & PERM_EXPORT) { - childSetValue("checkbox allow export", false); - childSetTentative("checkbox allow export", false); + getChild("checkbox allow export")->setValue(FALSE); + getChild("checkbox allow export")->setTentative( FALSE); } else { - childSetValue("checkbox allow export", true); - childSetTentative("checkbox allow export", true); + getChild("checkbox allow export")->setValue(TRUE); + getChild("checkbox allow export")->setValue( TRUE); } } else @@ -884,57 +871,57 @@ void LLPanelPermissions::refresh() } } - if(valid_next_perms) + if (valid_next_perms) { // Modify == next owner canot modify - if(next_owner_mask_on & PERM_MODIFY) + if (next_owner_mask_on & PERM_MODIFY) { - childSetValue("checkbox next owner can modify",TRUE); - childSetTentative("checkbox next owner can modify",false); + getChild("checkbox next owner can modify")->setValue(TRUE); + getChild("checkbox next owner can modify")->setTentative( FALSE); } - else if(next_owner_mask_off & PERM_MODIFY) + else if (next_owner_mask_off & PERM_MODIFY) { - childSetValue("checkbox next owner can modify",FALSE); - childSetTentative("checkbox next owner can modify",false); + getChild("checkbox next owner can modify")->setValue(FALSE); + getChild("checkbox next owner can modify")->setTentative( FALSE); } else { - childSetValue("checkbox next owner can modify",TRUE); - childSetTentative("checkbox next owner can modify",true); + getChild("checkbox next owner can modify")->setValue(TRUE); + getChild("checkbox next owner can modify")->setTentative( TRUE); } // Copy == next owner cannot copy - if(next_owner_mask_on & PERM_COPY) + if (next_owner_mask_on & PERM_COPY) { - childSetValue("checkbox next owner can copy",TRUE); - childSetTentative("checkbox next owner can copy",!can_copy); + getChild("checkbox next owner can copy")->setValue(TRUE); + getChild("checkbox next owner can copy")->setTentative( !can_copy); } - else if(next_owner_mask_off & PERM_COPY) + else if (next_owner_mask_off & PERM_COPY) { - childSetValue("checkbox next owner can copy",FALSE); - childSetTentative("checkbox next owner can copy",FALSE); + getChild("checkbox next owner can copy")->setValue(FALSE); + getChild("checkbox next owner can copy")->setTentative( FALSE); } else { - childSetValue("checkbox next owner can copy",TRUE); - childSetTentative("checkbox next owner can copy",TRUE); + getChild("checkbox next owner can copy")->setValue(TRUE); + getChild("checkbox next owner can copy")->setTentative( TRUE); } // Transfer == next owner cannot transfer - if(next_owner_mask_on & PERM_TRANSFER) + if (next_owner_mask_on & PERM_TRANSFER) { - childSetValue("checkbox next owner can transfer",TRUE); - childSetTentative("checkbox next owner can transfer",!can_transfer); + getChild("checkbox next owner can transfer")->setValue(TRUE); + getChild("checkbox next owner can transfer")->setTentative( !can_transfer); } - else if(next_owner_mask_off & PERM_TRANSFER) + else if (next_owner_mask_off & PERM_TRANSFER) { - childSetValue("checkbox next owner can transfer",FALSE); - childSetTentative("checkbox next owner can transfer",FALSE); + getChild("checkbox next owner can transfer")->setValue(FALSE); + getChild("checkbox next owner can transfer")->setTentative( FALSE); } else { - childSetValue("checkbox next owner can transfer",TRUE); - childSetTentative("checkbox next owner can transfer",TRUE); + getChild("checkbox next owner can transfer")->setValue(TRUE); + getChild("checkbox next owner can transfer")->setTentative( TRUE); } } @@ -959,37 +946,40 @@ void LLPanelPermissions::refresh() } } - childSetValue("checkbox for sale", num_for_sale != 0); + getChild("checkbox for sale")->setValue((num_for_sale != 0)); // HACK: There are some old objects in world that are set for sale, // but are no-transfer. We need to let users turn for-sale off, but only // if for-sale is set. bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); - if (num_for_sale && has_change_sale_ability && cannot_actually_sell) + if (cannot_actually_sell) { - childSetEnabled("checkbox for sale", true); + if (num_for_sale && has_change_sale_ability) + { + getChildView("checkbox for sale")->setEnabled(true); + } } // Check search status of objects - BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; - bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); - childSetEnabled("search_check", has_change_sale_ability && all_volume); - childSetValue("search_check", include_in_search); - childSetTentative("search_check", ! all_include_in_search); + const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); + getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume); + getChild("search_check")->setValue(include_in_search); + getChild("search_check")->setTentative( !all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { - LLComboBox* ComboClickAction = getChild("clickaction"); - if(ComboClickAction) + LLComboBox* combo_click_action = getChild("clickaction"); + if(combo_click_action) { - ComboClickAction->setCurrentByIndex((S32)click_action); + combo_click_action->setCurrentByIndex((S32)click_action); } } - childSetEnabled("label click action",is_perm_modify && is_nonpermanent_enforced && all_volume); - childSetEnabled("clickaction",is_perm_modify && is_nonpermanent_enforced && all_volume); + getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); + getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); } @@ -1012,7 +1002,7 @@ void LLPanelPermissions::onClickCreator(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - LLFloaterAvatarInfo::showFromObject(self->mCreatorID); + LLAvatarActions::showProfile(self->mCreatorID); } // static @@ -1024,25 +1014,24 @@ void LLPanelPermissions::onClickOwner(void *data) { LLUUID group_id; LLSelectMgr::getInstance()->selectGetGroup(group_id); - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(group_id); } else { // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + LLAvatarActions::showProfile(self->mOwnerID); } // [/RLVa:KB] -// LLFloaterAvatarInfo::showFromObject(self->mOwnerID); +// LLAvatarActions::showProfile(self->mOwnerID); } } void LLPanelPermissions::onClickLastOwner(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - if(self->mLastOwnerID.notNull()) - LLFloaterAvatarInfo::showFromObject(self->mLastOwnerID); + LLAvatarActions::showProfile(self->mLastOwnerID); } void LLPanelPermissions::onClickGroup(void* data) @@ -1055,15 +1044,18 @@ void LLPanelPermissions::onClickGroup(void* data) if(owners_identical && (owner_id == gAgent.getID())) { - LLFloaterGroupPicker* fg; - fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - fg->setSelectCallback( cbGroupID, data ); + LLFloaterGroupPicker* fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - if (parent_floater) + if (fg) { - LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg); - fg->setOrigin(new_rect.mLeft, new_rect.mBottom); - parent_floater->addDependentFloater(fg); + fg->setSelectCallback( cbGroupID, data ); + + if (parent_floater) + { + LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg); + fg->setOrigin(new_rect.mLeft, new_rect.mBottom); + parent_floater->addDependentFloater(fg); + } } } } @@ -1073,7 +1065,7 @@ void LLPanelPermissions::onClickOpenGroup(void* data) LLUUID group_id; LLSelectMgr::getInstance()->selectGetGroup(group_id); - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(group_id); } // static @@ -1089,7 +1081,7 @@ void LLPanelPermissions::cbGroupID(LLUUID group_id, void* userdata) bool callback_deed_to_group(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { LLUUID group_id; @@ -1105,7 +1097,7 @@ bool callback_deed_to_group(const LLSD& notification, const LLSD& response) void LLPanelPermissions::onClickDeedToGroup(void* data) { - LLNotifications::instance().add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group); + LLNotificationsUtil::add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group); } void LLPanelPermissions::onClickCopyObjKey(void* data) diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index 706067a01..8ac27d9be 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -104,6 +104,9 @@ protected: static void onCommitIncludeInSearch(LLUICtrl* ctrl, void*); protected: + void disableAll(); + +private: LLNameBox* mLabelGroupName; // group name //LLTextBox* mBuyerLabel; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 2bf44165e..009965c40 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -29,9 +29,13 @@ #ifdef AI_UNUSED #include "llagent.h" +#endif // AI_UNUSED #include "llavataractions.h" +#ifdef AI_UNUSED #include "llfloaterreg.h" +#endif // AI_UNUSED #include "llcommandhandler.h" +#ifdef AI_UNUSED #include "llnotificationsutil.h" #include "llpanelpicks.h" #include "lltabcontainer.h" @@ -75,12 +79,13 @@ public: } }; LLProfileHandler gProfileHandler; +#endif // AI_UNUSED class LLAgentHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { } + LLAgentHandler() : LLCommandHandler("agent", true/*UNTRUSTED_THROTTLE*/) { } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) @@ -99,11 +104,13 @@ public: return true; } + /* Singu TODO if (verb == "inspect") { LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id)); return true; } + */ if (verb == "im") { @@ -113,11 +120,13 @@ public: if (verb == "pay") { + /* if (!LLUI::sSettingGroups["config"]->getBOOL("EnableAvatarPay")) { LLNotificationsUtil::add("NoAvatarPay", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); return true; } + */ LLAvatarActions::pay(avatar_id); return true; @@ -159,6 +168,7 @@ public: LLAgentHandler gAgentHandler; +#ifdef AI_UNUSED //-- LLPanelProfile::ChildStack begins ---------------------------------------- LLPanelProfile::ChildStack::ChildStack() : mParent(NULL) diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 783c728c0..7e5bec546 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -165,6 +165,7 @@ public: /*virtual*/ void result(const LLSD &pContent); /*virtual*/ void error(U32 pStatus, const std::string& pReason); + /*virtual*/ bool followRedir(void) const { return true; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return agentStateResponder_timeout; } /*virtual*/ char const* getName(void) const { return "AgentStateResponder"; } diff --git a/indra/newview/llprefschat.cpp b/indra/newview/llprefschat.cpp index 559ad2ba9..f62a4d4e9 100644 --- a/indra/newview/llprefschat.cpp +++ b/indra/newview/llprefschat.cpp @@ -55,6 +55,7 @@ private: S32 mChatSize; F32 mChatPersist; S32 mChatMaxLines; + S32 mChatBottomOffset; LLColor4 mSystemChatColor; LLColor4 mUserChatColor; LLColor4 mAgentChatColor; @@ -115,6 +116,7 @@ void LLPrefsChatImpl::refreshValues() mChatSize = gSavedSettings.getS32("ChatFontSize"); mChatPersist = gSavedSettings.getF32("ChatPersistTime"); mChatMaxLines = gSavedSettings.getS32("ConsoleMaxLines"); + mChatBottomOffset = gSavedSettings.getS32("ConsoleBottomOffset"); mSystemChatColor = gSavedSettings.getColor4("SystemChatColor"); mUserChatColor = gSavedSettings.getColor4("UserChatColor"); mAgentChatColor = gSavedSettings.getColor4("AgentChatColor"); @@ -140,6 +142,7 @@ void LLPrefsChatImpl::cancel() gSavedSettings.setS32("ChatFontSize", mChatSize); gSavedSettings.setF32("ChatPersistTime", mChatPersist); gSavedSettings.setS32("ConsoleMaxLines", mChatMaxLines); + gSavedSettings.setS32("ConsoleBottomOffset", mChatBottomOffset); gSavedSettings.setColor4("SystemChatColor", mSystemChatColor); gSavedSettings.setColor4("UserChatColor", mUserChatColor); gSavedSettings.setColor4("AgentChatColor", mAgentChatColor); diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index c8b3a4b1f..de4598d15 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -54,6 +54,7 @@ #include "llagent.h" #include "llvoavatarself.h" #include "llselectmgr.h" +#include "lltrans.h" #include "llviewerinventory.h" #include "llviewerassettype.h" @@ -550,7 +551,7 @@ void LLPreview::handleReshape(const LLRect& new_rect, bool by_user) // LLMultiPreview // -LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(std::string("Preview"), rect) +LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(LLTrans::getString("MultiPreviewTitle"), rect) { setCanResize(TRUE); } @@ -558,7 +559,7 @@ LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(std::string( void LLMultiPreview::open() /*Flawfinder: ignore*/ { LLMultiFloater::open(); /*Flawfinder: ignore*/ - LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); + LLPreview* frontmost_preview = dynamic_cast(mTabContainer->getCurrentPanel()); if (frontmost_preview && frontmost_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED) { frontmost_preview->loadAsset(); @@ -571,7 +572,7 @@ void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user) { if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) { - LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); + LLPreview* frontmost_preview = dynamic_cast(mTabContainer->getCurrentPanel()); if (frontmost_preview) frontmost_preview->userResized(); } LLFloater::handleReshape(new_rect, by_user); @@ -580,7 +581,7 @@ void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user) void LLMultiPreview::tabOpen(LLFloater* opened_floater) { - LLPreview* opened_preview = (LLPreview*)opened_floater; + LLPreview* opened_preview = dynamic_cast(opened_floater); if (opened_preview && opened_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED) { opened_preview->loadAsset(); diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 4cc0c6914..ba47526d0 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -97,7 +97,7 @@ BOOL LLPreviewAnim::postBuild() childSetAction("Anim audition btn",auditionAnim,this); childSetCommitCallback("desc", LLPreview::onText, this); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); return LLPreview::postBuild(); } diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 8349b5e03..c31f53538 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -399,8 +399,7 @@ BOOL LLPreviewGesture::postBuild() LLCheckBoxCtrl* check; edit = getChild("trigger_editor"); - edit->setKeystrokeCallback(onKeystrokeCommit); - edit->setCallbackUserData(this); + edit->setKeystrokeCallback(boost::bind(&onKeystrokeCommit,_1,this)); edit->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitSetDirty,this)); edit->setCommitOnFocusLost(TRUE); edit->setIgnoreTab(TRUE); @@ -412,8 +411,7 @@ BOOL LLPreviewGesture::postBuild() edit = getChild("replace_editor"); edit->setEnabled(FALSE); - edit->setKeystrokeCallback(onKeystrokeCommit); - edit->setCallbackUserData(this); + edit->setKeystrokeCallback(boost::bind(&onKeystrokeCommit,_1,this)); edit->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitSetDirty,this)); edit->setCommitOnFocusLost(TRUE); @@ -537,7 +535,7 @@ BOOL LLPreviewGesture::postBuild() { childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); } return TRUE; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index affd4bbce..7b789fd58 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -144,7 +144,7 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, childSetCommitCallback("desc", LLPreview::onText, this); if (const LLInventoryItem* item = getItem()) childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); } setTitle(title); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 18c873852..8306a0040 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -597,11 +597,11 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) } const LLTextSegment* segment = NULL; - std::vector selected_segments; + std::vector selected_segments; mEditor->getSelectedSegments(selected_segments); // try segments in selection range first - std::vector::iterator segment_iter; + std::vector::iterator segment_iter; for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter) { if((*segment_iter)->getToken() && (*segment_iter)->getToken()->getType() == LLKeywordToken::WORD) @@ -1299,7 +1299,7 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED) { diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index e1832477a..4a5122eed 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -88,7 +88,7 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); // preload the sound if(item && gAudiop) diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 5b5649256..d2929d7a6 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -35,6 +35,7 @@ #include "llpreviewtexture.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcombobox.h" #include "statemachine/aifilepicker.h" @@ -47,12 +48,10 @@ #include "lltrans.h" #include "lltextbox.h" #include "lltextureview.h" -#include "llui.h" #include "llviewertexturelist.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" #include "lllineeditor.h" -#include "llfloateravatarinfo.h" const S32 PREVIEW_TEXTURE_MIN_WIDTH = 300; const S32 PREVIEW_TEXTURE_MIN_HEIGHT = 120; @@ -229,7 +228,7 @@ void LLPreviewTexture::init() mCreatorKey = item->getCreatorUUID(); childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); childSetText("uuid", getItemID().asString()); childSetText("uploader", getItemCreatorName()); childSetText("uploadtime", getItemCreationDate()); @@ -672,8 +671,7 @@ bool LLPreviewTexture::setAspectRatio(const F32 width, const F32 height) void LLPreviewTexture::onClickProfile(void* userdata) { LLPreviewTexture* self = (LLPreviewTexture*) userdata; - LLUUID key = self->mCreatorKey; - if (!key.isNull()) LLFloaterAvatarInfo::showFromDirectory(key); + LLAvatarActions::showProfile(self->mCreatorKey); } void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata) diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 413877458..ad6ab788f 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -89,7 +89,7 @@ BOOL LLProgressView::postBuild() getChild("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle())); - getChild("message_text")->setClickedCallback(onClickMessage, this); + getChild("message_text")->setClickedCallback(boost::bind(&LLProgressView::onClickMessage, this)); sInstance = this; return TRUE; diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index c3c48cfd0..1e208f64d 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -165,28 +165,28 @@ void LLScrollingPanelParam::draw() // Draw the hints over the "less" and "more" buttons. if(mHintMin) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { const LLRect& r = mHintMin->getRect(); F32 left = (F32)(r.mLeft + BTN_BORDER); F32 bot = (F32)(r.mBottom + BTN_BORDER); - gGL.translatef(left, bot, 0.f); + gGL.translateUI(left, bot, 0.f); mHintMin->draw(); } - gGL.popMatrix(); + gGL.popUIMatrix(); } if(mHintMax) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { const LLRect& r = mHintMax->getRect(); F32 left = (F32)(r.mLeft + BTN_BORDER); F32 bot = (F32)(r.mBottom + BTN_BORDER); - gGL.translatef(left, bot, 0.f); + gGL.translateUI(left, bot, 0.f); mHintMax->draw(); } - gGL.popMatrix(); + gGL.popUIMatrix(); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index bee8211c4..300330cb6 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4740,7 +4740,7 @@ void LLSelectMgr::packPermissions(LLSelectNode* node, void *user_data) gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID()); gMessageSystem->addU8Fast(_PREHASH_Field, data->mField); - gMessageSystem->addBOOLFast(_PREHASH_Set, data->mSet); + gMessageSystem->addU8Fast(_PREHASH_Set, data->mSet ? PERM_SET_TRUE : PERM_SET_FALSE); gMessageSystem->addU32Fast(_PREHASH_Mask, data->mMask); } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 728ffeb12..3ae95d6c0 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3573,7 +3573,8 @@ void renderLights(LLDrawable* drawablep) size.mul(0.5f); { - LLGLDepthTest depth(GL_FALSE, GL_TRUE); + //LLGLDepthTest depth(GL_FALSE, GL_TRUE); + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); gGL.diffuseColor4f(1,1,1,1); drawBoxOutline(pos, size); } @@ -3782,7 +3783,8 @@ void renderRaycast(LLDrawable* drawablep) size.setSub(ext[1], ext[0]); size.mul(0.5f); - LLGLDepthTest depth(GL_FALSE, GL_TRUE); + //LLGLDepthTest depth(GL_FALSE, GL_TRUE); + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); gGL.diffuseColor4f(0,0.5f,0.5f,1); drawBoxOutline(pos, size); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 28b9b9840..a8624f7b0 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -85,6 +85,7 @@ #include "llsdutil_math.h" #include "llsecondlifeurls.h" #include "llstring.h" +#include "lltexteditor.h" #include "lluserrelations.h" #include "sgversion.h" #include "llviewercontrol.h" @@ -156,7 +157,6 @@ #include "llsecondlifeurls.h" #include "llselectmgr.h" #include "llsky.h" -#include "llsrv.h" #include "llstatview.h" #include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance #include "llsurface.h" @@ -221,7 +221,6 @@ #include "wlfPanel_AdvSettings.h" //Lower right Windlight and Rendering options #include "lldaycyclemanager.h" #include "llfloaterblacklist.h" -#include "scriptcounter.h" #include "shfloatermediaticker.h" #include "llpacketring.h" // @@ -392,6 +391,7 @@ bool idle_startup() static LLUUID web_login_key; static std::string password; static std::vector requested_options; + static std::string redirect_uri; static LLVector3 initial_sun_direction(1.f, 0.f, 0.f); static LLVector3 agent_start_position_region(10.f, 10.f, 10.f); // default for when no space server @@ -1256,6 +1256,8 @@ bool idle_startup() if (STATE_LOGIN_AUTHENTICATE == LLStartUp::getStartupState()) { + redirect_uri.clear(); + LL_DEBUGS("AppInit") << "STATE_LOGIN_AUTHENTICATE" << LL_ENDL; set_startup_status(progress, auth_desc, auth_message); @@ -1343,6 +1345,9 @@ bool idle_startup() LLViewerLogin* vl = LLViewerLogin::getInstance(); std::string grid_uri = vl->getCurrentGridURI(); + if(!redirect_uri.empty()) + grid_uri = redirect_uri; + //redirect_uri.clear(); //Should this be cleared immediately after consumption? Doing this will break retrying on http error. llinfos << "Authenticating with " << grid_uri << llendl; @@ -1461,6 +1466,24 @@ bool idle_startup() successful_login = true; Debug(if (gCurlIo) dc::curlio.off()); // Login succeeded: restore dc::curlio to original state. } + else if(login_response == "indeterminate") + { + progress += 0.01f; + auth_message = message_response; + auth_method = response["next_method"].asString(); + redirect_uri = response["next_url"].asString(); + if(auth_method.substr(0, 5) == "login") + { + auth_desc = LLTrans::getString("LoginAuthenticating"); + } + else + { + auth_desc = LLTrans::getString("LoginMaintenance"); + } + set_startup_status(progress, auth_desc, auth_message); + LLStartUp::setStartupState(STATE_XMLRPC_LEGACY_LOGIN ); + return false; + } else { emsg << LLTrans::getString("LoginFailed") + "\n"; @@ -3225,7 +3248,6 @@ void pass_processObjectPropertiesFamily(LLMessageSystem *msg, void**) // Send the result to the corresponding requesters. LLSelectMgr::processObjectPropertiesFamily(msg, NULL); JCFloaterAreaSearch::processObjectPropertiesFamily(msg, NULL); - ScriptCounter::processObjectPropertiesFamily(msg,0); } void register_viewer_callbacks(LLMessageSystem* msg) diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 0563a150c..a9da2c1a9 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -505,9 +505,9 @@ void LLStatusBar::refresh() if (region) { bool pf_disabled = !region->dynamicPathfindingEnabled(); - getChild("pf_dirty")->setVisible(mIsNavMeshDirty); + getChild("pf_dirty")->setVisible(!pf_disabled && mIsNavMeshDirty); getChild("pf_disabled")->setVisible(pf_disabled); - const std::string pf_icon = mIsNavMeshDirty ? "pf_dirty" : pf_disabled ? "pf_disabled" : ""; + const std::string pf_icon = pf_disabled ? "pf_disabled" : mIsNavMeshDirty ? "pf_dirty" : ""; if (!pf_icon.empty()) { x += 6; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 6c84bdddd..d1fc130e9 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -42,6 +42,7 @@ #include "llcombobox.h" #include "llbutton.h" #include "lldraghandle.h" +#include "llfiltereditor.h" #include "llfocusmgr.h" #include "llfolderview.h" #include "llfoldervieweventlistener.h" @@ -172,7 +173,7 @@ public: void onSelectionChange(const std::deque &items, BOOL user_action); static void onShowFolders(LLUICtrl* ctrl, void* userdata); static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); - static void onSearchEdit(const std::string& search_string, void* user_data ); + void onFilterEdit(const std::string& filter_string ); void onTextureSelect( const LLTextureEntry& te ); // tag: vaa emerald local_asset_browser [begin] @@ -209,7 +210,7 @@ protected: BOOL mIsDirty; BOOL mActive; - LLSearchEditor* mSearchEdit; + LLFilterEditor* mFilterEdit; LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mNonImmediateFilterPermMask; @@ -247,7 +248,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mResolutionLabel(NULL), mIsDirty( FALSE ), mActive( TRUE ), - mSearchEdit(NULL), + mFilterEdit(NULL), mImmediateFilterPermMask(immediate_filter_perm_mask), mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mContextConeOpacity(0.f), @@ -398,9 +399,9 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) { LLFolderView* root_folder = mInventoryPanel->getRootFolder(); - if (root_folder && mSearchEdit) + if (root_folder && mFilterEdit) { - if (mSearchEdit->hasFocus() + if (mFilterEdit->hasFocus() && (key == KEY_RETURN || key == KEY_DOWN) && mask == MASK_NONE) { @@ -425,7 +426,7 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) if (root_folder->hasFocus() && key == KEY_UP) { - mSearchEdit->focusFirstItem(TRUE); + mFilterEdit->focusFirstItem(TRUE); } } @@ -490,8 +491,8 @@ BOOL LLFloaterTexturePicker::postBuild() childSetCommitCallback("show_folders_check", onShowFolders, this); childSetVisible("show_folders_check", FALSE); - mSearchEdit = getChild("inventory search editor"); - mSearchEdit->setSearchCallback(onSearchEdit, this); + mFilterEdit = getChild("inventory search editor"); + mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2)); mInventoryPanel = getChild("inventory panel"); @@ -611,7 +612,7 @@ void LLFloaterTexturePicker::draw() childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); //RN: reset search bar to reflect actual search query (all caps, for example) - mSearchEdit->setText(mInventoryPanel->getFilterSubString()); + mFilterEdit->setText(mInventoryPanel->getFilterSubString()); //BOOL allow_copy = FALSE; if( mOwner ) @@ -878,7 +879,7 @@ void LLFloaterTexturePicker::switchModes(bool localmode, void *userdata) self->childSetVisible("Default", !localmode); self->childSetVisible("None", !localmode); self->childSetVisible("Blank", !localmode); - self->mSearchEdit->setVisible(!localmode); + self->mFilterEdit->setVisible(!localmode); self->mInventoryPanel->setVisible(!localmode); // localmode widgets @@ -1014,40 +1015,38 @@ void LLFloaterTexturePicker::updateFilterPermMask() //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. } -void LLFloaterTexturePicker::onSearchEdit(const std::string& search_string, void* user_data ) +void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) { - LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; - std::string upper_case_search_string = search_string; LLStringUtil::toUpper(upper_case_search_string); if (upper_case_search_string.empty()) { - if (picker->mInventoryPanel->getFilterSubString().empty()) + if (mInventoryPanel->getFilterSubString().empty()) { // current filter and new filter empty, do nothing return; } - picker->mSavedFolderState.setApply(TRUE); - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState); + mSavedFolderState.setApply(TRUE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); // add folder with current item to list of previously opened folders LLOpenFoldersWithSelection opener; - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); - picker->mInventoryPanel->getRootFolder()->scrollToShowSelection(); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); + mInventoryPanel->getRootFolder()->scrollToShowSelection(); } - else if (picker->mInventoryPanel->getFilterSubString().empty()) + else if (mInventoryPanel->getFilterSubString().empty()) { // first letter in search term, save existing folder open state - if (!picker->mInventoryPanel->getRootFolder()->isFilterModified()) + if (!mInventoryPanel->getRootFolder()->isFilterModified()) { - picker->mSavedFolderState.setApply(FALSE); - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState); + mSavedFolderState.setApply(FALSE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); } } - picker->mInventoryPanel->setFilterSubString(upper_case_search_string); + mInventoryPanel->setFilterSubString(upper_case_search_string); } void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) @@ -1092,7 +1091,7 @@ LLTextureCtrl::LLTextureCtrl( const LLUUID &default_image_id, const std::string& default_image_name ) : - LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), + LLUICtrl(name, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mDragCallback(NULL), mDropCallback(NULL), mOnCancelCallback(NULL), diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 41c819b5f..70c6d0b5e 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -49,6 +49,7 @@ #include "llviewertexturelist.h" #include "llvovolume.h" #include "llviewerstats.h" +#include "lluictrlfactory.h" // For avatar texture view #include "llvoavatarself.h" @@ -97,12 +98,20 @@ public: S32 mHilite; public: - LLTextureBar(const std::string& name, const LLRect& r, LLTextureView* texview) - : LLView(name, r, FALSE), - mHilite(0), - mTextureView(texview) + struct Params : public LLInitParam::Block { - } + Mandatory texture_view; + Params() + : texture_view("texture_view") + { + changeDefault(mouse_opaque, false); + } + }; + LLTextureBar(const Params& p) + : LLView(p), + mHilite(0), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -394,14 +403,21 @@ LLRect LLTextureBar::getRequiredRect() class LLAvatarTexBar : public LLView { public: - - LLAvatarTexBar(const std::string& name, LLTextureView* texview) - : LLView(name, FALSE), - mTextureView(texview) + struct Params : public LLInitParam::Block { - S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); - setRect(LLRect(0,0,100,line_height * 4)); - } + Mandatory texture_view; + Params() + : texture_view("texture_view") + { + S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); + changeDefault(rect, LLRect(0,0,100,line_height * 4)); + } + }; + + LLAvatarTexBar(const Params& p) + : LLView(p), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -486,13 +502,21 @@ LLRect LLAvatarTexBar::getRequiredRect() class LLGLTexMemBar : public LLView { public: - LLGLTexMemBar(const std::string& name, LLTextureView* texview) - : LLView(name, FALSE), - mTextureView(texview) + struct Params : public LLInitParam::Block { - S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); - setRect(LLRect(0,0,100,line_height * 4)); - } + Mandatory texture_view; + Params() + : texture_view("texture_view") + { + S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); + changeDefault(rect, LLRect(0,0,100,line_height * 4)); + } + }; + + LLGLTexMemBar(const Params& p) + : LLView(p), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -742,8 +766,8 @@ void LLGLTexSizeBar::draw() } //////////////////////////////////////////////////////////////////////////// -LLTextureView::LLTextureView(const std::string& name, const LLRect& rect) - : LLContainerView(name, rect), +LLTextureView::LLTextureView(const LLTextureView::Params& p) + : LLContainerView(p), mFreezeView(FALSE), mOrderFetch(FALSE), mPrintList(FALSE), @@ -969,11 +993,24 @@ void LLTextureView::draw() else sortChildren(LLTextureBar::sort()); - mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this); + LLGLTexMemBar::Params tmbp; + LLRect tmbr; + tmbp.name("gl texmem bar"); + tmbp.rect(tmbr); + tmbp.follows.flags = FOLLOWS_LEFT|FOLLOWS_TOP; + tmbp.texture_view(this); + mGLTexMemBar = LLUICtrlFactory::create(tmbp); addChild(mGLTexMemBar); - - mAvatarTexBar = new LLAvatarTexBar("gl avatartex bar", this); + //sendChildToFront(mGLTexMemBar); + + LLAvatarTexBar::Params atbp; + LLRect atbr; + atbp.name("gl avatartex bar"); + atbp.texture_view(this); + atbp.rect(atbr); + mAvatarTexBar = LLUICtrlFactory::create(atbp); addChild(mAvatarTexBar); + //sendChildToFront(mAvatarTexBar); reshape(getRect().getWidth(), getRect().getHeight(), TRUE); @@ -1009,7 +1046,11 @@ BOOL LLTextureView::addBar(LLViewerFetchedTexture *imagep, S32 hilite) mNumTextureBars++; - barp = new LLTextureBar("texture bar", r, this); + LLTextureBar::Params tbp; + tbp.name("texture bar"); + tbp.rect(r); + tbp.texture_view(this); + barp = LLUICtrlFactory::create(tbp); barp->mImagep = imagep; barp->mHilite = hilite; @@ -1055,10 +1096,8 @@ BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent) } //----------------------------------------------------------------- -LLTextureSizeView::LLTextureSizeView(const std::string& name) : LLContainerView(name, LLRect()) +LLTextureSizeView::LLTextureSizeView(const Params& p) : LLContainerView(p) { - setVisible(FALSE) ; - mTextureSizeBarWidth = 30 ; } diff --git a/indra/newview/lltextureview.h b/indra/newview/lltextureview.h index 9555e26ca..e64d9a628 100644 --- a/indra/newview/lltextureview.h +++ b/indra/newview/lltextureview.h @@ -39,8 +39,10 @@ class LLTextureView : public LLContainerView friend class LLTextureBar; friend class LLGLTexMemBar; friend class LLAvatarTexBar; +protected: + LLTextureView(const Params&); + friend class LLUICtrlFactory; public: - LLTextureView(const std::string& name, const LLRect& rect); ~LLTextureView(); /*virtual*/ void draw(); @@ -76,7 +78,19 @@ class LLGLTexSizeBar; class LLTextureSizeView : public LLContainerView { public: - LLTextureSizeView(const std::string& name); + struct Params : public LLInitParam::Block + { + Mandatory type; + Params() : + type("type") + { + changeDefault(visible, false); + changeDefault(follows.flags, FOLLOWS_BOTTOM | FOLLOWS_LEFT); + } + }; + + + LLTextureSizeView(const Params& p); ~LLTextureSizeView(); /*virtual*/ void draw(); diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 8d4820dce..c884af9bb 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -84,10 +84,9 @@ class LLFakeResizeHandle : public LLResizeHandle { public: - LLFakeResizeHandle(const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ) - : LLResizeHandle(name, rect, min_width, min_height, corner ) - { - + LLFakeResizeHandle(const LLResizeHandle::Params& p) + : LLResizeHandle(p) + { } virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; }; @@ -183,9 +182,13 @@ BOOL LLToolBar::postBuild() #if LL_DARWIN if(mResizeHandle == NULL) { - LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); - mResizeHandle = new LLFakeResizeHandle(std::string(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); - this->addChildInBack(mResizeHandle); + LLResizeHandle::Params p; + p.rect(LLRect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT)); + p.name(std::string("")); + p.min_width(RESIZE_HANDLE_WIDTH); + p.min_height(RESIZE_HANDLE_HEIGHT); + p.corner(LLResizeHandle::RIGHT_BOTTOM); + mResizeHandle = new LLFakeResizeHandle(p); this->addChildInBack(mResizeHandle); LLLayoutStack* toolbar_stack = getChild("toolbar_stack"); toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight()); } diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 24a9a9d56..9acc34971 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -169,6 +169,9 @@ BOOL LLVisualParamHint::render() { LLVisualParamReset::sDirty = TRUE; + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); gGL.loadIdentity(); @@ -256,6 +259,7 @@ BOOL LLVisualParamHint::render() gAgentAvatarp->updateVisualParams(); gGL.color4f(1,1,1,1); mGLTexturep->setGLTextureCreated(true); + gGL.popUIMatrix(); return TRUE; } diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 8d6982695..3d36b1fbb 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -607,59 +607,3 @@ void LLToolPlacer::handleDeselect() { } -////////////////////////////////////////////////////// -// LLToolPlacerPanel - -S32 LLToolPlacerPanel::sButtonsAdded = 0; -LLButton* LLToolPlacerPanel::sButtons[ TOOL_PLACER_NUM_BUTTONS ]; - -LLToolPlacerPanel::LLToolPlacerPanel(const std::string& name, const LLRect& rect) - : - LLPanel( name, rect ) -{ -} - -void LLToolPlacerPanel::addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ) -{ - const S32 TOOL_SIZE = 32; - const S32 HORIZ_SPACING = TOOL_SIZE + 5; - const S32 VERT_SPACING = TOOL_SIZE + 5; - const S32 VPAD = 10; - const S32 HPAD = 7; - - S32 row = sButtonsAdded / 4; - S32 column = sButtonsAdded % 4; - - LLRect help_rect = gSavedSettings.getRect("ToolHelpRect"); - - // Build the rectangle, recalling the origin is at lower left - // and we want the icons to build down from the top. - LLRect rect; - rect.setLeftTopAndSize( - HPAD + (column * HORIZ_SPACING), - help_rect.mBottom - VPAD - (row * VERT_SPACING), - TOOL_SIZE, - TOOL_SIZE ); - - LLButton* btn = new LLButton( - std::string("ToolPlacerOptBtn"), - rect, - up_state, - down_state, - LLStringUtil::null, &LLToolPlacerPanel::setObjectType, - pcode, - LLFontGL::getFontSansSerif()); - btn->setFollowsBottom(); - btn->setFollowsLeft(); - addChild(btn); - - sButtons[sButtonsAdded] = btn; - sButtonsAdded++; -} - -// static -void LLToolPlacerPanel::setObjectType( void* data ) -{ - LLPCode pcode = *(LLPCode*) data; - LLToolPlacer::setObjectType( pcode ); -} diff --git a/indra/newview/lltoolplacer.h b/indra/newview/lltoolplacer.h index 0cce6b739..906a83470 100644 --- a/indra/newview/lltoolplacer.h +++ b/indra/newview/lltoolplacer.h @@ -33,7 +33,6 @@ #ifndef LL_TOOLPLACER_H #define LL_TOOLPLACER_H -#include "llprimitive.h" #include "llpanel.h" #include "lltool.h" @@ -68,27 +67,4 @@ private: BOOL addDuplicate(S32 x, S32 y); }; -//////////////////////////////////////////////////// -// LLToolPlacerPanel - - -const S32 TOOL_PLACER_NUM_BUTTONS = 14; - - -class LLToolPlacerPanel : public LLPanel -{ -public: - - LLToolPlacerPanel(const std::string& name, const LLRect& rect); - - static void setObjectType( void* data ); - -private: - void addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ); - -private: - static S32 sButtonsAdded; - static LLButton* sButtons[ TOOL_PLACER_NUM_BUTTONS ]; -}; - #endif diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 165e22201..5f347f8d8 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -608,11 +608,13 @@ void LLViewerInventoryCategory::removeFromServer( void ) llinfos << "Removing inventory category " << mUUID << " from server." << llendl; // communicate that change with the server. +#ifndef DELETE_SYSTEM_FOLDERS if(LLFolderType::lookupIsProtectedType(mPreferredType)) { LLNotificationsUtil::add("CannotRemoveProtectedCategories"); return; } +#endif LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); gInventory.accountForUpdate(up); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index e6abe3676..175af63a3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -39,6 +39,7 @@ #include "lldiriterator.h" #include "llevent.h" // LLSimpleListener #include "llhoverview.h" +#include "llhttpclient.h" #include "llkeyboard.h" #include "llmimetypes.h" #include "llnotifications.h" @@ -57,7 +58,7 @@ #include "llweb.h" #include "llwebprofile.h" -#include "llfloateravatarinfo.h" // for getProfileURL() function +std::string getProfileURL(const std::string& agent_name); //#include "viewerversion.h" class AIHTTPTimeoutPolicy; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fed4fee46..d9582da4f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -63,7 +63,6 @@ #include "llfirstuse.h" #include "llfloaterabout.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloateravatarlist.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" @@ -79,12 +78,9 @@ #include "llfloaterdirectory.h" #include "llfloatereditui.h" #include "llfloaterchatterbox.h" -#include "llfloaterfriends.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" -#include "llfloatergroupinvite.h" -#include "llfloatergroups.h" #include "llfloaterhtmlcurrency.h" #include "llfloatermediabrowser.h" // gViewerHtmlHelp #include "llfloaterhud.h" @@ -120,6 +116,7 @@ #include "llfloatermemleak.h" #include "llframestats.h" #include "llgivemoney.h" +#include "llavataractions.h" #include "llgroupmgr.h" #include "llhoverview.h" #include "llhudeffecttrail.h" @@ -221,6 +218,8 @@ void handle_test_load_url(void*); // // Evil hackish imported globals +class AIHTTPView; + //extern BOOL gHideSelectedObjects; //extern BOOL gAllowSelectAvatar; //extern BOOL gDebugAvatarRotation; @@ -229,6 +228,7 @@ extern BOOL gDebugWindowProc; extern BOOL gDebugTextEditorTips; extern BOOL gShowOverlayTitle; extern BOOL gOcclusionCull; +extern AIHTTPView* gHttpView; // // Globals // @@ -817,6 +817,13 @@ void init_client_menu(LLMenuGL* menu) '6', MASK_CONTROL|MASK_SHIFT ) ); } + sub->addChild(new LLMenuItemCheckGL("HTTP Console", + &toggle_visibility, + NULL, + &get_visibility, + (void*)gHttpView, + '7', MASK_CONTROL|MASK_SHIFT ) ); + sub->addChild(new LLMenuItemCheckGL("Region Debug Console", handle_singleton_toggle, NULL, handle_singleton_check,NULL,'`', MASK_CONTROL|MASK_SHIFT)); sub->addChild(new LLMenuItemCheckGL("Fast Timers", @@ -3009,7 +3016,12 @@ class LLScriptCount : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - ScriptCounter::serializeSelection(false); + if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) + { + ScriptCounter* sc = new ScriptCounter(false, object); + sc->requestInventories(); + // sc will destroy itself + } return true; } }; @@ -3018,7 +3030,12 @@ class LLScriptDelete : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - ScriptCounter::serializeSelection(true); + if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) + { + ScriptCounter* sc = new ScriptCounter(true, object); + sc->requestInventories(); + // sc will destroy itself + } return true; } }; @@ -3709,11 +3726,6 @@ void handle_close_all_notifications(void*) } } -void handle_area_search(void*) -{ - JCFloaterAreaSearch::toggle(); -} - void handle_fake_away_status(void*) { bool fake_away = gSavedSettings.getBOOL("FakeAway"); @@ -3758,11 +3770,6 @@ bool LLHaveCallingcard::operator()(LLInventoryCategory* cat, } */ -BOOL is_agent_friend(const LLUUID& agent_id) -{ - return (LLAvatarTracker::instance().getBuddyInfo(agent_id) != NULL); -} - BOOL is_agent_mappable(const LLUUID& agent_id) { const LLRelationship* buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id); @@ -3780,9 +3787,9 @@ 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()); +// bool new_value = avatar && !LLAvatarActions::isFriend(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)); + bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); // [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -3804,7 +3811,7 @@ void request_friendship(const LLUUID& dest_id) } if (!full_name.empty()) { - LLPanelFriends::requestFriendshipDialog(dest_id, full_name); + LLAvatarActions::requestFriendshipDialog(dest_id, full_name); } else { @@ -6084,30 +6091,6 @@ void handle_look_at_selection(const LLSD& param) } } -void callback_invite_to_group(LLUUID group_id, void *user_data) -{ - std::vector agent_ids; - agent_ids.push_back(*(LLUUID *)user_data); - - LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); -} - -void invite_to_group(const LLUUID& dest_id) -{ - LLViewerObject* dest = gObjectList.findObject(dest_id); - if(dest && dest->isAvatar()) - { - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - if (widget) - { - widget->center(); - widget->setPowersMask(GP_MEMBER_INVITE); - widget->setSelectCallback(callback_invite_to_group, (void *)&dest_id); - } - } -} - class LLAvatarInviteToGroup : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -6118,7 +6101,7 @@ class LLAvatarInviteToGroup : public view_listener_t if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) // [/RLVa:KB] { - invite_to_group(avatar->getID()); + LLAvatarActions::inviteToGroup(avatar->getID()); } return true; } @@ -6129,9 +6112,9 @@ class LLAvatarAddFriend : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); -// if(avatar && !is_agent_friend(avatar->getID())) +// if(avatar && !LLAvatarActions::isFriend(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)) ) + if ( (avatar && !LLAvatarActions::isFriend(avatar->getID())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) // [/RLVa:KB] { request_friendship(avatar->getID()); @@ -6355,6 +6338,67 @@ void handle_viewer_disable_message_log(void*) gMessageSystem->stopLogging(); } +struct MenuFloaterDict : public LLSingleton +{ + typedef std::map, boost::function > > menu_floater_map_t; + menu_floater_map_t mEntries; + MenuFloaterDict() + { + registerFloater("about", boost::bind(&LLFloaterAbout::show,(void*)NULL)); + //registerFloater("about region", boost::bind(&LLFloaterRegionInfo::showInstance,LLSD())); + registerFloater("buy currency", boost::bind(&LLFloaterBuyCurrency::buyCurrency)); + registerFloater("displayname", boost::bind(&LLFloaterDisplayName::show)); + //registerFloater("friends", boost::bind(&LLFloaterMyFriends::toggleInstance,0), boost::bind(&LLFloaterMyFriends::instanceVisible,0)); + registerFloater("gestures", boost::bind(&LLFloaterGesture::toggleVisibility), boost::bind(&LLFloaterGesture::instanceVisible)); + registerFloater("grid options", boost::bind(&LLFloaterBuildOptions::show,(void*)NULL)); + registerFloater("help tutorial",boost::bind(&LLFloaterHUD::showHUD)); + registerFloater("im", boost::bind(&LLFloaterChatterBox::toggleInstance,LLSD()), boost::bind(&LLFloaterMyFriends::instanceVisible,0)); + //registerFloater("lag meter", boost::bind(&LLFloaterLagMeter::showInstance,LLSD())); + registerFloater("my land", boost::bind(&LLFloaterLandHoldings::show,(void*)NULL)); + registerFloater("preferences", boost::bind(&LLFloaterPreference::show,(void*)NULL)); + registerFloater("script errors",boost::bind(&LLFloaterScriptDebug::show,LLUUID::null)); + //registerFloater("script info", boost::bind(&LLFloaterScriptLimits::showInstance,LLSD())); + // Phoenix: Wolfspirit: Enabled Show Floater out of viewer menu + registerFloater("toolbar", boost::bind(&LLToolBar::toggle,(void*)NULL), boost::bind(&LLToolBar::visible,(void*)NULL)); + registerFloater("world map", boost::bind(&LLFloaterWorldMap::toggle)); + registerFloater("sound_explorer", boost::bind(&LLFloaterExploreSounds::toggle), boost::bind(&LLFloaterExploreSounds::visible)); + registerFloater("asset_blacklist", boost::bind(&LLFloaterBlacklist::toggle), boost::bind(&LLFloaterBlacklist::visible)); + + registerFloater ("about land"); + registerFloater ("about region"); + registerFloater ("active speakers"); + registerFloater ("areasearch"); + registerFloater ("beacons"); + registerFloater ("camera controls"); + registerFloater ("chat history"); + registerFloater ("communicate"); + registerFloater ("friends",0); + registerFloater ("lag meter"); + registerFloater ("media filter"); + registerFloater ("mini map"); + registerFloater ("movement controls"); + registerFloater ("mute list"); + registerFloater ("outbox"); + registerFloater ("perm prefs"); + registerFloater ("script info"); + registerFloater ("stat bar"); + registerFloater ("teleport history"); + registerFloater ("pathfinding_characters"); + registerFloater ("pathfinding_linksets"); + + } + void registerFloater(const std::string& name, boost::function show, boost::function visible = NULL) + { + mEntries.insert( std::make_pair( name, std::make_pair( show, visible ) ) ); + } + template + void registerFloater(const std::string& name, const LLSD& key = LLSD()) + { + registerFloater(name, boost::bind(&T::toggleInstance,key), boost::bind(&T::instanceVisible,key)); + } + +}; + // TomY TODO: Move! class LLShowFloater : public view_listener_t { @@ -6362,9 +6406,10 @@ class LLShowFloater : public view_listener_t { std::string floater_name = userdata.asString(); if (floater_name.empty()) return false; - if (floater_name == "gestures") + MenuFloaterDict::menu_floater_map_t::iterator it = MenuFloaterDict::instance().mEntries.find(floater_name); + if(it != MenuFloaterDict::instance().mEntries.end() && it->second.first != NULL) { - LLFloaterGesture::toggleVisibility(); + it->second.first(); } else if (floater_name == "appearance") { @@ -6377,75 +6422,10 @@ class LLShowFloater : public view_listener_t { new LLMakeOutfitDialog(false); } - // Phoenix: Wolfspirit: Enabled Show Floater out of viewer menu - else if (floater_name == "displayname") - { - LLFloaterDisplayName::show(); - } - else if (floater_name == "friends") - { - LLFloaterMyFriends::toggleInstance(0); - } - else if (floater_name == "preferences") - { - LLFloaterPreference::show(NULL); - } - else if (floater_name == "toolbar") - { - LLToolBar::toggle(NULL); - } - else if (floater_name == "chat history") - { - LLFloaterChat::toggleInstance(LLSD()); - } - else if (floater_name == "teleport history") - { - LLFloaterTeleportHistory::toggleInstance(); - } - else if (floater_name == "im") - { - LLFloaterChatterBox::toggleInstance(LLSD()); - } else if (floater_name == "inventory") { LLInventoryView::toggleVisibility(NULL); } - else if (floater_name == "mute list") - { - LLFloaterMute::toggleInstance(); - } - else if (floater_name == "media filter") - { - SLFloaterMediaFilter::toggleInstance(); - } - else if (floater_name == "camera controls") - { - LLFloaterCamera::toggleInstance(); - } - else if (floater_name == "movement controls") - { - LLFloaterMove::toggleInstance(); - } - else if (floater_name == "world map") - { - LLFloaterWorldMap::toggle(); - } - else if (floater_name == "mini map") - { - LLFloaterMap::toggleInstance(); - } - else if (floater_name == "stat bar") - { - LLFloaterStats::toggleInstance(); - } - else if (floater_name == "my land") - { - LLFloaterLandHoldings::show(NULL); - } - else if (floater_name == "about land") - { - LLFloaterLand::showInstance(); - } else if (floater_name == "buy land") { // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) @@ -6460,35 +6440,13 @@ class LLShowFloater : public view_listener_t } LLViewerParcelMgr::getInstance()->startBuyLand(); } - else if (floater_name == "about region") - { - LLFloaterRegionInfo::showInstance(); - } - else if (floater_name == "areasearch") - { - JCFloaterAreaSearch::toggle(); - } - else if (floater_name == "grid options") - { - LLFloaterBuildOptions::show(NULL); - } - else if (floater_name == "script errors") - { - LLFloaterScriptDebug::show(LLUUID::null); - } - else if (floater_name == "script info") - { - LLFloaterScriptLimits::showInstance(); - } + else if (floater_name == "help f1") { llinfos << "Spawning HTML help window" << llendl; gViewerHtmlHelp.show(); } - else if (floater_name == "help tutorial") - { - LLFloaterHUD::showHUD(); - } + else if (floater_name == "complaint reporter") { // Prevent menu from appearing in screen shot. @@ -6502,42 +6460,6 @@ class LLShowFloater : public view_listener_t LLFloaterBump::show(NULL); } } - else if (floater_name == "lag meter") - { - LLFloaterLagMeter::showInstance(); - } - else if (floater_name == "buy currency") - { - LLFloaterBuyCurrency::buyCurrency(); - } - else if (floater_name == "about") - { - LLFloaterAbout::show(NULL); - } - else if (floater_name == "active speakers") - { - LLFloaterActiveSpeakers::toggleInstance(LLSD()); - } - else if (floater_name == "beacons") - { - LLFloaterBeacons::toggleInstance(LLSD()); - } - else if (floater_name == "perm prefs") - { - LLFloaterPerms::toggleInstance(LLSD()); - } - else if (floater_name == "outbox") - { - LLFloaterOutbox::toggleInstance(LLSD()); - } - else if (floater_name == "pathfinding_linksets") - { - LLFloaterPathfindingLinksets::toggleInstance(LLSD()); - } - else if (floater_name == "pathfinding_characters") - { - LLFloaterPathfindingCharacters::toggleInstance(LLSD()); - } else // Simple codeless floater { LLFloater* floater = LLUICtrlFactory::getInstance()->getBuiltFloater(floater_name); @@ -6557,89 +6479,16 @@ class LLFloaterVisible : public view_listener_t std::string control_name = userdata["control"].asString(); std::string floater_name = userdata["data"].asString(); bool new_value = false; - if (floater_name == "friends") + MenuFloaterDict::menu_floater_map_t::iterator it = MenuFloaterDict::instance().mEntries.find(floater_name); + if(it != MenuFloaterDict::instance().mEntries.end() && it->second.second != NULL) { - new_value = LLFloaterMyFriends::instanceVisible(0); - } - else if (floater_name == "communicate") - { - new_value = LLFloaterChatterBox::instanceVisible(); - } - else if (floater_name == "toolbar") - { - new_value = LLToolBar::visible(NULL); - } - else if (floater_name == "chat history") - { - new_value = LLFloaterChat::instanceVisible(); - } - else if (floater_name == "teleport history") - { - new_value = LLFloaterTeleportHistory::instanceVisible(); - } - else if (floater_name == "im") - { - new_value = LLFloaterMyFriends::instanceVisible(0); - } - else if (floater_name == "mute list") - { - new_value = LLFloaterMute::instanceVisible(); - } - else if (floater_name == "media filter") - { - new_value = SLFloaterMediaFilter::instanceVisible(); - } - else if (floater_name == "camera controls") - { - new_value = LLFloaterCamera::instanceVisible(); - } - else if (floater_name == "movement controls") - { - new_value = LLFloaterMove::instanceVisible(); - } - else if (floater_name == "stat bar") - { - new_value = LLFloaterStats::instanceVisible(); - } - else if (floater_name == "active speakers") - { - new_value = LLFloaterActiveSpeakers::instanceVisible(LLSD()); - } - else if (floater_name == "beacons") - { - new_value = LLFloaterBeacons::instanceVisible(LLSD()); + new_value = it->second.second(); } else if (floater_name == "inventory") { LLInventoryView* iv = LLInventoryView::getActiveInventory(); new_value = (NULL != iv && TRUE == iv->getVisible()); } - else if (floater_name == "areasearch") - { - JCFloaterAreaSearch* instn = JCFloaterAreaSearch::getInstance(); - if (!instn) new_value = false; - else new_value = instn->getVisible(); - } - else if (floater_name == "outbox") - { - new_value = LLFloaterOutbox::instanceVisible(LLSD()); - } - else if (floater_name == "pathfinding_linksets") - { - new_value = LLFloaterPathfindingLinksets::instanceVisible(LLSD()); - } - else if (floater_name == "pathfinding_characters") - { - new_value = LLFloaterPathfindingCharacters::instanceVisible(LLSD()); - } - else if (floater_name == "sound_explorer") - { - new_value = LLFloaterExploreSounds::visible(); - } - else if (floater_name == "asset_blacklist") - { - new_value = LLFloaterBlacklist::visible(); - } gMenuHolder->findControl(control_name)->setValue(new_value); return true; } @@ -6747,7 +6596,7 @@ class LLShowAgentProfile : public view_listener_t if ( (avatar) && ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (gAgent.getID() == agent_id)) ) // [/RLVa:KB] { - LLFloaterAvatarInfo::show(avatar->getID()); + LLAvatarActions::showProfile(avatar->getID()); } return true; } @@ -7398,28 +7247,12 @@ class LLAvatarSendIM : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | OK - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return true; - } +// 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] - if(avatar) { - std::string name("IM"); - LLNameValue *first = avatar->getNVPair("FirstName"); - LLNameValue *last = avatar->getNVPair("LastName"); - if (first && last) - { - name.assign( first->getString() ); - name.append(" "); - name.append( last->getString() ); - } - - gIMMgr->setFloaterOpen(TRUE); - //EInstantMessage type = have_agent_callingcard(gLastHitObjectID) - // ? IM_SESSION_ADD : IM_SESSION_CARDLESS_START; - gIMMgr->addSession(LLCacheName::cleanFullName(name),IM_NOTHING_SPECIAL,avatar->getID()); + LLAvatarActions::startIM(avatar->getID()); } return true; } @@ -9245,16 +9078,6 @@ class SinguCheckNimble : public view_listener_t } }; -class SinguSoundExplorer : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLFloaterExploreSounds::toggle(); - - return true; - } -}; - class SinguAssetBlacklist : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9552,6 +9375,7 @@ void initialize_menus() addMenu(new LLObjectMeasure(), "Object.Measure"); addMenu(new LLObjectData(), "Object.Data"); addMenu(new LLScriptCount(), "Object.ScriptCount"); + addMenu(new LLObjectVisibleScriptCount(), "Object.VisibleScriptCount"); addMenu(new LLKillEmAll(), "Object.Destroy"); addMenu(new LLPowerfulWizard(), "Object.Explode"); addMenu(new LLCanIHasKillEmAll(), "Object.EnableDestroy"); @@ -9633,8 +9457,6 @@ void initialize_menus() addMenu(new SinguAnimationOverride(), "AnimationOverride"); addMenu(new SinguNimble(), "Nimble"); addMenu(new SinguCheckNimble(), "CheckNimble"); - addMenu(new SinguSoundExplorer(), "SoundExplorer"); - addMenu(new SinguAssetBlacklist(), "AssetBlacklist"); addMenu(new SinguStreamingAudioDisplay(), "StreamingAudioDisplay"); addMenu(new SinguEnableStreamingAudioDisplay(), "EnableStreamingAudioDisplay"); addMenu(new SinguCheckStreamingAudioDisplay(), "CheckStreamingAudioDisplay"); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 265f77fd3..6d3c2947f 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -74,8 +74,6 @@ BOOL enable_deselect(void*); BOOL enable_undo(void*); BOOL enable_redo(void*); -// returns TRUE if we have a friend relationship with agent_id -BOOL is_agent_friend(const LLUUID& agent_id); BOOL is_agent_mappable(const LLUUID& agent_id); void menu_toggle_control( void* user_data ); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3e142bf51..c037d5eff 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -60,7 +60,6 @@ #include "llfloaterbuycurrency.h" #include "llfloaterbuyland.h" #include "llfloaterchat.h" -#include "llfloatergroupinfo.h" #include "llfloaterimagepreview.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" @@ -69,6 +68,7 @@ #include "llfloaterpostcard.h" #include "llfloaterpreference.h" #include "llfloaterteleporthistory.h" +#include "llgroupactions.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llimpanel.h" @@ -639,7 +639,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if (option == 2 && !group_id.isNull()) { - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(group_id); LLSD args; args["MESSAGE"] = message; LLNotificationsUtil::add("JoinGroup", args, notification["payload"]); @@ -1780,7 +1780,7 @@ bool group_vote_callback(const LLSD& notification, const LLSD& response) case 0: // Vote Now // Open up the voting tab - LLFloaterGroupInfo::showFromUUID(group_id, "voting_tab"); + LLGroupActions::showTab(group_id, "voting_tab"); break; default: // Vote Later or @@ -2533,7 +2533,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Also send down the old path for now. if (IM_GROUP_NOTICE_REQUESTED == dialog) { - LLFloaterGroupInfo::showNotice(subj,mes,group_id,has_inventory,item_name,info); + LLGroupActions::showNotice(subj,mes,group_id,has_inventory,item_name,info); } else { @@ -2680,9 +2680,10 @@ 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 +// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && - (!LLFloaterAvatarInfo::getInstance(from_id)); + (!RlvUIEnabler::hasOpenProfile(from_id)) && (!RlvUIEnabler::hasOpenIM(from_id)); args["NAME"] = (!fRlvFilterName) ? name : RlvStrings::getAnonym(name); // [/RLVa:KB] LLNotificationsUtil::add("InventoryAccepted", args); @@ -2691,9 +2692,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) 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 +// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && - (!LLFloaterAvatarInfo::getInstance(from_id)); + (!RlvUIEnabler::hasOpenProfile(from_id)) && (!RlvUIEnabler::hasOpenIM(from_id)); args["NAME"] = (!fRlvFilterName) ? name : RlvStrings::getAnonym(name); // [/RLVa:KB] LLNotificationsUtil::add("InventoryDeclined", args); @@ -3695,6 +3697,9 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mText = from_name; mesg = mesg.substr(3); ircstyle = TRUE; + // This block was moved up to allow bubbles with italicized chat + // set CHAT_STYLE_IRC to avoid adding Avatar Name as author of message. See EXT-656 + chat.mChatStyle = CHAT_STYLE_IRC; } chat.mText += mesg; @@ -3722,12 +3727,23 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) return; } + // We have a real utterance now, so can stop showing "..." and proceed. + if (chatter && chatter->isAvatar()) + { + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); + static_cast(chatter)->stopTyping(); + + if (!is_muted && !is_busy) + { + static const LLCachedControl use_chat_bubbles("UseChatBubbles",false); + visible_in_chat_bubble = use_chat_bubbles; + static_cast(chatter)->addChat(chat); + } + } + // Look for IRC-style emotes if (ircstyle) { - // set CHAT_STYLE_IRC to avoid adding Avatar Name as author of message. See EXT-656 - chat.mChatStyle = CHAT_STYLE_IRC; - // Do nothing, ircstyle is fixed above for chat bubbles } else @@ -3854,20 +3870,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mText = from_name + verb + mesg; } - // We have a real utterance now, so can stop showing "..." and proceed. - if (chatter && chatter->isAvatar()) - { - LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); - ((LLVOAvatar*)chatter)->stopTyping(); - - if (!is_muted && !is_busy) - { - static const LLCachedControl use_chat_bubbles("UseChatBubbles",false); - visible_in_chat_bubble = use_chat_bubbles; - ((LLVOAvatar*)chatter)->addChat(chat); - } - } - if (chatter) { chat.mPosAgent = chatter->getPositionAgent(); @@ -5288,7 +5290,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) if (!avatarp) { // no agent by this ID...error? - LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "Received animation state for unknown avatar " << uuid << LL_ENDL; return; } diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index 91c83f6ba..09783ed21 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -36,7 +36,6 @@ // linden library includes #include "indra_constants.h" -#include "llalertdialog.h" #include "llapr.h" #include "llcallbacklist.h" #include "lldir.h" diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 76b3298ec..b39fb6e1f 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2565,6 +2565,11 @@ BOOL LLViewerShaderMgr::loadShadersInterface() { gSolidColorProgram.mName = "Solid Color Shader"; gSolidColorProgram.mShaderFiles.clear(); +#if LL_WINDOWS + if(gGLManager.mIsIntel && gGLManager.mGLVersion >= 4.f) + gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorIntelV.glsl", GL_VERTEX_SHADER_ARB)); + else +#endif gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER_ARB)); gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorF.glsl", GL_FRAGMENT_SHADER_ARB)); gSolidColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 72bf54c21..d12b63997 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -869,7 +869,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) // Check to see if we're over an HTML-style link if( !mSegments.empty() ) { - const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); + LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment ) { if(cur_segment->getStyle()->isLink()) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ff4d8ce5d..1c7007eea 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -78,7 +78,6 @@ // newview includes #include "llagent.h" -#include "llalertdialog.h" #include "llbox.h" #include "llchatbar.h" #include "llconsole.h" @@ -1657,7 +1656,13 @@ LLViewerWindow::LLViewerWindow( LLUICtrlFactory::getXUIPaths()); } // Create container for all sub-views - mRootView = new LLRootView("root", mWindowRectScaled, FALSE); + LLView::Params rvp; + rvp.name("root"); + rvp.rect(mWindowRectScaled); + rvp.mouse_opaque(false); + rvp.follows.flags(FOLLOWS_NONE); + mRootView = LLUICtrlFactory::create(rvp); + LLUI::setRootView(mRootView); // Make avatar head look forward at start mCurrentMousePoint.mX = getWindowWidthScaled() / 2; @@ -2370,15 +2375,17 @@ void LLViewerWindow::drawDebugText() { gGL.color4f(1,1,1,1); gGL.pushMatrix(); + gGL.pushUIMatrix(); if (LLGLSLShader::sNoFixedFunction) { gUIProgram.bind(); } { // scale view by UI global scale factor and aspect ratio correction factor - gGL.scalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); + gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); mDebugText->draw(); } + gGL.popUIMatrix(); gGL.popMatrix(); gGL.flush(); @@ -2434,10 +2441,11 @@ void LLViewerWindow::draw() } gGL.pushMatrix(); + LLUI::pushMatrix(); { // scale view by UI global scale factor and aspect ratio correction factor - gGL.scalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); + gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); LLVector2 old_scale_factor = LLUI::getScaleFactor(); // apply camera zoom transform (for high res screenshots) @@ -2527,6 +2535,7 @@ void LLViewerWindow::draw() LLUI::setScaleFactor(old_scale_factor); } + LLUI::popMatrix(); gGL.popMatrix(); if (LLGLSLShader::sNoFixedFunction) @@ -5346,9 +5355,9 @@ void LLViewerWindow::calcDisplayScale() F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor"); LLVector2 display_scale; display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f)); - F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRectRaw.getHeight() / display_scale.mV[VY]) / 768.f : 1.f; if(mWindow->getFullscreen()) { + F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRectRaw.getHeight() / display_scale.mV[VY]) / 768.f : 1.f; display_scale *= (ui_scale_factor * height_normalization); } else @@ -5380,7 +5389,8 @@ void LLViewerWindow::calcDisplayScale() S32 LLViewerWindow::getChatConsoleBottomPad() { - S32 offset = 0; + static const LLCachedControl user_offset("ConsoleBottomOffset"); + S32 offset = user_offset; if(gToolBar && gToolBar->getVisible()) offset += TOOL_BAR_HEIGHT; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index b984cd1e5..2eb84e8db 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -45,11 +45,11 @@ #include "v3dmath.h" #include "v2math.h" #include "llcursortypes.h" +#include "llpanel.h" #include "llwindowcallbacks.h" #include "lltimer.h" #include "llstat.h" #include "llmousehandler.h" -#include "llalertdialog.h" #include "llmousehandler.h" #include "llhandle.h" #include "llnotifications.h" diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e35c88e0b..433f2f0bb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1005,6 +1005,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mCCSChatTextOverride(false) // { + mAttachedObjectsVector.reserve(MAX_AGENT_ATTACHMENTS); + static LLCachedControl const freeze_time("FreezeTime", false); mFreezeTimeLangolier = freeze_time; @@ -1114,7 +1116,7 @@ LLVOAvatar::~LLVOAvatar() lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); - mAttachmentPoints.clear(); + //mAttachmentPoints.clear(); mDead = TRUE; @@ -1644,7 +1646,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); //stretch bounding box by attachments - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + /*for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { @@ -1659,7 +1661,13 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - const LLViewerObject* attached_object = (*attachment_iter); + const LLViewerObject* attached_object = (*attachment_iter);*/ + std::vector >::iterator attachment_iter = mAttachedObjectsVector.begin(); + for(;attachment_iter!=mAttachedObjectsVector.end();++attachment_iter) + { + if(attachment_iter->second->getValid()) + { + const LLViewerObject* attached_object = attachment_iter->first; if (attached_object && !attached_object->isHUDAttachment()) { LLDrawable* drawable = attached_object->mDrawable; @@ -2486,7 +2494,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) if (detailed_update || !sUseImpostors) { LLFastTimer t(FTM_ATTACHMENT_UPDATE); - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + /*for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { @@ -2496,7 +2504,12 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - LLViewerObject* attached_object = (*attachment_iter); + LLViewerObject* attached_object = (*attachment_iter);*/ + std::vector >::iterator attachment_iter = mAttachedObjectsVector.begin(); + for(;attachment_iter!=mAttachedObjectsVector.end();++attachment_iter) + {{ + LLViewerJointAttachment* attachment = attachment_iter->second; + LLViewerObject* attached_object = attachment_iter->first; BOOL visibleAttachment = visible || (attached_object && !(attached_object->mDrawable->getSpatialBridge() && attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0)); @@ -2964,7 +2977,7 @@ void LLVOAvatar::idleCCSUpdateAttachmentText(bool render_name) if(!mCCSUpdateAttachmentTimer.checkExpirationAndReset(SECS_BETWEEN_UPDATES)) return; - for (attachment_map_t::iterator it=mAttachmentPoints.begin(); it!=mAttachmentPoints.end(); ++it) + /*for (attachment_map_t::iterator it=mAttachmentPoints.begin(); it!=mAttachmentPoints.end(); ++it) { // get attached object LLViewerJointAttachment *joint = it->second; @@ -2973,8 +2986,14 @@ void LLVOAvatar::idleCCSUpdateAttachmentText(bool render_name) for(std::vector::const_iterator parent_it = joint->mAttachedObjects.begin(); parent_it != joint->mAttachedObjects.end(); ++parent_it) { - LLViewerObject* pObject = (*parent_it); - const LLTextureEntry *te = pObject ? pObject->getTE(0) : NULL; + LLViewerObject* pObject = (*parent_it);*/ + std::vector >::iterator parent_it = mAttachedObjectsVector.begin(); + for(;parent_it!=mAttachedObjectsVector.end();++parent_it) + {{ + LLViewerObject* pObject = parent_it->first; + if(!pObject) + continue; + const LLTextureEntry *te = pObject->getTE(0); if(!te) continue; const LLColor4 &col = te->getColor(); if( (fabs(col[0] - 0.012f) < 0.001f) && @@ -3318,6 +3337,13 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); LLFontGL::StyleFlags style; + + // Singu Note: The following tweak may be a bad idea, though they've asked for actions to be italicized, the chat type for actions becomes irrelevant + // If LLFontGL::StyleFlags wasn't the parameter type, font styles could be combined and underline could be used, but that may be unnatural... + static const LLCachedControl italicize("LiruItalicizeActions"); + if (italicize && chat_iter->mChatStyle == CHAT_STYLE_IRC) + style = LLFontGL::ITALIC; + else switch(chat_iter->mChatType) { case CHAT_TYPE_WHISPER: @@ -6192,6 +6218,8 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o LLSelectMgr::getInstance()->updatePointAt(); } + mAttachedObjectsVector.push_back(std::make_pair(viewer_object,attachment)); + return attachment; } @@ -6346,6 +6374,13 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) { cleanupAttachedMesh( viewer_object ); attachment->removeObject(viewer_object); + std::vector >::iterator it = std::find(mAttachedObjectsVector.begin(),mAttachedObjectsVector.end(),std::make_pair(viewer_object,attachment)); + if(it != mAttachedObjectsVector.end()) + { + (*it) = mAttachedObjectsVector.back(); + mAttachedObjectsVector.pop_back(); + } + lldebugs << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << llendl; return TRUE; } @@ -8652,7 +8687,7 @@ void LLVOAvatar::idleUpdateRenderCost() std::set textures; - attachment_map_t::const_iterator iter; + /*attachment_map_t::const_iterator iter; for (iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -8662,7 +8697,11 @@ void LLVOAvatar::idleUpdateRenderCost() attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - const LLViewerObject* object = (*attachment_iter); + const LLViewerObject* object = (*attachment_iter);*/ + std::vector >::iterator attachment_iter = mAttachedObjectsVector.begin(); + for(;attachment_iter!=mAttachedObjectsVector.end();++attachment_iter) + {{ + const LLViewerObject* object = attachment_iter->first; if (object && !object->isHUDAttachment()) { LLDrawable* drawable = object->mDrawable; @@ -8714,7 +8753,7 @@ void LLVOAvatar::idleUpdateRenderCost() } - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + /*for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { @@ -8723,7 +8762,11 @@ void LLVOAvatar::idleUpdateRenderCost() attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - const LLViewerObject* attached_object = (*attachment_iter); + const LLViewerObject* attached_object = (*attachment_iter);*/ + std::vector >::iterator attachment_iter = mAttachedObjectsVector.begin(); + for(;attachment_iter!=mAttachedObjectsVector.end();++attachment_iter) + {{ + const LLViewerObject* attached_object = attachment_iter->first; if (attached_object && !attached_object->isHUDAttachment()) { textures.clear(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 90d9bcd62..0299cf070 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -745,9 +745,11 @@ protected: //-------------------------------------------------------------------- public: S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self - typedef std::map attachment_map_t; + //typedef std::map attachment_map_t; + typedef LLSortedVector attachment_map_t; attachment_map_t mAttachmentPoints; std::vector > mPendingAttachment; + std::vector > mAttachedObjectsVector; //A vector of all current attachments for fast iteration. //-------------------------------------------------------------------- // HUD functions diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 1bfb9f360..806cff3b8 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1238,7 +1238,7 @@ void LLWorldMapView::drawAgents() // Show Individual agents (or little stacks where real agents are) // Here's how we'd choose the color if info.mID were available but it's not being sent: - // LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color; + // LLColor4 color = (agent_count == 1 && LLAvatarActions::isFriend(info.mID)) ? friend_color : avatar_color; // Reduce the stack size as you zoom out - always display at lease one agent where there is one or more S32 agent_count = (S32)(((it->getCount()-1) * agents_scale + (it->getCount()-1) * 0.1f)+.1f) + 1; drawImageStack(it->getGlobalPosition(), sAvatarSmallImage, agent_count, 3.f, avatar_color); @@ -1259,28 +1259,56 @@ void LLWorldMapView::drawFrustum() F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); F32 half_width_pixels = half_width_meters * meters_to_pixels; - F32 ctr_x = getRect().getWidth() * 0.5f + sPanX; - F32 ctr_y = getRect().getHeight() * 0.5f + sPanY; + // Compute the frustum coordinates. Take the UI scale into account. + static LLCachedControl ui_scale_factor("UIScaleFactor"); + F32 ctr_x = (getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor; + F32 ctr_y = (getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Since we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); + { gGL.translatef( ctr_x, ctr_y, 0 ); - gGL.rotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); // Draw triangle with more alpha in far pixels to make it // fade out in distance. gGL.begin( LLRender::TRIANGLES ); + { + // get camera look at and left axes + LLVector3 at_axis = LLViewerCamera::instance().getAtAxis(); + LLVector3 left_axis = LLViewerCamera::instance().getLeftAxis(); + + // grab components along XY plane + LLVector2 cam_lookat(at_axis.mV[VX], at_axis.mV[VY]); + LLVector2 cam_left(left_axis.mV[VX], left_axis.mV[VY]); + + // but, when looking near straight up or down... + if (is_approx_zero(cam_lookat.magVecSquared())) + { + //...just fall back to looking down the x axis + cam_lookat = LLVector2(1.f, 0.f); // x axis + cam_left = LLVector2(0.f, 1.f); // y axis + } + + // normalize to unit length + cam_lookat.normVec(); + cam_left.normVec(); + gGL.color4f(1.f, 1.f, 1.f, 0.25f); gGL.vertex2f( 0, 0 ); gGL.color4f(1.f, 1.f, 1.f, 0.02f); - gGL.vertex2f( -half_width_pixels, far_clip_pixels ); + + // use 2d camera vectors to render frustum triangle + LLVector2 vert = cam_lookat * far_clip_pixels + cam_left * half_width_pixels; + gGL.vertex2f(vert.mV[VX], vert.mV[VY]); - gGL.color4f(1.f, 1.f, 1.f, 0.02f); - gGL.vertex2f( half_width_pixels, far_clip_pixels ); + vert = cam_lookat * far_clip_pixels - cam_left * half_width_pixels; + gGL.vertex2f(vert.mV[VX], vert.mV[VY]); + } gGL.end(); + } gGL.popMatrix(); } LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 5da61b54e..311d21c0b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2415,14 +2415,6 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) } drawablep->setState(LLDrawable::BUILT); - //Workaround for 'missing prims' until it's fixed upstream by LL. - //Sometimes clearing CLEAR_INVISIBLE and FORCE_INVISIBLE in LLPipeline::stateSort was too late. Do it here instead, before - //the rebuild state is picked up on and LLVolumeGeometryManager::rebuildGeom is called. - //If the FORCE_INVISIBLE isn't cleared before the rebuildGeom call, the geometry will NOT BE REBUILT! - if(drawablep->isState(LLDrawable::CLEAR_INVISIBLE)) - { - drawablep->clearState(LLDrawable::FORCE_INVISIBLE|LLDrawable::CLEAR_INVISIBLE); - } mGeometryChanges++; } return update_complete; @@ -2445,10 +2437,10 @@ void LLPipeline::updateGL() } } - /*{ //seed VBO Pools + { //seed VBO Pools LLFastTimer t(FTM_SEED_VBO_POOLS); LLVertexBuffer::seedPools(); - }*/ + } } void LLPipeline::clearRebuildGroups() @@ -9622,7 +9614,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) markVisible(avatar->mDrawable, *viewer_camera); LLVOAvatar::sUseImpostors = FALSE; - LLVOAvatar::attachment_map_t::iterator iter; + /*LLVOAvatar::attachment_map_t::iterator iter; for (iter = avatar->mAttachmentPoints.begin(); iter != avatar->mAttachmentPoints.end(); ++iter) @@ -9632,7 +9624,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - if (LLViewerObject* attached_object = (*attachment_iter)) + if (LLViewerObject* attached_object = (*attachment_iter))*/ + std::vector >::iterator attachment_iter = avatar->mAttachedObjectsVector.begin(); + std::vector >::iterator end = avatar->mAttachedObjectsVector.end(); + for(;attachment_iter != end;++attachment_iter) + {{ + if (LLViewerObject* attached_object = attachment_iter->first) { markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera); } diff --git a/indra/newview/randgauss.h b/indra/newview/randgauss.h deleted file mode 100644 index bc51d1567..000000000 --- a/indra/newview/randgauss.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file randgauss.h - * @brief randgauss class definition - * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-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 - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -const F32 table[][2] = { -{.00f, .5f}, -{.01f, .504f}, -{.02f, .508f}, -{.03f, .512f}, -{.06f, .5239f}, -{.08f, .5319f}, -{.11f, .5438f}, -{.13f, .5517f}, -{.16f, .5636f}, -{.18f, .5714f}, -{.21f, .5832f}, -{.23f, .5910f}, -{.26f, .6026f}, -{.28f, .6103f}, -{.31f, .6217f}, -{.34f, .6331f}, -{.36f, .6406f}, -{.39f, .6517f}, -{.42f, .6628f}, -{.44f, .6700f}, -{.47f, .6808f}, -{.50f, .6915f}, -{.53f, .7019f}, -{.56f, .7123f}, -{.59f, .7224f}, -{.62f, .7324f}, -{.65f, .7422f}, -{.68f, .7517f}, -{.71f, .7611f}, -{.74f, .7703f}, -{.78f, .7823f}, -{.81f, .7910f}, -{.85f, .8023f}, -{.88f, .8106f}, -{.92f, .8212f}, -{.96f, .8315f}, -{1.0f, .8413f}, -{1.04f, .8508f}, -{1.09f, .8621f}, -{1.13f, .8708f}, -{1.18f, .8810f}, -{1.23f, .8907f}, -{1.29f, .9015f}, -{1.35f, .9115f}, -{1.41f, .9207f}, -{1.48f, .9306f}, -{1.56f, .9406f}, -{1.65f, .9505f}, -{1.76f, .9608f}, -{1.89f, .9706f}, -{2.06f, .9803f}, -{2.33f, .9901f}, -{99.0f, 1.0f}}; - -inline F32 randGauss(F32 mean, F32 stdev) -{ - S32 i = 0; - F32 u = rand() / (F32) RAND_MAX; - F32 n; - - if (u >= 0.5) - { - while (u > table[i][1]) - i++; - - n = table[i-1][0]; - - } else { - u = 1 - u; - while (u > table[i][1]) - i++; - n = 1 - table[i-1][0]; - } - //printf("u: %f, n: %f, i: %d\n", u, n, i); //debug - - return (mean + stdev * n); -} - diff --git a/indra/newview/res-sdl/working.BMP b/indra/newview/res-sdl/working.BMP index 26dec59af..851dbd5b9 100644 Binary files a/indra/newview/res-sdl/working.BMP and b/indra/newview/res-sdl/working.BMP differ diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index e2f3403f9..a4c8ad281 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -153,10 +153,13 @@ void RlvSettings::initClass() } #endif // RLV_EXTENSION_STARTLOCATION -// Checked: 2010-10-11 (RLVa-1.2.0e) | Added: RLVa-1.2.0e +// Checked: 2013-04-17 (RLVa-1.4.8) bool RlvSettings::onChangedAvatarOffset(const LLSD& sdValue) { - gAgent.sendAgentSetAppearance(); + if ( (isAgentAvatarValid()) && (!gAgentAvatarp->isUsingServerBakes()) ) + { + gAgentAvatarp->computeBodySize(); + } return true; } // Checked: 2011-08-16 (RLVa-1.4.0b) | Added: RLVa-1.4.0b @@ -704,7 +707,9 @@ bool rlvPredCanRemoveItem(const LLInventoryItem* pItem) RLV_ASSERT(false); } } - return false; + // HACK-RLVa: Until LL supports temporary attachment detection assume that no inventory item means a temporary + // attachment which are always removeable + return true; } // Checked: 2010-03-22 (RLVa-1.2.0c) | Added: RLVa-1.2.0a diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index b7857fd41..e80b7e4cc 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -151,6 +151,8 @@ enum ERlvBehaviour { RLV_BHVR_SENDIMTO, // "sendimto" RLV_BHVR_RECVIM, // "recvim" RLV_BHVR_RECVIMFROM, // "recvimfrom" + RLV_BHVR_STARTIM, // "startim" + RLV_BHVR_STARTIMTO, // "startimto" RLV_BHVR_PERMISSIVE, // "permissive" RLV_BHVR_NOTIFY, // "notify" RLV_BHVR_SHOWINV, // "showinv" diff --git a/indra/newview/rlvextensions.cpp b/indra/newview/rlvextensions.cpp index 8489de7ed..aa07dfcd2 100644 --- a/indra/newview/rlvextensions.cpp +++ b/indra/newview/rlvextensions.cpp @@ -495,10 +495,6 @@ bool RlvExtGetSet::findDebugSetting(std::string& strSetting, S16& flags) { LLStringUtil::toLower(strSetting); // Convenience for non-RLV calls - // HACK-RLVa: bad code but it's just a temporary measure to provide a smooth changeover from the old to the new rebranded settings - if ( (strSetting.length() >= 14) && (0 == strSetting.find("restrainedlife")) ) - strSetting = "restrainedlove" + strSetting.substr(14); - std::string strTemp; for (std::map::const_iterator itSetting = m_DbgAllowed.begin(); itSetting != m_DbgAllowed.end(); ++itSetting) { diff --git a/indra/newview/rlvfloaterbehaviour.cpp b/indra/newview/rlvfloaterbehaviour.cpp index 64807840c..b8c15214d 100644 --- a/indra/newview/rlvfloaterbehaviour.cpp +++ b/indra/newview/rlvfloaterbehaviour.cpp @@ -58,6 +58,7 @@ bool rlvGetShowException(ERlvBehaviour eBhvr) case RLV_BHVR_RECVEMOTE: case RLV_BHVR_SENDIM: case RLV_BHVR_RECVIM: + case RLV_BHVR_STARTIM: case RLV_BHVR_TPLURE: case RLV_BHVR_ACCEPTTP: return true; diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 15518ad0d..b9a720981 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -18,9 +18,9 @@ #include "llagent.h" #include "llappearancemgr.h" #include "llappviewer.h" +#include "llgroupactions.h" #include "llhudtext.h" #include "llstartup.h" -#include "llviewermenu.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" @@ -195,7 +195,7 @@ void RlvHandler::removeCommandHandler(RlvCommandHandler* pCmdHandler) m_CommandHandlers.remove(pCmdHandler); } -// Checked: 2009-10-26 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a +// Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.1.0a void RlvHandler::clearCommandHandlers() { std::list::const_iterator itHandler = m_CommandHandlers.begin(); @@ -730,7 +730,6 @@ size_t utf8str_strlen(const std::string& utf8) return length; } -// TODO-RLV: works, but more testing won't hurt std::string utf8str_chtruncate(const std::string& utf8, size_t length) { if (0 == length) @@ -1113,7 +1112,7 @@ void RlvHandler::clearState() #define VERIFY_OPTION(x) { if (!(x)) { eRet = RLV_RET_FAILED_OPTION; break; } } #define VERIFY_OPTION_REF(x) { if (!(x)) { eRet = RLV_RET_FAILED_OPTION; break; } fRefCount = true; } -// Checked: 2010-03-03 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a +// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) { // NOTE: - at this point the command has already been: @@ -1154,8 +1153,8 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) VERIFY_OPTION_REF(strOption.empty()); } break; - case RLV_BHVR_ADDOUTFIT: // @addoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c - case RLV_BHVR_REMOUTFIT: // @remoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c + case RLV_BHVR_ADDOUTFIT: // @addoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c + case RLV_BHVR_REMOUTFIT: // @remoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c { // If there's an option it should specify a wearable type name (reference count on no option *and* a valid option) RlvCommandOptionGeneric rlvCmdOption(rlvCmd.getOption()); @@ -1244,7 +1243,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) VERIFY_OPTION_REF(strOption.empty()); } break; - case RLV_BHVR_NOTIFY: // @notify:=add|rem - Checked: 2010-03-03 (RLVa-1.1.3a) | Modified: RLVa-1.2.0a + case RLV_BHVR_NOTIFY: // @notify:=add|rem - Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a { // There should be an option that we can successfully parse (if there's an empty option the command is invalid) S32 nChannel; std::string strFilter; @@ -1277,10 +1276,10 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_SHOWLOC: // @showloc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SHOWNAMES: // @shownames=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_EMOTE: // @emote=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) - case RLV_BHVR_SENDCHAT: // @sendchat=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_CHATWHISPER: // @chatwhisper=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_CHATNORMAL: // @chatnormal=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_CHATSHOUT: // @chatshout=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_SENDCHAT: // @sendchat=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_CHATWHISPER: // @chatwhisper=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_CHATNORMAL: // @chatnormal=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_CHATSHOUT: // @chatshout=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) case RLV_BHVR_PERMISSIVE: // @permissive=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SHOWINV: // @showinv=n|y - Checked: 2010-03-01 (RLVa-1.2.0a) case RLV_BHVR_SHOWMINIMAP: // @showminimap=n|y - Checked: 2010-02-28 (RLVa-1.2.0a) @@ -1291,12 +1290,12 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_STANDTP: // @standtp=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) case RLV_BHVR_TPLM: // @tplm=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_TPLOC: // @tploc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_VIEWNOTE: // @viewnote=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_VIEWSCRIPT: // @viewscript=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_VIEWTEXTURE: // @viewtexture=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_VIEWNOTE: // @viewnote=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) + case RLV_BHVR_VIEWSCRIPT: // @viewscript=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) + case RLV_BHVR_VIEWTEXTURE: // @viewtexture=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) case RLV_BHVR_ACCEPTPERMISSION: // @acceptpermission=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h #ifdef RLV_EXTENSION_CMD_ALLOWIDLE - case RLV_BHVR_ALLOWIDLE: // @allowidle=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_ALLOWIDLE: // @allowidle=n|y - Checked: 2010-05-03 (RLVa-1.2.0g) | Modified: RLVa-1.1.0h #endif // RLV_EXTENSION_CMD_ALLOWIDLE case RLV_BHVR_REZ: // @rez=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_FARTOUCH: // @fartouch=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h @@ -1318,10 +1317,11 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) VERIFY_OPTION_REF(strOption.empty()); break; // The following block is only valid if there's no option (= restriction) or if it specifies a valid UUID (= behaviour exception) - case RLV_BHVR_RECVCHAT: // @recvchat[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_RECVEMOTE: // @recvemote[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_RECVCHAT: // @recvchat[:]=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_RECVEMOTE: // @recvemote[:]=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) case RLV_BHVR_SENDIM: // @sendim[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_RECVIM: // @recvim[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_STARTIM: // @startim[:]=n|y - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h case RLV_BHVR_TPLURE: // @tplure[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_ACCEPTTP: // @accepttp[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_TOUCHATTACH: // @touchattach[:=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l @@ -1350,6 +1350,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_RECVEMOTEFROM: // @recvemotefrom:=n|y - Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c case RLV_BHVR_SENDIMTO: // @sendimto:=n|y - Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c case RLV_BHVR_RECVIMFROM: // @recvimfrom:=n|y - Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c + case RLV_BHVR_STARTIMTO: // @startimto:=n|y - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h case RLV_BHVR_EDITOBJ: // @editobj:=n|y - Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c case RLV_BHVR_TOUCHTHIS: // @touchthis:=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l { @@ -1399,7 +1400,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) return eRet; } -// Checked: 2010-03-03 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a +// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a ERlvCmdRet RlvHandler::onAddRemAttach(const RlvCommand& rlvCmd, bool& fRefCount) { RLV_ASSERT( (RLV_TYPE_ADD == rlvCmd.getParamType()) || (RLV_TYPE_REMOVE == rlvCmd.getParamType()) ); @@ -1434,7 +1435,7 @@ ERlvCmdRet RlvHandler::onAddRemAttach(const RlvCommand& rlvCmd, bool& fRefCount) return RLV_RET_SUCCESS; } -// Checked: 2010-02-28 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a +// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a ERlvCmdRet RlvHandler::onAddRemDetach(const RlvCommand& rlvCmd, bool& fRefCount) { RLV_ASSERT( (RLV_TYPE_ADD == rlvCmd.getParamType()) || (RLV_TYPE_REMOVE == rlvCmd.getParamType()) ); @@ -1608,7 +1609,10 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const { F32 nValue = (rlvCmdOption.m_nPelvisToFoot - gAgentAvatarp->getPelvisToFoot()) * rlvCmdOption.m_nPelvisToFootDeltaMult; nValue += rlvCmdOption.m_nPelvisToFootOffset; - gSavedSettings.setF32(RLV_SETTING_AVATAROFFSET_Z, llclamp(nValue, -1.0f, 1.0f)); + if (!gAgentAvatarp->isUsingServerBakes()) + gSavedSettings.setF32(RLV_SETTING_AVATAROFFSET_Z, llclamp(nValue, -1.0f, 1.0f)); + else + eRet = RLV_RET_FAILED_DISABLED; } } break; @@ -1665,7 +1669,7 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const return eRet; } -// Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c +// Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c ERlvCmdRet RlvHandler::onForceRemAttach(const RlvCommand& rlvCmd) const { RLV_ASSERT(RLV_TYPE_FORCE == rlvCmd.getParamType()); @@ -1700,7 +1704,7 @@ ERlvCmdRet RlvHandler::onForceRemAttach(const RlvCommand& rlvCmd) const return RLV_RET_FAILED_OPTION; } -// Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c +// Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c ERlvCmdRet RlvHandler::onForceRemOutfit(const RlvCommand& rlvCmd) const { RlvCommandOptionGeneric rlvCmdOption(rlvCmd.getOption()); @@ -1739,14 +1743,7 @@ ERlvCmdRet RlvHandler::onForceGroup(const RlvCommand& rlvCmd) const if (fValid) { m_idAgentGroup = idGroup; - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, idGroup); - gAgent.sendReliableMessage(); + LLGroupActions::activate(idGroup); } return (fValid) ? RLV_RET_SUCCESS : RLV_RET_FAILED_OPTION; @@ -1831,7 +1828,7 @@ void RlvHandler::onForceWearCallback(const uuid_vec_t& idItems, ERlvBehaviour eB // Command handlers (RLV_TYPE_REPLY) // -// Checked: 2009-11-26 (RLVa-1.1.0f) | Modified: RLVa-1.1.0f +// Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.1.0f ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const { RLV_ASSERT(RLV_TYPE_REPLY == rlvCmd.getParamType()); @@ -1844,12 +1841,12 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const ERlvCmdRet eRet = RLV_RET_SUCCESS; std::string strReply; switch (rlvCmd.getBehaviourType()) { - case RLV_BHVR_VERSION: // @version= - Checked: 2010-03-27 (RLVa-1.2.0b) - case RLV_BHVR_VERSIONNEW: // @versionnew= - Checked: 2010-03-27 (RLVa-1.2.0b) | Added: RLVa-1.2.0b + case RLV_BHVR_VERSION: // @version= - Checked: 2010-03-27 (RLVa-1.4.0a) + case RLV_BHVR_VERSIONNEW: // @versionnew= - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.2.0b // NOTE: RLV will respond even if there's an option strReply = RlvStrings::getVersion(RLV_BHVR_VERSION == rlvCmd.getBehaviourType()); break; - case RLV_BHVR_VERSIONNUM: // @versionnum= - Checked: 2009-11-26 (RLVa-1.1.0f) | Added: RLVa-1.0.4b + case RLV_BHVR_VERSIONNUM: // @versionnum= - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.4b // NOTE: RLV will respond even if there's an option strReply = RlvStrings::getVersionNum(); break; @@ -1886,7 +1883,7 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const case RLV_BHVR_GETINV: // @getinv[:]= eRet = onGetInv(rlvCmd, strReply); break; - case RLV_BHVR_GETINVWORN: // @getinvworn[:path]= + case RLV_BHVR_GETINVWORN: // @getinvworn[:]= eRet = onGetInvWorn(rlvCmd, strReply); break; case RLV_BHVR_GETGROUP: // @getgroup= - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f @@ -1915,7 +1912,7 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const } break; #endif // RLV_EXTENSION_CMD_GETCOMMAND - case RLV_BHVR_GETSTATUS: // @getstatus[: