From b01c75cb423f07a3d3354f8bd62f265f80062b3b Mon Sep 17 00:00:00 2001 From: Adam Moss Date: Thu, 16 Apr 2009 23:45:35 +0000 Subject: svn merge -r117314:117337 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/mv13a-merge-1 QAR-1343 maint-viewer-13a+libcurlexploitfix-3-3 combo merge --- indra/CMakeLists.txt | 4 +- indra/llcharacter/lleditingmotion.cpp | 6 +- indra/llcharacter/llkeyframemotion.cpp | 4 +- indra/llcharacter/llkeyframemotionparam.cpp | 16 +- indra/llcommon/llerror.cpp | 30 +- indra/llcommon/llerrorlegacy.h | 11 +- indra/llcommon/llsdserialize.cpp | 8 +- indra/llcommon/llstat.cpp | 7 +- indra/llcommon/llstat.h | 17 +- indra/llcommon/llstreamtools.cpp | 26 +- indra/llcommon/llsys.cpp | 4 +- indra/llcommon/roles_constants.h | 14 +- indra/llimage/llimage.cpp | 71 ++- indra/llinventory/llinventory.cpp | 20 +- indra/llmessage/llcachename.cpp | 1 + indra/llmessage/llcircuit.cpp | 10 +- indra/llmessage/llcurl.cpp | 2 +- indra/llmessage/lldatapacker.cpp | 7 +- indra/llmessage/llhttpclient.cpp | 7 +- indra/llmessage/llinstantmessage.h | 1 + indra/llmessage/lltemplatemessagereader.cpp | 6 +- indra/llrender/llglslshader.cpp | 2 +- indra/llrender/llrender.cpp | 6 +- indra/llrender/llvertexbuffer.cpp | 12 +- indra/llui/llclipboard.cpp | 41 ++ indra/llui/llclipboard.h | 11 +- indra/llui/llfloater.cpp | 8 +- indra/llui/llfloater.h | 2 +- indra/llui/lllineeditor.cpp | 97 +++- indra/llui/lllineeditor.h | 13 +- indra/llui/llmenugl.cpp | 3 +- indra/llui/llresmgr.cpp | 6 +- indra/llui/llscrolllistctrl.cpp | 11 + indra/llui/lltexteditor.cpp | 137 +++++- indra/llui/lltexteditor.h | 11 + indra/llui/llview.cpp | 78 ++++ indra/llui/llview.h | 4 + indra/llvfs/llvfs.cpp | 54 +-- indra/llwindow/CMakeLists.txt | 1 + indra/llwindow/llmousehandler.cpp | 63 +++ indra/llwindow/llmousehandler.h | 21 +- indra/llwindow/llwindow.cpp | 28 +- indra/llwindow/llwindow.h | 6 + indra/llwindow/llwindowmacosx.cpp | 21 +- indra/llwindow/llwindowsdl.cpp | 79 +++- indra/llwindow/llwindowsdl.h | 6 + indra/lscript/lscript_compile/lscript_bytecode.cpp | 2 +- indra/lscript/lscript_execute/lscript_execute.cpp | 2 +- indra/lscript/lscript_execute/lscript_readlso.cpp | 2 +- indra/mac_updater/mac_updater.cpp | 6 +- indra/newview/CMakeLists.txt | 2 - .../newview/app_settings/settings_per_account.xml | 11 + .../newview/linux_tools/client-readme-joystick.txt | 2 +- indra/newview/llagent.cpp | 6 +- indra/newview/llappviewer.cpp | 10 +- indra/newview/llappviewer.h | 1 - indra/newview/llappviewerlinux.cpp | 45 +- indra/newview/llappviewermacosx.cpp | 2 +- indra/newview/lldrawable.cpp | 8 + indra/newview/llfilepicker.h | 2 + indra/newview/llfloaterchatterbox.h | 9 +- indra/newview/llfloatergesture.cpp | 17 +- indra/newview/llfloaterimagepreview.cpp | 13 +- indra/newview/llfloateropenobject.cpp | 18 +- indra/newview/llfloaterregioninfo.cpp | 15 +- indra/newview/llfloatersnapshot.cpp | 7 +- indra/newview/llfloaterworldmap.cpp | 2 +- indra/newview/llfolderview.cpp | 8 +- indra/newview/llfolderview.h | 4 +- indra/newview/llgesturemgr.cpp | 14 +- indra/newview/llgroupmgr.cpp | 7 +- indra/newview/llhudeffectpointat.cpp | 10 +- indra/newview/llhudeffecttrail.cpp | 2 +- indra/newview/llimpanel.cpp | 2 +- indra/newview/llinventorybridge.cpp | 15 +- indra/newview/lllandmarklist.cpp | 8 +- indra/newview/lllogchat.cpp | 2 +- indra/newview/llmutelist.cpp | 5 +- indra/newview/llpanelavatar.cpp | 28 +- indra/newview/llpanelavatar.h | 3 + indra/newview/llpanelface.cpp | 5 +- indra/newview/llpanelgroup.cpp | 3 - indra/newview/llpanelgroupgeneral.cpp | 2 +- indra/newview/llpanelgrouplandmoney.cpp | 2 +- indra/newview/llpanelgroupnotices.cpp | 26 +- indra/newview/llpanelpermissions.cpp | 8 +- indra/newview/llpreviewgesture.cpp | 9 +- indra/newview/llpreviewnotecard.cpp | 11 +- indra/newview/llpreviewscript.cpp | 45 +- indra/newview/llpreviewscript.h | 3 + indra/newview/llselectmgr.cpp | 16 - indra/newview/llselectmgr.h | 3 - indra/newview/llstartup.cpp | 23 +- indra/newview/llstatusbar.cpp | 14 +- indra/newview/lltexturecache.cpp | 2 +- indra/newview/lltool.cpp | 15 +- indra/newview/lltool.h | 3 + indra/newview/lltoolfocus.cpp | 4 +- indra/newview/lltoolgrab.cpp | 29 +- indra/newview/lltracker.cpp | 2 + indra/newview/lluploaddialog.cpp | 18 +- indra/newview/llviewercontrol.cpp | 15 +- indra/newview/llviewerjoystick.cpp | 7 + indra/newview/llviewermenu.cpp | 124 +++--- indra/newview/llviewermenufile.cpp | 6 +- indra/newview/llviewermessage.cpp | 73 +-- indra/newview/llviewerobject.cpp | 6 +- indra/newview/llviewerparcelmgr.cpp | 7 +- indra/newview/llviewerregion.cpp | 11 +- indra/newview/llviewertexteditor.cpp | 79 ++-- indra/newview/llviewertexteditor.h | 2 + indra/newview/llviewerwindow.cpp | 488 ++++++--------------- indra/newview/llviewerwindow.h | 9 +- indra/newview/llvlcomposition.cpp | 8 +- indra/newview/llwearable.cpp | 2 +- indra/newview/llworld.cpp | 9 +- indra/newview/llworldmapview.cpp | 4 +- 117 files changed, 1345 insertions(+), 1031 deletions(-) create mode 100644 indra/llwindow/llmousehandler.cpp (limited to 'indra') diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index d19811586f..7f4c2c33c1 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -50,9 +50,9 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llvfs) add_subdirectory(${LIBS_OPEN_PREFIX}llwindow) add_subdirectory(${LIBS_OPEN_PREFIX}llxml) -if (EXISTS ${LIBS_CLOSED_DIR}llkdu AND NOT STANDALONE) +if (EXISTS ${LIBS_CLOSED_DIR}llkdu) add_subdirectory(${LIBS_CLOSED_PREFIX}llkdu) -endif (EXISTS ${LIBS_CLOSED_DIR}llkdu AND NOT STANDALONE) +endif (EXISTS ${LIBS_CLOSED_DIR}llkdu) add_subdirectory(${LIBS_OPEN_PREFIX}lscript) diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 913be27ba7..6907df82d4 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -190,8 +190,10 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) if (!llfinite(focus_pt.magVecSquared())) { LLVector3 tmp = mCharacter->getCharacterPosition() ; - llerrs << "Non finite focus point in editing motion. focus point: " << focus_pt << " and character position: " << - tmp << " and pointAtPt: " << *pointAtPt << llendl; + LL_WARNS_ONCE("Animation") << "Non finite focus point in editing motion. focus point: " << focus_pt << " and character position: " << + tmp << " and pointAtPt: " << pointAtPt << + " - ignoring anim" << LL_ENDL; + return FALSE; } // propagate joint positions to kinematic chain diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index e1c457b745..19d8386255 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -468,7 +468,7 @@ LLMotion *LLKeyframeMotion::create(const LLUUID &id) //----------------------------------------------------------------------------- LLPointer& LLKeyframeMotion::getJointState(U32 index) { - llassert_always (index < (S32)mJointStates.size()); + llassert_always (index < mJointStates.size()); return mJointStates[index]; } @@ -477,7 +477,7 @@ LLPointer& LLKeyframeMotion::getJointState(U32 index) //----------------------------------------------------------------------------- LLJoint* LLKeyframeMotion::getJoint(U32 index) { - llassert_always (index < (S32)mJointStates.size()); + llassert_always (index < mJointStates.size()); LLJoint* joint = mJointStates[index]->getJoint(); llassert_always (joint); return joint; diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index a9c1f6fc45..622405a5e1 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -364,18 +364,13 @@ BOOL LLKeyframeMotionParam::loadMotions() } // allocate a text buffer - char *text = new char[ fileSize+1 ]; - if ( !text ) - { - llinfos << "ERROR: can't allocated keyframe text buffer." << llendl; - return FALSE; - } + std::vector text(fileSize+1); //------------------------------------------------------------------------- // load data from file into buffer //------------------------------------------------------------------------- bool error = false; - char *p = text; + char *p = &text[0]; while ( 1 ) { if (apr_file_eof(fp) == APR_EOF) @@ -399,12 +394,11 @@ BOOL LLKeyframeMotionParam::loadMotions() //------------------------------------------------------------------------- // check for error //------------------------------------------------------------------------- - llassert( p <= (text+fileSize) ); + llassert( p <= (&text[0] + fileSize) ); if ( error ) { llinfos << "ERROR: error while reading from " << path << llendl; - delete [] text; return FALSE; } @@ -413,7 +407,7 @@ BOOL LLKeyframeMotionParam::loadMotions() //------------------------------------------------------------------------- // parse the text and build keyframe data structures //------------------------------------------------------------------------- - p = text; + p = &text[0]; S32 num; char strA[80]; /* Flawfinder: ignore */ char strB[80]; /* Flawfinder: ignore */ @@ -432,7 +426,6 @@ BOOL LLKeyframeMotionParam::loadMotions() if ((num != 3)) { llinfos << "WARNING: can't read parametric motion" << llendl; - delete [] text; return FALSE; } @@ -453,7 +446,6 @@ BOOL LLKeyframeMotionParam::loadMotions() num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */ } - delete [] text; return TRUE; } diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 5e520afab9..e8c95d0a76 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1083,29 +1083,6 @@ namespace LLError #endif prefix << site.mFunction << ": "; - if (site.mPrintOnce) - { - std::map::iterator messageIter = s.uniqueLogMessages.find(message); - if (messageIter != s.uniqueLogMessages.end()) - { - messageIter->second++; - unsigned int num_messages = messageIter->second; - if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0) - { - prefix << "ONCE (" << num_messages << "th time seen): "; - } - else - { - return; - } - } - else - { - prefix << "ONCE: "; - s.uniqueLogMessages[message] = 1; - } - } - if (site.mPrintOnce) { std::map::iterator messageIter = s.uniqueLogMessages.find(message); @@ -1210,14 +1187,17 @@ namespace LLError void crashAndLoop(const std::string& message) { // Now, we go kaboom! - int* crash = NULL; + int* make_me_crash = NULL; - *crash = 0; + *make_me_crash = 0; while(true) { // Loop forever, in case the crash didn't work? } + + // this is an attempt to let Coverity and other semantic scanners know that this function won't be returning ever. + exit(EXIT_FAILURE); } #if LL_WINDOWS #pragma optimize("", on) diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h index 143fe20180..7a970b1466 100644 --- a/indra/llcommon/llerrorlegacy.h +++ b/indra/llcommon/llerrorlegacy.h @@ -103,17 +103,14 @@ const int LL_ERR_PRICE_MISMATCH = -23018; #define llwarning(msg, num) llwarns << "Warning # " << num << ": " << msg << llendl; -#ifdef SHOW_ASSERT -#define llassert(func) if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl; -#else -#define llassert(func) -#endif #define llassert_always(func) if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl; #ifdef SHOW_ASSERT -#define llverify(func) if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl; +#define llassert(func) llassert_always(func) +#define llverify(func) llassert_always(func) #else -#define llverify(func) (func); // get rid of warning C4189 +#define llassert(func) +#define llverify(func) do {if (func) {}} while(0) #endif // handy compile-time assert - enforce those template parameters! diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 9f4ce64d2c..7a66d70d3f 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -1502,7 +1502,7 @@ void LLSDBinaryFormatter::formatString( */ int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes) { - char c = istr.get(); + int c = istr.get(); if(istr.fail()) { // No data in stream, bail out but mention the character we @@ -1544,7 +1544,7 @@ int deserialize_string_delim( while (true) { - char next_char = istr.get(); + int next_byte = istr.get(); ++count; if(istr.fail()) @@ -1553,6 +1553,8 @@ int deserialize_string_delim( value = write_buffer.str(); return LLSDParser::PARSE_FAILURE; } + + char next_char = (char)next_byte; // Now that we know it's not EOF if(found_escape) { @@ -1641,7 +1643,7 @@ int deserialize_string_raw( char buf[BUF_LEN]; /* Flawfinder: ignore */ istr.get(buf, BUF_LEN - 1, ')'); count += istr.gcount(); - char c = istr.get(); + int c = istr.get(); c = istr.get(); count += 2; if(((c == '"') || (c == '\'')) && (buf[0] == '(')) diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp index cbf5a2e1c1..e411a1c798 100644 --- a/indra/llcommon/llstat.cpp +++ b/indra/llcommon/llstat.cpp @@ -327,6 +327,7 @@ U64 LLStatAccum::sScaleTimes[NUM_SCALES] = LLStatAccum::LLStatAccum(bool useFrameTimer) : mUseFrameTimer(useFrameTimer), mRunning(FALSE), + mLastTime(0), mLastSampleValue(0.0), mLastSampleValid(FALSE) { @@ -347,7 +348,7 @@ void LLStatAccum::reset(U64 when) { mBuckets[i].accum = 0.0; mBuckets[i].endTime = when + sScaleTimes[i]; - mBuckets[i].lastValid = FALSE; + mBuckets[i].lastValid = false; } } @@ -395,7 +396,7 @@ void LLStatAccum::sum(F64 value, U64 when) { F64 valueLeft = value * timeLeft / timeSpan; - bucket.lastValid = TRUE; + bucket.lastValid = true; bucket.lastAccum = bucket.accum + (value - valueLeft); bucket.accum = valueLeft; bucket.endTime += timeScale; @@ -404,7 +405,7 @@ void LLStatAccum::sum(F64 value, U64 when) { U64 timeTail = timeLeft % timeScale; - bucket.lastValid = TRUE; + bucket.lastValid = true; bucket.lastAccum = value * timeScale / timeSpan; bucket.accum = value * timeTail / timeSpan; bucket.endTime += (timeLeft - timeTail) + timeScale; diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h index 66521a31cb..61aaac45bf 100644 --- a/indra/llcommon/llstat.h +++ b/indra/llcommon/llstat.h @@ -96,11 +96,18 @@ public: struct Bucket { - F64 accum; - U64 endTime; - - BOOL lastValid; - F64 lastAccum; + Bucket() : + accum(0.0), + endTime(0), + lastValid(false), + lastAccum(0.0) + {} + + F64 accum; + U64 endTime; + + bool lastValid; + F64 lastAccum; }; Bucket mBuckets[NUM_SCALES]; diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index ee4f46318f..4ed2df58e0 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -45,7 +45,7 @@ // skips spaces and tabs bool skip_whitespace(std::istream& input_stream) { - char c = input_stream.peek(); + int c = input_stream.peek(); while (('\t' == c || ' ' == c) && input_stream.good()) { input_stream.get(); @@ -57,7 +57,7 @@ bool skip_whitespace(std::istream& input_stream) // skips whitespace, newlines, and carriage returns bool skip_emptyspace(std::istream& input_stream) { - char c = input_stream.peek(); + int c = input_stream.peek(); while ( input_stream.good() && ('\t' == c || ' ' == c || '\n' == c || '\r' == c) ) { @@ -72,7 +72,7 @@ bool skip_comments_and_emptyspace(std::istream& input_stream) { while (skip_emptyspace(input_stream)) { - char c = input_stream.peek(); + int c = input_stream.peek(); if ('#' == c ) { while ('\n' != c && input_stream.good()) @@ -90,7 +90,7 @@ bool skip_comments_and_emptyspace(std::istream& input_stream) bool skip_line(std::istream& input_stream) { - char c; + int c; do { c = input_stream.get(); @@ -100,7 +100,7 @@ bool skip_line(std::istream& input_stream) bool skip_to_next_word(std::istream& input_stream) { - char c = input_stream.peek(); + int c = input_stream.peek(); while ( input_stream.good() && ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') @@ -132,7 +132,7 @@ bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream while (input_stream.good()) { skip_emptyspace(input_stream); - char c = input_stream.get(); + int c = input_stream.get(); if (keyword[0] != c) { skip_line(input_stream); @@ -181,7 +181,7 @@ bool skip_to_start_of_next_keyword(const char* keyword, std::istream& input_stre while (input_stream.good()) { skip_emptyspace(input_stream); - char c = input_stream.get(); + int c = input_stream.get(); if (keyword[0] != c) { skip_line(input_stream); @@ -229,7 +229,7 @@ bool skip_to_start_of_next_keyword(const char* keyword, std::istream& input_stre bool get_word(std::string& output_string, std::istream& input_stream) { skip_emptyspace(input_stream); - char c = input_stream.peek(); + int c = input_stream.peek(); while ( !isspace(c) && '\n' != c && '\r' != c @@ -246,7 +246,7 @@ bool get_word(std::string& output_string, std::istream& input_stream, int n) { skip_emptyspace(input_stream); int char_count = 0; - char c = input_stream.peek(); + int c = input_stream.peek(); while (!isspace(c) && '\n' != c && '\r' != c @@ -265,7 +265,7 @@ bool get_word(std::string& output_string, std::istream& input_stream, int n) bool get_line(std::string& output_string, std::istream& input_stream) { output_string.clear(); - char c = input_stream.get(); + int c = input_stream.get(); while (input_stream.good()) { output_string += c; @@ -285,7 +285,7 @@ bool get_line(std::string& output_string, std::istream& input_stream, int n) { output_string.clear(); int char_count = 0; - char c = input_stream.get(); + int c = input_stream.get(); while (input_stream.good() && char_count < n) { char_count++; @@ -436,7 +436,7 @@ void get_keyword_and_value(std::string& keyword, while (line_index < line_size) { c = line[line_index]; - if (!isspace(c)) + if (!LLStringOps::isSpace(c)) { break; } @@ -448,7 +448,7 @@ void get_keyword_and_value(std::string& keyword, while (line_index < line_size) { c = line[line_index]; - if (isspace(c) || '\r' == c || '\n' == c) + if (LLStringOps::isSpace(c) || '\r' == c || '\n' == c) { break; } diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 2e93b2a3a7..4d03c4d40d 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -226,8 +226,8 @@ LLOSInfo::LLOSInfo() : else if (ostype == "Linux") { // Only care about major and minor Linux versions, truncate at second '.' - S32 idx1 = mOSStringSimple.find_first_of(".", 0); - S32 idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos; + std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0); + std::string::size_type idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos; std::string simple = mOSStringSimple.substr(0, idx2); if (simple.length() > 0) mOSStringSimple = simple; diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h index 854a153d19..57f2418c0f 100644 --- a/indra/llcommon/roles_constants.h +++ b/indra/llcommon/roles_constants.h @@ -141,7 +141,9 @@ const U64 GP_NOTICES_SEND = 0x1LL << 42; // Send Notices const U64 GP_NOTICES_RECEIVE = 0x1LL << 43; // Receive Notices and View Notice History // Proposals +// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856: const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal +// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856: const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal // Group chat moderation related @@ -152,20 +154,17 @@ const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE | GP_LAND_ALLOW_SET_HOME | GP_NOTICES_RECEIVE - | GP_PROPOSAL_START - | GP_PROPOSAL_VOTE - | GP_SESSION_JOIN + | GP_SESSION_JOIN | GP_SESSION_VOICE ; -const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE +const U64 GP_DEFAULT_OFFICER = GP_DEFAULT_MEMBER // Superset of GP_DEFAULT_MEMBER | GP_GROUP_CHANGE_IDENTITY | GP_LAND_ADMIN | GP_LAND_ALLOW_EDIT_LAND | GP_LAND_ALLOW_FLY | GP_LAND_ALLOW_CREATE | GP_LAND_ALLOW_LANDMARK - | GP_LAND_ALLOW_SET_HOME | GP_LAND_CHANGE_IDENTITY | GP_LAND_CHANGE_MEDIA | GP_LAND_DEED @@ -187,17 +186,12 @@ const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE | GP_MEMBER_INVITE | GP_MEMBER_OPTIONS | GP_MEMBER_VISIBLE_IN_DIR - | GP_NOTICES_RECEIVE | GP_NOTICES_SEND | GP_OBJECT_DEED | GP_OBJECT_MANIPULATE | GP_OBJECT_SET_SALE - | GP_PROPOSAL_START - | GP_PROPOSAL_VOTE | GP_ROLE_ASSIGN_MEMBER_LIMITED | GP_ROLE_PROPERTIES | GP_SESSION_MODERATOR - | GP_SESSION_JOIN - | GP_SESSION_VOICE ; #endif diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 88edc9943c..93ddc65f32 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -417,22 +417,17 @@ void LLImageRaw::verticalFlip() { LLMemType mt1((LLMemType::EMemType)mMemType); S32 row_bytes = getWidth() * getComponents(); - U8* line_buffer = new U8[row_bytes]; - if (!line_buffer ) - { - llerrs << "Out of memory in LLImageRaw::verticalFlip()" << llendl; - return; - } + llassert(row_bytes > 0); + std::vector line_buffer(row_bytes); S32 mid_row = getHeight() / 2; for( S32 row = 0; row < mid_row; row++ ) { U8* row_a_data = getData() + row * row_bytes; U8* row_b_data = getData() + (getHeight() - 1 - row) * row_bytes; - memcpy( line_buffer, row_a_data, row_bytes ); /* Flawfinder: ignore */ - memcpy( row_a_data, row_b_data, row_bytes ); /* Flawfinder: ignore */ - memcpy( row_b_data, line_buffer, row_bytes ); /* Flawfinder: ignore */ + memcpy( &line_buffer[0], row_a_data, row_bytes ); + memcpy( row_a_data, row_b_data, row_bytes ); + memcpy( row_b_data, &line_buffer[0], row_bytes ); } - delete[] line_buffer; } @@ -560,22 +555,21 @@ void LLImageRaw::compositeScaled4onto3(LLImageRaw* src) llassert( (4 == src->getComponents()) && (3 == dst->getComponents()) ); - // Vertical: scale but no composite S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents(); - U8* temp_buffer = new U8[ temp_data_size ]; + llassert_always(temp_data_size > 0); + std::vector temp_buffer(temp_data_size); + + // Vertical: scale but no composite for( S32 col = 0; col < src->getWidth(); col++ ) { - copyLineScaled( src->getData() + (src->getComponents() * col), temp_buffer + (src->getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() ); + copyLineScaled( src->getData() + (src->getComponents() * col), &temp_buffer[0] + (src->getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() ); } // Horizontal: scale and composite for( S32 row = 0; row < dst->getHeight(); row++ ) { - compositeRowScaled4onto3( temp_buffer + (src->getComponents() * src->getWidth() * row), dst->getData() + (dst->getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth() ); + compositeRowScaled4onto3( &temp_buffer[0] + (src->getComponents() * src->getWidth() * row), dst->getData() + (dst->getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth() ); } - - // Clean up - delete[] temp_buffer; } @@ -805,23 +799,21 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) return; } - // Vertical S32 temp_data_size = src->getWidth() * dst->getHeight() * getComponents(); llassert_always(temp_data_size > 0); - U8* temp_buffer = new U8[ temp_data_size ]; + std::vector temp_buffer(temp_data_size); + + // Vertical for( S32 col = 0; col < src->getWidth(); col++ ) { - copyLineScaled( src->getData() + (getComponents() * col), temp_buffer + (getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() ); + copyLineScaled( src->getData() + (getComponents() * col), &temp_buffer[0] + (getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() ); } // Horizontal for( S32 row = 0; row < dst->getHeight(); row++ ) { - copyLineScaled( temp_buffer + (getComponents() * src->getWidth() * row), dst->getData() + (getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth(), 1, 1 ); + copyLineScaled( &temp_buffer[0] + (getComponents() * src->getWidth() * row), dst->getData() + (getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth(), 1, 1 ); } - - // Clean up - delete[] temp_buffer; } @@ -842,12 +834,14 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) if (scale_image_data) { - // Vertical S32 temp_data_size = old_width * new_height * getComponents(); - U8* temp_buffer = new U8[ temp_data_size ]; + llassert_always(temp_data_size > 0); + std::vector temp_buffer(temp_data_size); + + // Vertical for( S32 col = 0; col < old_width; col++ ) { - copyLineScaled( getData() + (getComponents() * col), temp_buffer + (getComponents() * col), old_height, new_height, old_width, old_width ); + copyLineScaled( getData() + (getComponents() * col), &temp_buffer[0] + (getComponents() * col), old_height, new_height, old_width, old_width ); } deleteData(); @@ -857,25 +851,15 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) // Horizontal for( S32 row = 0; row < new_height; row++ ) { - copyLineScaled( temp_buffer + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 ); + copyLineScaled( &temp_buffer[0] + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 ); } - - // Clean up - delete[] temp_buffer; } else { // copy out existing image data S32 temp_data_size = old_width * old_height * getComponents(); - U8* temp_buffer = new U8[ temp_data_size ]; - if (!temp_buffer) - { - llwarns << "Out of memory in LLImageRaw::scale: old (w, h, c) = (" << old_width << ", " << old_height << ", " << (S32)getComponents() << - ") ; new (w, h, c) = (" << new_width << ", " << new_height << ", " << (S32)getComponents() << ")" << llendl; - - return FALSE ; - } - memcpy(temp_buffer, getData(), temp_data_size); /* Flawfinder: ignore */ + std::vector temp_buffer(temp_data_size); + memcpy(&temp_buffer[0], getData(), temp_data_size); // allocate new image data, will delete old data U8* new_buffer = allocateDataSize(new_width, new_height, getComponents()); @@ -884,7 +868,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) { if (row < old_height) { - memcpy(new_buffer + (new_width * row * getComponents()), temp_buffer + (old_width * row * getComponents()), getComponents() * llmin(old_width, new_width)); /* Flawfinder: ignore */ + memcpy(new_buffer + (new_width * row * getComponents()), &temp_buffer[0] + (old_width * row * getComponents()), getComponents() * llmin(old_width, new_width)); if (old_width < new_width) { // pad out rest of row with black @@ -897,9 +881,6 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) memset(new_buffer + (new_width * row * getComponents()), 0, new_width * getComponents()); } } - - // Clean up - delete[] temp_buffer; } return TRUE ; @@ -1239,7 +1220,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip llassert(image.notNull()); U8 *buffer = image->allocateData(length); - ifs.read ((char*)buffer, length); /* Flawfinder: ignore */ + ifs.read ((char*)buffer, length); ifs.close(); image->updateData(); diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 4dddd9de3e..2823cf7be9 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1257,23 +1257,19 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) // Early exit on an empty binary bucket. if (bin_bucket_size <= 1) return; - // Convert the bin_bucket into a string. - char* item_buffer = new char[bin_bucket_size+1]; - if ((item_buffer != NULL) && (bin_bucket != NULL)) - { - memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */ - } - else + if (NULL == bin_bucket) { - llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl; - delete[] item_buffer; + llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl; return; } + + // Convert the bin_bucket into a string. + std::vector item_buffer(bin_bucket_size+1); + memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */ item_buffer[bin_bucket_size] = '\0'; - std::string str(item_buffer); + std::string str(&item_buffer[0]); - lldebugs << "item buffer: " << item_buffer << llendl; - delete[] item_buffer; + lldebugs << "item buffer: " << str << llendl; // Tokenize the string. typedef boost::tokenizer > tokenizer; diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 1e6584a085..799bc83e20 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -426,6 +426,7 @@ bool LLCacheName::importFile(std::istream& istr) entry->mFirstName = agent[FIRST].asString(); entry->mLastName = agent[LAST].asString(); impl.mCache[id] = entry; + ++count; } llinfos << "LLCacheName loaded " << count << " agent names" << llendl; diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 725425cc20..7c60886ed3 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -77,6 +77,8 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mPacketsOutID(0), mPacketsInID(in_id), mHighestPacketID(in_id), + mTimeoutCallback(NULL), + mTimeoutUserData(NULL), mTrusted(FALSE), mbAllowTimeout(TRUE), mbAlive(TRUE), @@ -102,11 +104,12 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mBytesOutLastPeriod(0), mBytesInThisPeriod(0), mBytesOutThisPeriod(0), - mPeakBPSIn(0), - mPeakBPSOut(0), + mPeakBPSIn(0.f), + mPeakBPSOut(0.f), mPeriodTime(0.0), mExistenceTimer(), mCurrentResendCount(0), + mLastPacketGap(0), mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout) { @@ -121,9 +124,6 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); mPeriodTime = mt_sec; - mTimeoutCallback = NULL; - mTimeoutUserData = NULL; - mLocalEndPointID.generate(); } diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index a4eb90d7ff..1a432cd7df 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -74,7 +74,7 @@ ////////////////////////////////////////////////////////////////////////////// -static const S32 EASY_HANDLE_POOL_SIZE = 5; +static const U32 EASY_HANDLE_POOL_SIZE = 5; static const S32 MULTI_PERFORM_CALL_REPEAT = 5; static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds static const S32 MAX_ACTIVE_REQUEST_COUNT = 100; diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 1cdb475b2f..1f52bf3a23 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -1896,7 +1896,12 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (mFP) { fpos_t last_pos; - fgetpos(mFP, &last_pos); + if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos + { + llwarns << "Data packer failed to fgetpos" << llendl; + return FALSE; + } + if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) { buffer[0] = '\0'; diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index a6041b4139..307d9b92fa 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -161,10 +161,9 @@ namespace fstream.seekg(0, std::ios::end); U32 fileSize = fstream.tellg(); fstream.seekg(0, std::ios::beg); - char* fileBuffer; - fileBuffer = new char [fileSize]; - fstream.read(fileBuffer, fileSize); - ostream.write(fileBuffer, fileSize); + std::vector fileBuffer(fileSize); + fstream.read(&fileBuffer[0], fileSize); + ostream.write(&fileBuffer[0], fileSize); fstream.close(); eos = true; return STATUS_DONE; diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index 96a2cf9cab..9ce6a10c80 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -74,6 +74,7 @@ enum EInstantMessage // Group vote // Name is name of person who called vote. // ID is vote ID used for internal tracking + // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 IM_GROUP_VOTE = 7, // Group message diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index d635844ee5..40e46b0ce9 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -677,7 +677,11 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender // default to 0s. U32 size = mvci.getSize(); std::vector data(size); - memset(&(data[0]), 0, size); + if(size) + { + // Nonsense test to get past GCC 4.3.1 bug with -O3 + memset(&(data[0]), 0, size); + } cur_data_block->addData(mvci.getName(), &(data[0]), size, mvci.getType()); } diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 08d654805e..9e34144658 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -209,7 +209,7 @@ BOOL LLGLSLShader::mapAttributes(const vector * attributes) { //read back channel locations //read back reserved channels first - for (U32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedAttribs.size(); i++) + for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++) { const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str(); S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index ba95a19787..6bb217a9c2 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -99,7 +99,7 @@ mCurrAlphaSrc1(TBS_TEX_ALPHA), mCurrAlphaSrc2(TBS_PREV_ALPHA), mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), mHasMipMaps(false) { - llassert_always(index < LL_NUM_TEXTURE_LAYERS); + llassert_always(index < (S32)LL_NUM_TEXTURE_LAYERS); mIndex = index; } @@ -141,7 +141,7 @@ void LLTexUnit::activate(void) { if (mIndex < 0) return; - if (gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) + if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) { glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); gGL.mCurrTextureUnitIndex = mIndex; @@ -821,7 +821,7 @@ void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor) LLTexUnit* LLRender::getTexUnit(U32 index) { - if ((index >= 0) && (index < mTexUnits.size())) + if (index < mTexUnits.size()) { return mTexUnits[index]; } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 461edbeec7..5d88ea464d 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -811,7 +811,7 @@ U8* LLVertexBuffer::mapBuffer(S32 access) GLint buff; glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); - if (buff != mGLBuffer) + if ((GLuint)buff != mGLBuffer) { llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; } @@ -824,7 +824,7 @@ U8* LLVertexBuffer::mapBuffer(S32 access) { GLint buff; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); - if (buff != mGLIndices) + if ((GLuint)buff != mGLIndices) { llerrs << "Invalid GL index buffer bound: " << buff << llendl; } @@ -1020,13 +1020,13 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { GLint buff; glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); - if (buff != mGLBuffer) + if ((GLuint)buff != mGLBuffer) { llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; } glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); - if (buff != mGLIndices) + if ((GLuint)buff != mGLIndices) { llerrs << "Invalid GL index buffer bound: " << buff << llendl; } @@ -1038,13 +1038,13 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { GLint buff; glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); - if (buff != mGLBuffer) + if ((GLuint)buff != mGLBuffer) { llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; } glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); - if (buff != mGLIndices) + if ((GLuint)buff != mGLIndices) { llerrs << "Invalid GL index buffer bound: " << buff << llendl; } diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 8a7a214048..2cb8197a67 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -93,3 +93,44 @@ BOOL LLClipboard::canPasteString() const { return LLView::getWindow()->isClipboardTextAvailable(); } + + +void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) +{ + mSourceID = source_id; + mString = src.substr(pos, len); + LLView::getWindow()->copyTextToPrimary( mString ); +} + + +const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) +{ + if( mSourceID.notNull() ) + { + LLWString temp_string; + LLView::getWindow()->pasteTextFromPrimary(temp_string); + + if( temp_string != mString ) + { + mSourceID.setNull(); + mString = temp_string; + } + } + else + { + LLView::getWindow()->pasteTextFromPrimary(mString); + } + + if( source_id ) + { + *source_id = mSourceID; + } + + return mString; +} + + +BOOL LLClipboard::canPastePrimaryString() const +{ + return LLView::getWindow()->isPrimaryTextAvailable(); +} diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 37ed1ffe58..034a7a6aeb 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -44,10 +44,19 @@ public: LLClipboard(); ~LLClipboard(); + /* We support two flavors of clipboard. The default is the explicitly + copy-and-pasted clipboard. The second is the so-called 'primary' clipboard + which is implicitly copied upon selection on platforms which expect this + (i.e. X11/Linux). */ + void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); BOOL canPasteString() const; const LLWString& getPasteWString(LLUUID* source_id = NULL); - + + void copyFromPrimarySubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); + BOOL canPastePrimaryString() const; + const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); + private: LLUUID mSourceID; LLWString mString; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 94af1868be..21f8f6e5f7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1193,6 +1193,12 @@ BOOL LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); } +BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + bringToFront( x, y ); + return LLPanel::handleMiddleMouseDown( x, y, mask ); +} + // virtual BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) @@ -2188,7 +2194,7 @@ BOOL LLFloaterView::allChildrenClosed() LLView* viewp = *it; LLFloater* floaterp = (LLFloater*)viewp; - if (floaterp->getVisible() && !floaterp->isDead() && floaterp->canClose()) + if (floaterp->getVisible() && !floaterp->isDead() && floaterp->isCloseable()) { return false; } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index a8f7c211fb..0e3d148b09 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -195,7 +195,7 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); virtual void draw(); virtual void onOpen() {} diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 6aa2aac48c..964254d93f 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -489,6 +489,9 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing mKeystrokeTimer.reset(); + // take selection to 'primary' clipboard + updatePrimary(); + return TRUE; } @@ -571,6 +574,17 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + // llinfos << "MiddleMouseDown" << llendl; + setFocus( TRUE ); + if( canPastePrimary() ) + { + setCursorAtLocalPos(x); + pastePrimary(); + } + return TRUE; +} BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { @@ -665,6 +679,9 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) { // delay cursor flashing mKeystrokeTimer.reset(); + + // take selection to 'primary' clipboard + updatePrimary(); } return handled; @@ -868,7 +885,12 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } } - + if(handled) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } @@ -877,7 +899,7 @@ void LLLineEditor::deleteSelection() if( !mReadOnly && hasSelection() ) { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 selection_length = abs( mSelectionStart - mSelectionEnd ); + S32 selection_length = llabs( mSelectionStart - mSelectionEnd ); mText.erase(left_pos, selection_length); deselect(); @@ -900,7 +922,7 @@ void LLLineEditor::cut() S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring( mText.getWString(), left_pos, length ); deleteSelection(); @@ -931,7 +953,7 @@ void LLLineEditor::copy() if( canCopy() ) { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring( mText.getWString(), left_pos, length ); } } @@ -941,20 +963,50 @@ BOOL LLLineEditor::canPaste() const return !mReadOnly && gClipboard.canPasteString(); } - -// paste from clipboard void LLLineEditor::paste() { - if (canPaste()) + bool is_primary = false; + pasteHelper(is_primary); +} + +void LLLineEditor::pastePrimary() +{ + bool is_primary = true; + pasteHelper(is_primary); +} + +// paste from primary (is_primary==true) or clipboard (is_primary==false) +void LLLineEditor::pasteHelper(bool is_primary) +{ + bool can_paste_it; + if (is_primary) + { + can_paste_it = canPastePrimary(); + } + else + { + can_paste_it = canPaste(); + } + + if (can_paste_it) { - LLWString paste = gClipboard.getPasteWString(); + LLWString paste; + if (is_primary) + { + paste = gClipboard.getPastePrimaryWString(); + } + else + { + paste = gClipboard.getPasteWString(); + } + if (!paste.empty()) { // Prepare for possible rollback LLLineEditorRollback rollback(this); // Delete any selected characters - if (hasSelection()) + if ((!is_primary) && hasSelection()) { deleteSelection(); } @@ -990,7 +1042,7 @@ void LLLineEditor::paste() clean_string = clean_string.substr(0, wchars_that_fit); reportBadKeystroke(); } - + mText.insert(getCursor(), clean_string); setCursor( getCursor() + (S32)clean_string.length() ); deselect(); @@ -1011,7 +1063,30 @@ void LLLineEditor::paste() } } - +// copy selection to primary +void LLLineEditor::copyPrimary() +{ + if( canCopy() ) + { + S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); + gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length ); + } +} + +BOOL LLLineEditor::canPastePrimary() const +{ + return !mReadOnly && gClipboard.canPastePrimaryString(); +} + +void LLLineEditor::updatePrimary() +{ + if(canCopy() ) + { + copyPrimary(); + } +} + BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { BOOL handled = FALSE; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 254ba19e59..fc5fcc5b90 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -90,6 +90,7 @@ public: /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); + /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ void onMouseCaptureLost(); @@ -97,13 +98,16 @@ public: // LLEditMenuHandler overrides virtual void cut(); virtual BOOL canCut() const; - virtual void copy(); virtual BOOL canCopy() const; - virtual void paste(); virtual BOOL canPaste() const; - + + virtual void updatePrimary(); + virtual void copyPrimary(); + virtual void pastePrimary(); + virtual BOOL canPastePrimary() const; + virtual void doDelete(); virtual BOOL canDoDelete() const; @@ -217,6 +221,9 @@ public: private: // private helper methods + + void pasteHelper(bool is_primary); + void removeChar(); void addChar(const llwchar c); void setCursorAtLocalPos(S32 local_mouse_x); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index f2f2aae382..5fb0e57c06 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -931,7 +931,8 @@ LLMenuItemCheckGL::LLMenuItemCheckGL ( const std::string& name, void* user_data, KEY key, MASK mask ) : LLMenuItemCallGL( name, label, clicked_cb, enabled_cb, user_data, key, mask ), - mCheckCallback( NULL ) + mCheckCallback( NULL ), + mChecked(FALSE) { setControlName(control_name, context); } diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 32d3d1f752..141b08c39d 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -257,6 +257,8 @@ std::string LLResMgr::getMonetaryString( S32 input ) const // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. // Fake up a conv structure with some reasonable values for the fields this function uses. struct lconv fakeconv; + char fake_neg[2] = "-"; + char fake_mon_group[4] = "\x03\x03\x00"; // commas every 3 digits if(conv->negative_sign[0] == 0) // Real locales all seem to have something here... { fakeconv = *conv; // start with what's there. @@ -265,8 +267,8 @@ std::string LLResMgr::getMonetaryString( S32 input ) const default: // Unknown -- use the US defaults. case LLLOCALE_USA: case LLLOCALE_UK: // UK ends up being the same as US for the items used here. - fakeconv.negative_sign = "-"; - fakeconv.mon_grouping = "\x03\x03\x00"; // commas every 3 digits + fakeconv.negative_sign = fake_neg; + fakeconv.mon_grouping = fake_mon_group; fakeconv.n_sign_posn = 1; // negative sign before the string break; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7b6c125eb1..5dd4e2d0ee 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -835,6 +835,12 @@ void LLScrollListCtrl::updateLayout() mItemListRect.mRight = getRect().getWidth() - mBorderThickness - SCROLLBAR_SIZE; } + // don't allow scrolling off bottom + if (mScrollLines + mPageLines > getItemCount()) + { + setScrollPos(llmax(0, getItemCount() - mPageLines)); + } + mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0)); mScrollbar->setPageSize( mPageLines ); mScrollbar->setDocSize( getItemCount() ); @@ -2663,6 +2669,11 @@ void LLScrollListCtrl::scrollToShowSelected() return; } + if (needsSorting() && !isSorted()) + { + sortItems(); + } + S32 index = getFirstSelectedIndex(); if (index < 0) { diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 7928887d4b..5e54c7a307 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -933,7 +933,7 @@ BOOL LLTextEditor::selectionContainsLineBreaks() if (hasSelection()) { S32 left = llmin(mSelectionStart, mSelectionEnd); - S32 right = left + abs(mSelectionStart - mSelectionEnd); + S32 right = left + llabs(mSelectionStart - mSelectionEnd); const LLWString &wtext = mWText; for( S32 i = left; i < right; i++ ) @@ -989,7 +989,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces ) { const LLWString &text = mWText; S32 left = llmin( mSelectionStart, mSelectionEnd ); - S32 right = left + abs( mSelectionStart - mSelectionEnd ); + S32 right = left + llabs( mSelectionStart - mSelectionEnd ); BOOL cursor_on_right = (mSelectionEnd > mSelectionStart); S32 cur = left; @@ -1203,6 +1203,18 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } +BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + setFocus( TRUE ); + if( canPastePrimary() ) + { + setCursorAtLocalPos( x, y, TRUE ); + pastePrimary(); + } + return TRUE; +} + + BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -1323,8 +1335,6 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) setCursorAtLocalPos( x, y, TRUE ); endSelection(); - - updateScrollFromCursor(); } if( !hasSelection() ) @@ -1332,6 +1342,9 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) handleMouseUpOverSegment( x, y, mask ); } + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } @@ -1394,8 +1407,12 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing resetKeystrokeTimer(); + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } + return handled; } @@ -1691,6 +1708,12 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) } } + if( handled ) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } @@ -1818,7 +1841,7 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op ) if( getEnabled() && hasSelection() ) { S32 pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); remove( pos, length, group_with_next_op ); @@ -1841,7 +1864,7 @@ void LLTextEditor::cut() return; } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID ); deleteSelection( FALSE ); @@ -1861,7 +1884,7 @@ void LLTextEditor::copy() return; } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring(mWText, left_pos, length, mSourceID); } @@ -1870,22 +1893,56 @@ BOOL LLTextEditor::canPaste() const return !mReadOnly && gClipboard.canPasteString(); } - // paste from clipboard void LLTextEditor::paste() { - if (!canPaste()) + bool is_primary = false; + pasteHelper(is_primary); +} + +// paste from primary +void LLTextEditor::pastePrimary() +{ + bool is_primary = true; + pasteHelper(is_primary); +} + +// paste from primary (itsprimary==true) or clipboard (itsprimary==false) +void LLTextEditor::pasteHelper(bool is_primary) +{ + bool can_paste_it; + if (is_primary) + { + can_paste_it = canPastePrimary(); + } + else + { + can_paste_it = canPaste(); + } + + if (!can_paste_it) { return; } + LLUUID source_id; - LLWString paste = gClipboard.getPasteWString(&source_id); + LLWString paste; + if (is_primary) + { + paste = gClipboard.getPastePrimaryWString(&source_id); + } + else + { + paste = gClipboard.getPasteWString(&source_id); + } + if (paste.empty()) { return; } + // Delete any selected characters (the paste replaces them) - if( hasSelection() ) + if( (!is_primary) && hasSelection() ) { deleteSelection(TRUE); } @@ -1919,6 +1976,32 @@ void LLTextEditor::paste() } + +// copy selection to primary +void LLTextEditor::copyPrimary() +{ + if( !canCopy() ) + { + return; + } + S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); + gClipboard.copyFromPrimarySubstring(mWText, left_pos, length, mSourceID); +} + +BOOL LLTextEditor::canPastePrimary() const +{ + return !mReadOnly && gClipboard.canPastePrimaryString(); +} + +void LLTextEditor::updatePrimary() +{ + if (canCopy()) + { + copyPrimary(); + } +} + BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) { BOOL handled = FALSE; @@ -1994,6 +2077,11 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) } } + if (handled) + { + updatePrimary(); + } + return handled; } @@ -4330,13 +4418,34 @@ S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse) } else { + // adjust the search slightly, to allow matching parenthesis inside the URL + S32 paren_count = 0; for (int index=pos; index<(S32)line.length(); index++) { char c = line[index]; - S32 m2 = closers.find(c); - if (m2 >= 0) + + if (c == '(') { - return index; + paren_count++; + } + else if (c == ')') + { + if (paren_count <= 0) + { + return index; + } + else + { + paren_count--; + } + } + else + { + S32 m2 = closers.find(c); + if (m2 >= 0) + { + return index; + } } } return line.length(); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 56825e7bfe..9291e1c436 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -84,6 +84,8 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); + virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + virtual BOOL handleKeyHere(KEY key, MASK mask ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); @@ -112,12 +114,19 @@ public: virtual BOOL canUndo() const; virtual void redo(); virtual BOOL canRedo() const; + virtual void cut(); virtual BOOL canCut() const; virtual void copy(); virtual BOOL canCopy() const; virtual void paste(); virtual BOOL canPaste() const; + + virtual void updatePrimary(); + virtual void copyPrimary(); + virtual void pastePrimary(); + virtual BOOL canPastePrimary() const; + virtual void doDelete(); virtual BOOL canDoDelete() const; virtual void selectAll(); @@ -430,6 +439,8 @@ private: // // Methods // + void pasteHelper(bool is_primary); + void updateSegments(); void pruneSegments(); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index a3db076b17..699c76a09d 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -987,6 +987,30 @@ BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) } return handled; } + +BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = childrenHandleMiddleMouseDown( x, y, mask ); + BOOL handled = (handled_view != NULL); + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + handled_view = this; + } + + return handled; +} + +BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + BOOL handled = childrenHandleMiddleMouseUp( x, y, mask ) != NULL; + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + } + return handled; +} + LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { @@ -1148,6 +1172,34 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) return handled_view; } +LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = NULL; + + if (getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) && + viewp->getVisible() && + viewp->getEnabled() && + viewp->handleMiddleMouseDown( local_x, local_y, mask )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + handled_view = viewp; + break; + } + } + } + return handled_view; +} + LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) { LLView* handled_view = NULL; @@ -1233,6 +1285,32 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) return handled_view; } +LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = NULL; + if( getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) && + viewp->getVisible() && + viewp->getEnabled() && + viewp->handleMiddleMouseUp( local_x, local_y, mask )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + handled_view = viewp; + break; + } + } + } + return handled_view; +} void LLView::draw() { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index b5a34bd4bd..e0e0f6ba47 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -465,6 +465,8 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); @@ -603,6 +605,8 @@ protected: LLView* childrenHandleHover(S32 x, S32 y, MASK mask); LLView* childrenHandleMouseUp(S32 x, S32 y, MASK mask); LLView* childrenHandleMouseDown(S32 x, S32 y, MASK mask); + LLView* childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask); + LLView* childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask); LLView* childrenHandleDoubleClick(S32 x, S32 y, MASK mask); LLView* childrenHandleScrollWheel(S32 x, S32 y, S32 clicks); LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index e5ffce4ffc..97632b3496 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -354,18 +354,17 @@ LLVFS::LLVFS(const std::string& index_filename, const std::string& data_filename (mIndexFP = openAndLock(mIndexFilename, file_mode, mReadOnly)) ) { - U8 *buffer = new U8[fbuf.st_size]; - size_t nread = fread(buffer, 1, fbuf.st_size, mIndexFP); - - U8 *tmp_ptr = buffer; - + std::vector buffer(fbuf.st_size); + size_t buf_offset = 0; + size_t nread = fread(&buffer[0], 1, fbuf.st_size, mIndexFP); + std::vector files_by_loc; - while (tmp_ptr < buffer + nread) + while (buf_offset < nread) { LLVFSFileBlock *block = new LLVFSFileBlock(); - block->deserialize(tmp_ptr, (S32)(tmp_ptr - buffer)); + block->deserialize(&buffer[buf_offset], (S32)buf_offset); // Do sanity check on this block. // Note that this skips zero size blocks, which helps VFS @@ -389,7 +388,6 @@ LLVFS::LLVFS(const std::string& index_filename, const std::string& data_filename LL_WARNS("VFS") << "Length: " << block->mLength << "\tLocation: " << block->mLocation << "\tSize: " << block->mSize << LL_ENDL; LL_WARNS("VFS") << "File has bad data - VFS removed" << LL_ENDL; - delete[] buffer; delete block; unlockAndClose( mIndexFP ); @@ -412,15 +410,13 @@ LLVFS::LLVFS(const std::string& index_filename, const std::string& data_filename else { // this is a null or bad entry, skip it - S32 index_loc = (S32)(tmp_ptr - buffer); - mIndexHoles.push_back(index_loc); + mIndexHoles.push_back(buf_offset); delete block; } - tmp_ptr += LLVFSFileBlock::SERIAL_SIZE; + buf_offset += LLVFSFileBlock::SERIAL_SIZE; } - delete[] buffer; std::sort( files_by_loc.begin(), @@ -861,20 +857,18 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type if (block->mSize > 0) { // move the file into the new block - U8 *buffer = new U8[block->mSize]; + std::vector buffer(block->mSize); fseek(mDataFP, block->mLocation, SEEK_SET); - if (fread(buffer, block->mSize, 1, mDataFP) == 1) + if (fread(&buffer[0], block->mSize, 1, mDataFP) == 1) { fseek(mDataFP, new_data_location, SEEK_SET); - if (fwrite(buffer, block->mSize, 1, mDataFP) != 1) + if (fwrite(&buffer[0], block->mSize, 1, mDataFP) != 1) { llwarns << "Short write" << llendl; } } else { llwarns << "Short read" << llendl; } - - delete[] buffer; } } @@ -1698,32 +1692,32 @@ void LLVFS::audit() fflush(mIndexFP); fseek(mIndexFP, 0, SEEK_END); - long index_size = ftell(mIndexFP); + size_t index_size = ftell(mIndexFP); fseek(mIndexFP, 0, SEEK_SET); BOOL vfs_corrupt = FALSE; - U8 *buffer = new U8[index_size]; + std::vector buffer(index_size); - if (fread(buffer, 1, index_size, mIndexFP) != index_size) + if (fread(&buffer[0], 1, index_size, mIndexFP) != index_size) { llwarns << "Index truncated" << llendl; vfs_corrupt = TRUE; } - U8 *tmp_ptr = buffer; + size_t buf_offset = 0; std::map found_files; U32 cur_time = (U32)time(NULL); std::vector audit_blocks; - while (!vfs_corrupt && tmp_ptr < buffer + index_size) + while (!vfs_corrupt && buf_offset < index_size) { LLVFSFileBlock *block = new LLVFSFileBlock(); audit_blocks.push_back(block); - block->deserialize(tmp_ptr, (S32)(tmp_ptr - buffer)); - tmp_ptr += block->SERIAL_SIZE; + block->deserialize(&buffer[buf_offset], (S32)buf_offset); + buf_offset += block->SERIAL_SIZE; // do sanity check on this block if (block->mLength >= 0 && @@ -1782,8 +1776,6 @@ void LLVFS::audit() } } - delete[] buffer; - if (!vfs_corrupt) { for (fileblock_map::iterator it = mFileBlocks.begin(); it != mFileBlocks.end(); ++it) @@ -2078,21 +2070,21 @@ void LLVFS::dumpFiles() { LLUUID id = file_spec.mFileID; LLAssetType::EType type = file_spec.mFileType; - U8* buffer = new U8[size]; + std::vector buffer(size); unlockData(); - getData(id, type, buffer, 0, size); + getData(id, type, &buffer[0], 0, size); lockData(); std::string extension = get_extension(type); std::string filename = id.asString() + extension; llinfos << " Writing " << filename << llendl; - LLAPRFile outfile ; + LLAPRFile outfile; outfile.open(filename, LL_APR_WB); - outfile.write(buffer, size); + outfile.write(&buffer[0], size); outfile.close(); - delete[] buffer; + files_extracted++; } } diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 95e315f38e..afce0c06c3 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -46,6 +46,7 @@ set(llwindows_HEADER_FILES set(viewer_SOURCE_FILES llwindow.cpp + llmousehandler.cpp ) set(viewer_HEADER_FILES diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp new file mode 100644 index 0000000000..daf39f8d83 --- /dev/null +++ b/indra/llwindow/llmousehandler.cpp @@ -0,0 +1,63 @@ +/** + * @file llmousehandler.cpp + * @brief LLMouseHandler class implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2007, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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 "llmousehandler.h" + +//virtual +BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) +{ + BOOL handled = FALSE; + if (down) + { + switch (clicktype) + { + case CLICK_LEFT: handled = handleMouseDown(x, y, mask); break; + case CLICK_RIGHT: handled = handleRightMouseDown(x, y, mask); break; + case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break; + case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + default: + llwarns << "Unhandled enum." << llendl; + } + } + else + { + switch (clicktype) + { + case CLICK_LEFT: handled = handleMouseUp(x, y, mask); break; + case CLICK_RIGHT: handled = handleRightMouseUp(x, y, mask); break; + case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break; + case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + default: + llwarns << "Unhandled enum." << llendl; + } + } + return handled; +} diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index f3a2edd8a2..7bd0f2eebf 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -33,9 +33,10 @@ #ifndef LL_MOUSEHANDLER_H #define LL_MOUSEHANDLER_H -#include "llstring.h" +#include "linden_common.h" +#include "llrect.h" -// Abstract interface. +// Mostly-abstract interface. // Intended for use via multiple inheritance. // A class may have as many interfaces as it likes, but never needs to inherit one more than once. @@ -49,13 +50,23 @@ public: SHOW_IF_NOT_BLOCKED, SHOW_ALWAYS, } EShowToolTip; + typedef enum { + CLICK_LEFT, + CLICK_MIDDLE, + CLICK_RIGHT, + CLICK_DOUBLELEFT + } EClickType; + virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + + virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; virtual const std::string& getName() const = 0; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index fb4770e847..7e412a14de 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -308,6 +308,28 @@ void *LLWindow::getMediaWindow() return getPlatformWindow(); } +//virtual +void LLWindow::processMiscNativeEvents() +{ + // do nothing unless subclassed +} + +//virtual +BOOL LLWindow::isPrimaryTextAvailable() +{ + return FALSE; // no +} +//virtual +BOOL LLWindow::pasteTextFromPrimary(LLWString &dst) +{ + return FALSE; // fail +} +// virtual +BOOL LLWindow::copyTextToPrimary(const LLWString &src) +{ + return FALSE; // fail +} + // static std::vector LLWindow::getDynamicFallbackFontList() { @@ -322,12 +344,6 @@ std::vector LLWindow::getDynamicFallbackFontList() #endif } -//virtual -void LLWindow::processMiscNativeEvents() -{ - // do nothing unless subclassed -} - #define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400) #define UTF16_IS_LOW_SURROGATE(U) ((U16)((U) - 0xDC00) < 0x0400) #define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000) diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 9e01596b81..8361771b66 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -144,9 +144,15 @@ public: virtual void captureMouse() = 0; virtual void releaseMouse() = 0; virtual void setMouseClipping( BOOL b ) = 0; + virtual BOOL isClipboardTextAvailable() = 0; virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0; virtual BOOL copyTextToClipboard(const LLWString &src) = 0; + + virtual BOOL isPrimaryTextAvailable(); + virtual BOOL pasteTextFromPrimary(LLWString &dst); + virtual BOOL copyTextToPrimary(const LLWString &src); + virtual void flashIcon(F32 seconds) = 0; virtual F32 getGamma() = 0; virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 4f6df0f152..65a40dcef4 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -2527,19 +2527,33 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e } mCallbacks->handleFocusLost(this); break; + case kEventWindowBoundsChanging: { + // This is where we would constrain move/resize to a particular screen + + const S32 MIN_WIDTH = 320; + const S32 MIN_HEIGHT = 240; + Rect currentBounds; Rect previousBounds; GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, ¤tBounds); GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds); - // This is where we would constrain move/resize to a particular screen - if(0) + + if ((currentBounds.right - currentBounds.left) < MIN_WIDTH) { - SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds); + currentBounds.right = currentBounds.left + MIN_WIDTH; } + + if ((currentBounds.bottom - currentBounds.top) < MIN_HEIGHT) + { + currentBounds.bottom = currentBounds.top + MIN_HEIGHT; + } + + SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds); + result = noErr; } break; @@ -2597,7 +2611,6 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e // BringToFront(mWindow); // result = noErr; break; - } break; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index d6ee7acbaa..24bd70d57f 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -222,8 +222,8 @@ LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width, ll_try_gtk_init(); #endif // LL_GTK - // Get the original aspect ratio of the main device. - mOriginalAspectRatio = 1024.0 / 768.0; // !!! *FIX: ? //(double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay); + // Assume 4:3 aspect ratio until we know better + mOriginalAspectRatio = 1024.0 / 768.0; if (title.empty()) mWindowTitle = "SDL Window"; // *FIX: (???) @@ -444,14 +444,20 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B << int(r_sdl_version->minor) << "." << int(r_sdl_version->patch) << llendl; - const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo( ); - if (!videoInfo) + const SDL_VideoInfo *video_info = SDL_GetVideoInfo( ); + if (!video_info) { llinfos << "SDL_GetVideoInfo() failed! " << SDL_GetError() << llendl; setupFailure("SDL_GetVideoInfo() failed, Window creation error", "Error", OSMB_OK); return FALSE; } + if (video_info->current_h > 0) + { + mOriginalAspectRatio = (float)video_info->current_w / (float)video_info->current_h; + llinfos << "Original aspect ratio was " << video_info->current_w << ":" << video_info->current_h << "=" << mOriginalAspectRatio << llendl; + } + SDL_EnableUNICODE(1); SDL_WM_SetCaption(mWindowTitle.c_str(), mWindowTitle.c_str()); @@ -643,7 +649,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // fallback to letting SDL detect VRAM. // note: I've not seen SDL's detection ever actually find // VRAM != 0, but if SDL *does* detect it then that's a bonus. - gGLManager.mVRAM = videoInfo->video_mem / 1024; + gGLManager.mVRAM = video_info->video_mem / 1024; if (gGLManager.mVRAM != 0) { llinfos << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << llendl; @@ -1272,6 +1278,49 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text) return FALSE; // failure } + +BOOL LLWindowSDL::isPrimaryTextAvailable() +{ + if (ll_try_gtk_init()) + { + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + return gtk_clipboard_wait_is_text_available(clipboard) ? + TRUE : FALSE; + } + return FALSE; // failure +} + +BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text) +{ + if (ll_try_gtk_init()) + { + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gchar * const data = gtk_clipboard_wait_for_text(clipboard); + if (data) + { + text = LLWString(utf8str_to_wstring(data)); + g_free(data); + return TRUE; + } + } + return FALSE; // failure +} + +BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text) +{ + if (ll_try_gtk_init()) + { + const std::string utf8 = wstring_to_utf8str(text); + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length()); + return TRUE; + } + return FALSE; // failure +} + #else BOOL LLWindowSDL::isClipboardTextAvailable() @@ -1288,6 +1337,22 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) { return FALSE; // unsupported } + +BOOL LLWindowSDL::isPrimaryTextAvailable() +{ + return FALSE; // unsupported +} + +BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst) +{ + return FALSE; // unsupported +} + +BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s) +{ + return FALSE; // unsupported +} + #endif // LL_GTK LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) @@ -1962,14 +2027,14 @@ void LLWindowSDL::captureMouse() // window, and in a less obnoxious way than SDL_WM_GrabInput // which would confine the cursor to the window too. - //llinfos << "LLWindowSDL::captureMouse" << llendl; + lldebugs << "LLWindowSDL::captureMouse" << llendl; } void LLWindowSDL::releaseMouse() { // see LWindowSDL::captureMouse() - //llinfos << "LLWindowSDL::releaseMouse" << llendl; + lldebugs << "LLWindowSDL::releaseMouse" << llendl; } void LLWindowSDL::hideCursor() diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index cebb151764..632d8fc1fa 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -80,9 +80,15 @@ public: /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); /*virtual*/ void setMouseClipping( BOOL b ); + /*virtual*/ BOOL isClipboardTextAvailable(); /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); /*virtual*/ BOOL copyTextToClipboard(const LLWString & src); + + /*virtual*/ BOOL isPrimaryTextAvailable(); + /*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst); + /*virtual*/ BOOL copyTextToPrimary(const LLWString & src); + /*virtual*/ void flashIcon(F32 seconds); /*virtual*/ F32 getGamma(); /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index 9cd7d48319..0e46064829 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -312,7 +312,7 @@ void LLScriptScriptCodeChunk::build(LLFILE *efp, LLFILE *bcfp) set_register(mCompleteCode, LREG_TM, mTotalSize); - if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != mTotalSize) + if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != (size_t)mTotalSize) { llwarns << "Short write" << llendl; } diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index b2b54cdd7a..05fee9a419 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -77,7 +77,7 @@ const U64 LSL_HTTP_REQUEST_TIMEOUT = 25 * USEC_PER_SEC; LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) { U8 sizearray[4]; - S32 filesize; + size_t filesize; S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp index 3b10cc67c1..faf4fba0e0 100644 --- a/indra/lscript/lscript_execute/lscript_readlso.cpp +++ b/indra/lscript/lscript_execute/lscript_readlso.cpp @@ -39,7 +39,7 @@ LLScriptLSOParse::LLScriptLSOParse(LLFILE *fp) { U8 sizearray[4]; - S32 filesize; + size_t filesize; S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index 3a130db2af..d2a46d4338 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -68,8 +68,8 @@ EventHandlerRef gEventHandler = NULL; OSStatus gFailure = noErr; Boolean gCancelled = false; -char *gUpdateURL; -char *gProductName; +const char *gUpdateURL; +const char *gProductName; void *updatethreadproc(void*); @@ -1032,7 +1032,7 @@ void *updatethreadproc(void*) if(!mountOutput.empty()) { const char *s = mountOutput.c_str(); - char *prefix = "/dev/"; + const char *prefix = "/dev/"; char *sub = strstr(s, prefix); if(sub != NULL) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c3d92953ce..fa7d226f16 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -279,7 +279,6 @@ set(viewer_SOURCE_FILES llpanelgrouplandmoney.cpp llpanelgroupnotices.cpp llpanelgrouproles.cpp - llpanelgroupvoting.cpp llpanelinput.cpp llpanelinventory.cpp llpanelland.cpp @@ -683,7 +682,6 @@ set(viewer_HEADER_FILES llpanelgrouplandmoney.h llpanelgroupnotices.h llpanelgrouproles.h - llpanelgroupvoting.h llpanelinput.h llpanelinventory.h llpanelland.h diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 90c7b11637..dab88a5ec3 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -11,6 +11,17 @@ Value The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing. + BusyModeResponse2 + + Comment + Auto response to instant messages while in busy mode, clean (unencoded) version of BusyModeResponse + Persist + 1 + Type + String + Value + |TOKEN COPY BusyModeResponse| + IMLogTimestamp Comment diff --git a/indra/newview/linux_tools/client-readme-joystick.txt b/indra/newview/linux_tools/client-readme-joystick.txt index 997a8b08eb..4f89a73ccb 100644 --- a/indra/newview/linux_tools/client-readme-joystick.txt +++ b/indra/newview/linux_tools/client-readme-joystick.txt @@ -41,7 +41,7 @@ applications such as the Second Life Viewer, as follows: * Ubuntu or Gentoo Linux Configuration: For a quick start, you can simply paste the following line into a terminal before plugging in your SpaceNavigator - this only needs to be done once: - sudo bash -c 'echo KERNEL==\"event[0-9]*\", SYSFS{idVendor}==\"046d\", SYSFS{idProduct}==\"c626\", SYMLINK+=\"input/spacenavigator\", GROUP=\"plugdev\", MODE=\"664\" >> /etc/udev/rules.d/91-spacenavigator.rules' + sudo bash -c 'echo KERNEL==\"event[0-9]*\", SYSFS{idVendor}==\"046d\", SYSFS{idProduct}==\"c626\", SYMLINK+=\"input/spacenavigator\", GROUP=\"plugdev\", MODE=\"664\" > /etc/udev/rules.d/91-spacenavigator-LL.rules ; echo "" > /etc/hal/fdi/policy/3Dconnexion_SpaceNavigator_LL.fdi' For more comprehensive Linux SpaceNavigator configuration information please see the section 'Installing SpaceNavigator without the official driver' here: diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index a894bca619..3b534ce5a7 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -76,6 +76,7 @@ #include "llfloaterdirectory.h" #include "llfloatergroupinfo.h" #include "llfloatergroups.h" +#include "llfloaterland.h" #include "llfloatermap.h" #include "llfloatermute.h" #include "llfloatersnapshot.h" @@ -3835,7 +3836,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) if(constrain) { F32 max_dist = ( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) ? - APPEARANCE_MAX_ZOOM : MAX_CAMERA_DISTANCE_FROM_AGENT; + APPEARANCE_MAX_ZOOM : mDrawDistance; LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal(); @@ -5950,6 +5951,9 @@ bool LLAgent::teleportCore(bool is_local) LLFloaterWorldMap::hide(NULL); LLFloaterDirectory::hide(NULL); + // hide land floater too - it'll be out of date + LLFloaterLand::hideInstance(); + LLViewerParcelMgr::getInstance()->deselectLand(); // Close all pie menus, deselect land, etc. diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1e6d8fdf25..43800c67fa 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -202,7 +202,6 @@ const F32 DEFAULT_AFK_TIMEOUT = 5.f * 60.f; // time with no input before user fl F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() F32 gSimFrames; -BOOL gAllowIdleAFK = TRUE; BOOL gAllowTapTapHoldRun = TRUE; BOOL gShowObjectUpdates = FALSE; BOOL gUseQuickTime = TRUE; @@ -301,7 +300,7 @@ LLAppViewer::LLUpdaterInfo *LLAppViewer::sUpdaterInfo = NULL ; void idle_afk_check() { // check idle timers - if (gAllowIdleAFK && (gAwayTriggerTimer.getElapsedTimeF32() > gSavedSettings.getF32("AFKTimeout"))) + if (gSavedSettings.getBOOL("AllowIdleAFK") && (gAwayTriggerTimer.getElapsedTimeF32() > gSavedSettings.getF32("AFKTimeout"))) { gAgent.setAFK(); } @@ -394,7 +393,6 @@ static void settings_to_globals() gAgent.mHideGroupTitle = gSavedSettings.getBOOL("RenderHideGroupTitle"); gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); - gAllowIdleAFK = gSavedSettings.getBOOL("AllowIdleAFK"); gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun"); gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); gMapScale = gSavedSettings.getF32("MapScale"); @@ -507,6 +505,7 @@ LLTextureFetch* LLAppViewer::sTextureFetch = NULL; LLAppViewer::LLAppViewer() : mMarkerFile(), + mLogoutMarkerFile(NULL), mReportedCrash(false), mNumSessions(0), mPurgeCache(false), @@ -2158,7 +2157,6 @@ void LLAppViewer::cleanupSavedSettings() gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc); - gSavedSettings.setBOOL("AllowIdleAFK", gAllowIdleAFK); gSavedSettings.setBOOL("AllowTapTapHoldRun", gAllowTapTapHoldRun); gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates); @@ -3497,7 +3495,7 @@ void LLAppViewer::idleShutdown() S32 finished_uploads = total_uploads - pending_uploads; F32 percent = 100.f * finished_uploads / total_uploads; gViewerWindow->setProgressPercent(percent); - gViewerWindow->setProgressString("Saving final data..."); + gViewerWindow->setProgressString("Saving your settings..."); return; } @@ -3669,7 +3667,7 @@ void LLAppViewer::idleNetwork() // Check that the circuit between the viewer and the agent's current // region is still alive LLViewerRegion *agent_region = gAgent.getRegion(); - if (agent_region) + if (agent_region && (LLStartUp::getStartupState()==STATE_STARTED)) { LLUUID this_region_id = agent_region->getRegionID(); bool this_region_alive = agent_region->isAlive(); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6d7c3c8577..fc88c76aaf 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -251,7 +251,6 @@ const S32 AGENT_UPDATES_PER_SECOND = 10; extern LLSD gDebugInfo; -extern BOOL gAllowIdleAFK; extern BOOL gAllowTapTapHoldRun; extern BOOL gShowObjectUpdates; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 8b81478eaf..d02e86a557 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -165,14 +165,14 @@ static inline BOOL do_basic_glibc_backtrace() // amazing backtrace. static inline BOOL do_basic_glibc_backtrace() { - void *array[MAX_STACK_TRACE_DEPTH]; + void *stackarray[MAX_STACK_TRACE_DEPTH]; size_t size; char **strings; size_t i; BOOL success = FALSE; - size = backtrace(array, MAX_STACK_TRACE_DEPTH); - strings = backtrace_symbols(array, size); + size = backtrace(stackarray, MAX_STACK_TRACE_DEPTH); + strings = backtrace_symbols(stackarray, size); std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; @@ -186,8 +186,13 @@ static inline BOOL do_basic_glibc_backtrace() if (size) { for (i = 0; i < size; i++) - fputs((std::string(strings[i])+"\n").c_str(), - StraceFile); + { + // the format of the StraceFile is very specific, to allow (kludgy) machine-parsing + fprintf(StraceFile, "%-3d ", i); + fprintf(StraceFile, "%-32s\t", "unknown"); + fprintf(StraceFile, "%p ", stackarray[i]); + fprintf(StraceFile, "%s\n", strings[i]); + } success = TRUE; } @@ -205,7 +210,7 @@ static inline BOOL do_basic_glibc_backtrace() // extraction without exporting symbols (which'd cause subtle, fatal bugs). static inline BOOL do_elfio_glibc_backtrace() { - void *array[MAX_STACK_TRACE_DEPTH]; + void *stackarray[MAX_STACK_TRACE_DEPTH]; size_t btsize; char **strings; BOOL success = FALSE; @@ -222,8 +227,8 @@ static inline BOOL do_elfio_glibc_backtrace() } // get backtrace address list and basic symbol info - btsize = backtrace(array, MAX_STACK_TRACE_DEPTH); - strings = backtrace_symbols(array, btsize); + btsize = backtrace(stackarray, MAX_STACK_TRACE_DEPTH); + strings = backtrace_symbols(stackarray, btsize); // create ELF reader for our app binary IELFI* pReader; @@ -257,7 +262,8 @@ static inline BOOL do_elfio_glibc_backtrace() size_t btpos; for (btpos = 0; btpos < btsize; ++btpos) { - fprintf(StraceFile, "%d:\t", btpos); + // the format of the StraceFile is very specific, to allow (kludgy) machine-parsing + fprintf(StraceFile, "%-3d ", btpos); int symidx; for (symidx = 0; symidx < nSymNo; ++symidx) { @@ -266,9 +272,13 @@ static inline BOOL do_elfio_glibc_backtrace() bind, type, section)) { // check if trace address within symbol range - if (uintptr_t(array[btpos]) >= value && - uintptr_t(array[btpos]) < value+ssize) + if (uintptr_t(stackarray[btpos]) >= value && + uintptr_t(stackarray[btpos]) < value+ssize) { + // symbol is inside viewer + fprintf(StraceFile, "%-32s\t", "com.secondlife.indra.viewer"); + fprintf(StraceFile, "%p ", stackarray[btpos]); + char *demangled_str = NULL; int demangle_result = 1; demangled_str = @@ -278,20 +288,19 @@ static inline BOOL do_elfio_glibc_backtrace() if (0 == demangle_result && NULL != demangled_str) { fprintf(StraceFile, - "ELF(%s", demangled_str); + "%s", demangled_str); free(demangled_str); } else // failed demangle; print it raw { fprintf(StraceFile, - "ELF(%s", name.c_str()); + "%s", name.c_str()); } // print offset from symbol start fprintf(StraceFile, - "+0x%lx) [%p]\n", - uintptr_t(array[btpos]) - - value, - array[btpos]); + " + %lu\n", + uintptr_t(stackarray[btpos]) - + value); goto got_sym; // early escape } } @@ -299,6 +308,8 @@ static inline BOOL do_elfio_glibc_backtrace() // Fallback: // Didn't find a suitable symbol in the binary - it's probably // a symbol in a DSO; use glibc's idea of what it should be. + fprintf(StraceFile, "%-32s\t", "unknown"); + fprintf(StraceFile, "%p ", stackarray[btpos]); fprintf(StraceFile, "%s\n", strings[btpos]); got_sym:; } diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 3cdcb35197..1c32f0c564 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -1,6 +1,6 @@ /** * @file llappviewermacosx.cpp - * @brief The LLAppViewerWin32 class definitions + * @brief The LLAppViewerMacOSX class definitions * * $LicenseInfo:firstyear=2007&license=viewergpl$ * diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 47e4a2278f..9f4afc9f17 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1015,6 +1015,10 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, U32 data_mask) mPartitionType = LLViewerRegion::PARTITION_VOLUME; mOctree->balance(); + + llassert(mDrawable); + llassert(mDrawable->getRegion()); + llassert(mDrawable->getRegion()->getSpatialPartition(mPartitionType)); mDrawable->getRegion()->getSpatialPartition(mPartitionType)->put(this); } @@ -1315,6 +1319,10 @@ void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL imm BOOL LLSpatialBridge::updateMove() { + llassert(mDrawable); + llassert(mDrawable->getRegion()); + llassert(mDrawable->getRegion()->getSpatialPartition(mPartitionType)); + mOctree->balance(); mDrawable->getRegion()->getSpatialPartition(mPartitionType)->move(this, getSpatialGroup(), TRUE); return TRUE; diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index 104e0df293..ab2455620f 100644 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -59,6 +59,7 @@ #include #endif +extern "C" { // mostly for Linux, possible on others #if LL_GTK # include "gtk/gtk.h" @@ -68,6 +69,7 @@ #if LL_X11 #include "SDL/SDL_syswm.h" #endif +} class LLFilePicker { diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h index 33aac8257e..3adbd14370 100644 --- a/indra/newview/llfloaterchatterbox.h +++ b/indra/newview/llfloaterchatterbox.h @@ -148,7 +148,14 @@ public: { if (visible(instance, key)) { - LLFloaterChatterBox::hideInstance(); + if(instance->getHost()) + { + LLFloaterChatterBox::hideInstance(); + } + else + { + VisibilityPolicy::hide(instance, key); + } } } diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 658aa16429..6d39d75663 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -200,12 +200,7 @@ void LLFloaterGesture::refreshAll() } else { - if (list->setCurrentByID(sInstance->mSelectedID)) - { - LLCtrlScrollInterface *scroll = sInstance->childGetScrollInterface("gesture_list"); - if (scroll) scroll->scrollToShowSelected(); - } - else + if (! list->setCurrentByID(sInstance->mSelectedID)) { list->selectFirstItem(); } @@ -219,8 +214,14 @@ void LLFloaterGesture::refreshAll() void LLFloaterGesture::buildGestureList() { LLCtrlListInterface *list = childGetListInterface("gesture_list"); - if (!list) return; + LLCtrlScrollInterface *scroll = childGetScrollInterface("gesture_list"); + if (! (list && scroll)) return; + + // attempt to preserve scroll position through re-builds + // since we do re-build any time anything dirties + S32 current_scroll_pos = scroll->getScrollPos(); + list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLGestureManager::item_map_t::iterator it; @@ -319,6 +320,8 @@ void LLFloaterGesture::buildGestureList() } list->addElement(element, ADD_BOTTOM); } + + scroll->setScrollPos(current_scroll_pos); } // static diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 689f9f48d0..3606f7ccbe 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -72,11 +72,14 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300; // LLFloaterImagePreview() //----------------------------------------------------------------------------- LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : - LLFloaterNameDesc(filename) + LLFloaterNameDesc(filename), + + mAvatarPreview(NULL), + mSculptedPreview(NULL), + mLastMouseX(0), + mLastMouseY(0), + mImagep(NULL) { - mLastMouseX = 0; - mLastMouseY = 0; - mImagep = NULL ; loadImage(mFilenameAndPath); } @@ -815,7 +818,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) mVertexBuffer->getIndexStrider(index_strider); // build vertices and normals - for (U32 i = 0; (S32)i < num_vertices; i++) + for (U32 i = 0; i < num_vertices; i++) { *(vertex_strider++) = vf.mVertices[i].mPosition; LLVector3 normal = vf.mVertices[i].mNormal; diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index fc483dd307..f4984df6d9 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -80,12 +80,26 @@ void LLFloaterOpenObject::refresh() { mPanelInventory->refresh(); + std::string name; + BOOL enabled; + LLSelectNode* node = mObjectSelection->getFirstRootNode(); if (node) { - std::string name = node->mName; - childSetTextArg("object_name", "[DESC]", name); + name = node->mName; + enabled = TRUE; + } + else + { + name = ""; + enabled = FALSE; } + + childSetTextArg("object_name", "[DESC]", name); + + childSetEnabled("copy_to_inventory_button", enabled); + childSetEnabled("copy_and_wear_button", enabled); + } void LLFloaterOpenObject::draw() diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 588df7b43b..2b418b4caa 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2862,20 +2862,14 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, S32 file_length = file.getSize(); - char* buffer = new char[file_length+1]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - file.read((U8*)buffer, file_length); /* Flawfinder: ignore */ + std::vector buffer(file_length+1); + file.read((U8*)&buffer[0], file_length); // put a EOS at the end buffer[file_length] = 0; - if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) + if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { - if( !panelp->mEditor->importBuffer( buffer, file_length+1 ) ) + if( !panelp->mEditor->importBuffer( &buffer[0], file_length+1 ) ) { llwarns << "Problem importing estate covenant." << llendl; LLNotifications::instance().add("ProblemImportingEstateCovenant"); @@ -2890,7 +2884,6 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, // Version 0 (just text, doesn't include version number) panelp->sendChangeCovenantID(asset_uuid); } - delete[] buffer; } else { diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e3b95e4058..d45d9c052f 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1275,7 +1275,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) LLSnapshotLivePreview* previewp = getPreviewView(floater); BOOL got_bytes = previewp && previewp->getDataSize() > 0; - BOOL got_snap = previewp->getSnapshotUpToDate(); + BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); floater->childSetEnabled("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE); floater->childSetEnabled("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_snap); @@ -1283,7 +1283,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) LLLocale locale(LLLocale::USER_LOCALE); std::string bytes_string; - LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + if (got_snap) + { + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + } S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index e2e71f51fa..8326557cf8 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1610,7 +1610,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) childSetFocus("search_results"); onCommitSearchResult(NULL, this); } - else + else if (num_results == 0) { list->addCommentText(std::string("None found.")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 1402d241c7..97a3bd7c50 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -146,9 +146,9 @@ void LLFolderViewItem::cleanupClass() // Default constructor // NOTE: Optimize this, we call it a *lot* when opening a large inventory LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, - S32 creation_date, - LLFolderView* root, - LLFolderViewEventListener* listener ) : + time_t creation_date, + LLFolderView* root, + LLFolderViewEventListener* listener ) : LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT), mLabel( name ), mLabelWidth(0), @@ -4684,7 +4684,7 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) BOOL LLInventoryFilter::isSinceLogoff() { - return (mFilterOps.mMinDate == mLastLogoff) && + return (mFilterOps.mMinDate == (time_t)mLastLogoff) && (mFilterOps.mMaxDate == time_max()); } diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 44b076e397..3fe3095c58 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -335,7 +335,7 @@ protected: std::string mSearchableLabel; std::string mType; S32 mLabelWidth; - U32 mCreationDate; + time_t mCreationDate; LLFolderViewFolder* mParentFolder; LLFolderViewEventListener* mListener; BOOL mIsSelected; @@ -386,7 +386,7 @@ public: void filterFromRoot( void ); // creation_date is in UTC seconds - LLFolderViewItem( const std::string& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); + LLFolderViewItem( const std::string& name, LLUIImagePtr icon, time_t creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); virtual ~LLFolderViewItem( void ); // addToFolder() returns TRUE if it succeeds. FALSE otherwise diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 2135ea5315..2dbff92ba0 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -926,20 +926,15 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, LLVFile file(vfs, asset_uuid, type, LLVFile::READ); S32 size = file.getSize(); - char* buffer = new char[size+1]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } + std::vector buffer(size+1); - file.read((U8*)buffer, size); /* Flawfinder: ignore */ + file.read((U8*)&buffer[0], size); // ensure there's a trailing NULL so strlen will work. buffer[size] = '\0'; LLMultiGesture* gesture = new LLMultiGesture(); - LLDataPackerAsciiBuffer dp(buffer, size+1); + LLDataPackerAsciiBuffer dp(&buffer[0], size+1); BOOL ok = gesture->deserialize(dp); if (ok) @@ -991,9 +986,6 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, delete gesture; gesture = NULL; } - - delete [] buffer; - buffer = NULL; } else { diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 77ee29a449..003a02c3cd 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -803,7 +803,12 @@ static void formatDateString(std::string &date_string) const regex expression("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})"); if (regex_match(date_string.c_str(), result, expression)) { - date_string = result[3]+"/"+result[1]+"/"+result[2]; + std::string year = result[3]; + std::string month = result[1]; + std::string day = result[2]; + + // ISO 8601 date format + date_string = llformat("%04s-%02s-%02s", year.c_str(), month.c_str(), day.c_str()); } } diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 88521df29c..a13ee8572f 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -160,6 +160,7 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) LLHUDEffect::unpackData(mesgsys, blocknum); LLUUID source_id; LLUUID target_id; + U8 pointAtTypeUnpacked = 0; S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != PKT_SIZE) { @@ -169,6 +170,9 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum); htonmemcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16); + htonmemcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16); + htonmemcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24); + htonmemcpy(&pointAtTypeUnpacked, &(packed_data[POINTAT_TYPE]), MVT_U8, 1); LLViewerObject *objp = gObjectList.findObject(source_id); if (objp && objp->isAvatar()) @@ -181,12 +185,8 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) return; } - htonmemcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16); - objp = gObjectList.findObject(target_id); - htonmemcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24); - if (objp) { setTargetObjectAndOffset(objp, new_target); @@ -196,8 +196,6 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) setTargetPosGlobal(new_target); } - U8 pointAtTypeUnpacked = 0; - htonmemcpy(&pointAtTypeUnpacked, &(packed_data[POINTAT_TYPE]), MVT_U8, 1); mTargetType = (EPointAtType)pointAtTypeUnpacked; // mKillTime = mTimer.getElapsedTimeF32() + mDuration; diff --git a/indra/newview/llhudeffecttrail.cpp b/indra/newview/llhudeffecttrail.cpp index 32b52f8628..0ade6810ba 100644 --- a/indra/newview/llhudeffecttrail.cpp +++ b/indra/newview/llhudeffecttrail.cpp @@ -121,7 +121,7 @@ void LLHUDEffectSpiral::unpackData(LLMessageSystem *mesgsys, S32 blocknum) LLHUDEffect::unpackData(mesgsys, blocknum); LLUUID object_id, target_object_id; - S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); + size_t size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != EFFECT_SIZE) { llwarns << "Spiral effect with bad size " << size << llendl; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index fcebfa7053..66c2e4fe21 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -2030,8 +2030,8 @@ void LLFloaterIMPanel::sendMsg() LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); + mInputEditor->setText(LLStringUtil::null); } - mInputEditor->setText(LLStringUtil::null); // Don't need to actually send the typing stop message, the other // client will infer it from receiving the message. diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 69a403e388..2697ef25f9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1012,6 +1012,19 @@ BOOL LLItemBridge::isItemCopyable() const LLViewerInventoryItem* item = getItem(); if (item) { + // can't copy worn objects. DEV-15183 + LLVOAvatar *avatarp = gAgent.getAvatarObject(); + if( !avatarp ) + { + return FALSE; + } + + if( avatarp->isWearingAttachment( mUUID ) ) + { + return FALSE; + } + + return (item->getPermissions().allowCopyBy(gAgent.getID())); } return FALSE; @@ -4624,7 +4637,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, { EWearableType type = wearable->getType(); - if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR ) ) //&& + if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) { gAgent.removeWearable( type ); diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index e8cdcdfdd6..2f43b41042 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -89,11 +89,11 @@ void LLLandmarkList::processGetAssetReply( LLVFile file(vfs, uuid, type); S32 file_length = file.getSize(); - char* buffer = new char[ file_length + 1 ]; - file.read( (U8*)buffer, file_length); /*Flawfinder: ignore*/ + std::vector buffer(file_length + 1); + file.read( (U8*)&buffer[0], file_length); buffer[ file_length ] = 0; - LLLandmark* landmark = LLLandmark::constructFromString(buffer); + LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0]); if (landmark) { LLVector3d pos; @@ -111,8 +111,6 @@ void LLLandmarkList::processGetAssetReply( } gLandmarkList.mList[ uuid ] = landmark; } - - delete[] buffer; } else { diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index a9b0610ed5..1709d6465d 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -50,7 +50,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { std::string invalidChars = "\"\'\\/?*:<>|"; - S32 position = filename.find_first_of(invalidChars); + std::string::size_type position = filename.find_first_of(invalidChars); while (position != filename.npos) { filename[position] = '_'; diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index bfcba59975..841330483c 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -788,8 +788,9 @@ void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) llwarns << "Got an mute list update for the wrong agent." << llendl; return; } - std::string filename; - msg->getStringFast(_PREHASH_MuteData, _PREHASH_Filename, filename); + std::string unclean_filename; + msg->getStringFast(_PREHASH_MuteData, _PREHASH_Filename, unclean_filename); + std::string filename = LLDir::getScrubbedFileName(unclean_filename); std::string *local_filename_and_path = new std::string(gDirUtilp->getExpandedFilename( LL_PATH_CACHE, filename )); gXferManager->requestFile(*local_filename_and_path, diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 7253d758ea..9d5a4ad01c 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -483,11 +483,20 @@ LLPanelAvatarWeb::~LLPanelAvatarWeb() }; } +void LLPanelAvatarWeb::refresh() +{ + if (mNavigateTo != "") + { + llinfos << "Loading " << mNavigateTo << llendl; + mWebBrowser->navigateTo( mNavigateTo ); + mNavigateTo = ""; + } +} + + void LLPanelAvatarWeb::enableControls(BOOL self) { childSetEnabled("url_edit",self); - childSetVisible("status_text",!self && !mHome.empty()); - childSetText("status_text", LLStringUtil::null); } void LLPanelAvatarWeb::setWebURL(std::string url) @@ -511,11 +520,8 @@ void LLPanelAvatarWeb::setWebURL(std::string url) else { childSetVisible("profile_html",false); + childSetVisible("status_text", false); } - - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - childSetVisible("status_text",!own_avatar && !mHome.empty()); - } // static @@ -538,13 +544,15 @@ void LLPanelAvatarWeb::load(std::string url) { bool have_url = (!url.empty()); + + childSetVisible("profile_html", have_url); + childSetVisible("status_text", have_url); + childSetText("status_text", LLStringUtil::null); + if (have_url) { - llinfos << "Loading " << url << llendl; - mWebBrowser->navigateTo( url ); + mNavigateTo = url; } - - childSetVisible("profile_html", have_url); } //static diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 041d50331c..12e1b99360 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -144,6 +144,8 @@ public: /*virtual*/ ~LLPanelAvatarWeb(); /*virtual*/ BOOL postBuild(void); + /*virtual*/ void refresh(); + void enableControls(BOOL own_avatar); void setWebURL(std::string url); @@ -160,6 +162,7 @@ public: private: std::string mHome; + std::string mNavigateTo; LLWebBrowserCtrl* mWebBrowser; }; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b1a38e07a7..e93a5be8ed 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -73,7 +73,6 @@ BOOL LLPanelFace::postBuild() LLTextureCtrl* mTextureCtrl; LLColorSwatchCtrl* mColorSwatch; - LLTextBox* mLabelTexGen; LLComboBox* mComboTexGen; LLCheckBoxCtrl *mCheckFullbright; @@ -81,7 +80,6 @@ BOOL LLPanelFace::postBuild() LLTextBox* mLabelColorTransp; LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha - LLTextBox* mLabelGlow; LLSpinCtrl* mCtrlGlow; setMouseOpaque(FALSE); @@ -152,7 +150,7 @@ BOOL LLPanelFace::postBuild() mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright); mCheckFullbright->setCallbackUserData( this ); } - mLabelTexGen = getChild("tex gen"); + mComboTexGen = getChild("combobox texgen"); if(mComboTexGen) { @@ -161,7 +159,6 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setCallbackUserData( this ); } - mLabelGlow = getChild("glow label"); mCtrlGlow = getChild("glow"); if(mCtrlGlow) { diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index add1f3caa5..d9d796fd9e 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -37,7 +37,6 @@ #include "llbutton.h" #include "llpanelgroupgeneral.h" #include "llpanelgrouproles.h" -#include "llpanelgroupvoting.h" #include "llpanelgrouplandmoney.h" #include "llpanelgroupnotices.h" #include "lltabcontainer.h" @@ -148,8 +147,6 @@ LLPanelGroup::LLPanelGroup(const std::string& filename, &mID); mFactoryMap["notices_tab"] = LLCallbackMap(LLPanelGroupNotices::createTab, &mID); - mFactoryMap["voting_tab"] = LLCallbackMap(LLPanelGroupVoting::createTab, - &mID); mFactoryMap["land_money_tab"]= LLCallbackMap(LLPanelGroupLandMoney::createTab, &mID); // Roles sub tabs diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index cbf4a8740c..3dc5e032c5 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -901,7 +901,7 @@ void LLPanelGroupGeneral::updateChanged() mChanged = FALSE; - for( int i= 0; i< LL_ARRAY_SIZE(check_list); i++ ) + for( size_t i=0; iisDirty() ) { diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 7c2e8981f9..6ff09e56f8 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -974,7 +974,7 @@ void LLGroupMoneyTabEventHandler::clickLaterCallback(void* data) void LLGroupMoneyTabEventHandler::clickTabCallback(void* data, bool from_click) { LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data; - if ( selfp ) selfp->onClickTab(); + if ( selfp && from_click ) selfp->onClickTab(); } //************************************************** diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index e07259f7a1..5824df46e2 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -56,8 +56,6 @@ #include "llviewermessage.h" #include "llnotifications.h" -const S32 NOTICE_DATE_STRING_SIZE = 30; - ///////////////////////// // LLPanelGroupNotices // ///////////////////////// @@ -170,14 +168,23 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, //----------------------------------------------------------------------------- // LLPanelGroupNotices //----------------------------------------------------------------------------- -std::string build_notice_date(const time_t& the_time) +std::string build_notice_date(const U32& the_time) { - time_t t = the_time; - if (!t) time(&t); + // ISO 8601 date format + + time_t t = (time_t)the_time; + + if (!t) + { + time(&t); + } + tm* lt = localtime(&t); + //for some reason, the month is off by 1. See other uses of //"local" time in the code... - std::string buffer = llformat("%i/%i/%i", lt->tm_mon + 1, lt->tm_mday, lt->tm_year + 1900); + std::string buffer = llformat("%04i-%02i-%02i", lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday); + return buffer; } @@ -469,7 +476,6 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) msg->getBOOL("Data","HasAttachment",has_attachment,i); msg->getU8("Data","AssetType",asset_type,i); msg->getU32("Data","Timestamp",timestamp,i); - time_t t = timestamp; LLSD row; row["id"] = id; @@ -490,13 +496,11 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) row["columns"][2]["column"] = "from"; row["columns"][2]["value"] = name; - std::string buffer = build_notice_date(t); row["columns"][3]["column"] = "date"; - row["columns"][3]["value"] = buffer; + row["columns"][3]["value"] = build_notice_date(timestamp); - buffer = llformat( "%u", timestamp); row["columns"][4]["column"] = "sort"; - row["columns"][4]["value"] = buffer; + row["columns"][4]["value"] = llformat( "%u", timestamp); mNoticesList->addElement(row, ADD_BOTTOM); } diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index da8c9a9ac7..389f06f355 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -1034,7 +1034,7 @@ void LLPanelPermissions::setAllSaleInfo() { // Don't extract the price if it's labeled as MIXED or is empty. const std::string& editPriceString = editPrice->getText(); - if (editPriceString != getString("Cost Mixed") && + if (editPriceString != getString("Cost Mixed") && editPriceString != getString("Sale Mixed") && !editPriceString.empty()) { price = atoi(editPriceString.c_str()); @@ -1048,12 +1048,6 @@ void LLPanelPermissions::setAllSaleInfo() if (price < 0) sale_type = LLSaleInfo::FS_NOT; - // Force the sale price of not-for-sale items to DEFAULT_PRICE. - if (sale_type == LLSaleInfo::FS_NOT) - { - price = DEFAULT_PRICE; - } - // Pack up the sale info and send the update. LLSaleInfo sale_info(sale_type, price); LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(sale_info); diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index ff3b9433f4..76a9b80645 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -920,13 +920,13 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, LLVFile file(vfs, asset_uuid, type, LLVFile::READ); S32 size = file.getSize(); - char* buffer = new char[size+1]; - file.read((U8*)buffer, size); /*Flawfinder: ignore*/ + std::vector buffer(size+1); + file.read((U8*)&buffer[0], size); buffer[size] = '\0'; LLMultiGesture* gesture = new LLMultiGesture(); - LLDataPackerAsciiBuffer dp(buffer, size+1); + LLDataPackerAsciiBuffer dp(&buffer[0], size+1); BOOL ok = gesture->deserialize(dp); if (ok) @@ -947,9 +947,6 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, delete gesture; gesture = NULL; - delete [] buffer; - buffer = NULL; - self->mAssetStatus = PREVIEW_ASSET_LOADED; } else diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 897fd6a2ee..4abe390bc5 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -364,8 +364,8 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, S32 file_length = file.getSize(); - char* buffer = new char[file_length+1]; - file.read((U8*)buffer, file_length); /*Flawfinder: ignore*/ + std::vector buffer(file_length+1); + file.read((U8*)&buffer[0], file_length); // put a EOS at the end buffer[file_length] = 0; @@ -373,9 +373,9 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, LLViewerTextEditor* previewEditor = preview->getChild("Notecard Editor"); - if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) + if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { - if( !previewEditor->importBuffer( buffer, file_length+1 ) ) + if( !previewEditor->importBuffer( &buffer[0], file_length+1 ) ) { llwarns << "Problem importing notecard" << llendl; } @@ -383,7 +383,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, else { // Version 0 (just text, doesn't include version number) - previewEditor->setText(LLStringExplicit(buffer)); + previewEditor->setText(LLStringExplicit(&buffer[0])); } previewEditor->makePristine(); @@ -392,7 +392,6 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, BOOL modifiable = item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); preview->setEnabled(modifiable); - delete[] buffer; preview->mAssetStatus = PREVIEW_ASSET_LOADED; } else diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 931d30c9fa..0bacb95d2d 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -314,7 +314,8 @@ LLScriptEdCore::LLScriptEdCore( mForceClose( FALSE ), mLastHelpToken(NULL), mLiveHelpHistorySize(0), - mEnableSave(FALSE) + mEnableSave(FALSE), + mHasScriptData(FALSE) { setFollowsAll(); setBorderVisible(FALSE); @@ -442,12 +443,21 @@ void LLScriptEdCore::initMenu() menuItem->setEnabledCallback(NULL); } +void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid) +{ + if (mEditor) + { + mEditor->setText(text); + mHasScriptData = is_valid; + } +} + BOOL LLScriptEdCore::hasChanged(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; if (!self || !self->mEditor) return FALSE; - return !self->mEditor->isPristine() || self->mEnableSave; + return ((!self->mEditor->isPristine() || self->mEnableSave) && self->mHasScriptData); } void LLScriptEdCore::draw() @@ -975,8 +985,8 @@ bool LLScriptEdCore::handleReloadFromServerDialog(const LLSD& notification, cons case 0: // "Yes" if( mLoadCallback ) { - mEditor->setText( getString("loading") ); - mLoadCallback( mUserdata ); + setScriptText(getString("loading"), FALSE); + mLoadCallback(mUserdata); } break; @@ -1189,7 +1199,7 @@ void LLPreviewLSL::loadAsset() } else { - mScriptEd->mEditor->setText(mScriptEd->getString("can_not_view")); + mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); mScriptEd->mFunctions->setEnabled(FALSE); @@ -1200,7 +1210,7 @@ void LLPreviewLSL::loadAsset() } else { - mScriptEd->mEditor->setText(std::string(HELLO_LSL)); + mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE); mAssetStatus = PREVIEW_ASSET_LOADED; } } @@ -1506,14 +1516,13 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset LLVFile file(vfs, asset_uuid, type); S32 file_length = file.getSize(); - char* buffer = new char[file_length+1]; - file.read((U8*)buffer, file_length); /*Flawfinder: ignore*/ + std::vector buffer(file_length+1); + file.read((U8*)&buffer[0], file_length); // put a EOS at the end buffer[file_length] = 0; - preview->mScriptEd->mEditor->setText(LLStringExplicit(buffer)); + preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); preview->mScriptEd->mEditor->makePristine(); - delete [] buffer; LLInventoryItem* item = gInventory.getItem(*item_uuid); BOOL is_modifiable = FALSE; if(item @@ -1726,7 +1735,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) || !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)))) { mItem = new LLViewerInventoryItem(item); - mScriptEd->mEditor->setText(getString("not_allowed")); + mScriptEd->setScriptText(getString("not_allowed"), FALSE); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); mScriptEd->enableSave(FALSE); @@ -1758,7 +1767,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) } else { - mScriptEd->mEditor->setText(LLStringUtil::null); + mScriptEd->setScriptText(LLStringUtil::null, FALSE); mScriptEd->mEditor->makePristine(); mAssetStatus = PREVIEW_ASSET_LOADED; } @@ -1795,7 +1804,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) // This may be better than having a accessible null pointer around, // though this newly allocated object will most likely be replaced. mItem = new LLViewerInventoryItem(); - mScriptEd->mEditor->setText(LLStringUtil::null); + mScriptEd->setScriptText(LLStringUtil::null, FALSE); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -1803,7 +1812,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) } else { - mScriptEd->mEditor->setText(std::string(HELLO_LSL)); + mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE); mScriptEd->enableSave(FALSE); LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); @@ -1902,8 +1911,8 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType { LLVFile file(vfs, uuid, type); S32 file_length = file.getSize(); - char *buffer = new char[file_length + 1]; - file.read((U8*)buffer, file_length); /*Flawfinder: ignore*/ + std::vector buffer(file_length + 1); + file.read((U8*)&buffer[0], file_length); if (file.getLastBytesRead() != file_length || file_length <= 0) @@ -1913,10 +1922,8 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType buffer[file_length] = '\0'; - mScriptEd->mEditor->setText(LLStringExplicit(buffer)); + mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); mScriptEd->mEditor->makePristine(); - delete[] buffer; - } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 7f634a48a0..eb8b414709 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -81,6 +81,8 @@ public: BOOL canClose(); + void setScriptText(const std::string& text, BOOL is_valid); + bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response); @@ -150,6 +152,7 @@ private: LLFrameTimer mLiveHelpTimer; S32 mLiveHelpHistorySize; BOOL mEnableSave; + BOOL mHasScriptData; }; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 9aa5c37b26..564313980d 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -92,7 +92,6 @@ LLViewerObject* getSelectedParentObject(LLViewerObject *object) ; const S32 NUM_SELECTION_UNDO_ENTRIES = 200; const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; -const S32 OWNERSHIP_COST_PER_OBJECT = 10; // Must be the same as economy_constants.price_object_claim in the database. const S32 MAX_ACTION_QUEUE_SIZE = 20; const S32 MAX_SILS_PER_FRAME = 50; const S32 MAX_OBJECTS_PER_PACKET = 254; @@ -2620,11 +2619,6 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) -BOOL LLSelectMgr::selectGetOwnershipCost(S32* out_cost) -{ - return mSelectedObjects->getOwnershipCost(*out_cost); -} - BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm) { BOOL first = TRUE; @@ -5869,16 +5863,6 @@ BOOL LLObjectSelection::isEmpty() const return (mList.size() == 0); } -//----------------------------------------------------------------------------- -// getOwnershipCost() -//----------------------------------------------------------------------------- -BOOL LLObjectSelection::getOwnershipCost(S32 &cost) -{ - S32 count = getObjectCount(); - cost = count * OWNERSHIP_COST_PER_OBJECT; - return (count > 0); -} - //----------------------------------------------------------------------------- // getObjectCount() - returns number of non null objects diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 582a78551d..d6c4b5485d 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -275,8 +275,6 @@ public: BOOL isEmpty() const; - S32 getOwnershipCost(S32 &cost); - LLSelectNode* getFirstNode(LLSelectedNodeFunctor* func = NULL); LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, BOOL non_root_ok = FALSE); LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent = FALSE); @@ -552,7 +550,6 @@ public: // the value found if available. BOOL selectGetGroup(LLUUID& id); BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // TRUE if all have data, returns two masks, each indicating which bits are all on and all off - BOOL selectGetOwnershipCost(S32* cost); // sum of all ownership costs BOOL selectIsGroupOwned(); // TRUE if all root objects have valid data and are group owned. diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index bd2e157779..a145e965fb 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -116,6 +116,7 @@ #include "llkeyboard.h" #include "llloginhandler.h" // gLoginHandler, SLURL support #include "llpanellogin.h" +#include "llprefsim.h" #include "llmutelist.h" #include "llnotify.h" #include "llpanelavatar.h" @@ -1294,16 +1295,9 @@ bool idle_startup() if (update || gSavedSettings.getBOOL("ForceMandatoryUpdate")) { gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE); - if (show_connect_box) - { - update_app(TRUE, auth_message); - LLStartUp::setStartupState( STATE_UPDATE_CHECK ); - return false; - } - else - { - quit = true; - } + update_app(TRUE, auth_message); + LLStartUp::setStartupState( STATE_UPDATE_CHECK ); + return false; } // Version update and we're not showing the dialog @@ -1976,6 +1970,9 @@ bool idle_startup() //--------------------------------------------------------------------- if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) { + // Inform simulator of our language preference + LLAgentLanguage::update(); + // unpack thin inventory LLUserAuth::options_t options; options.clear(); @@ -2291,9 +2288,6 @@ bool idle_startup() // JC - 7/20/2002 gViewerWindow->sendShapeToSim(); - // Inform simulator of our language preference - LLAgentLanguage::update(); - // Ignore stipend information for now. Money history is on the web site. // if needed, show the L$ history window @@ -2352,6 +2346,9 @@ bool idle_startup() //DEV-17797. get null folder. Any items found here moved to Lost and Found LLInventoryModel::findLostItems(); + //DEV-10530. do cleanup. remove at some later date. jan-2009 + LLPrefsIM::cleanupBadSetting(); + LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); return FALSE; diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 971930d7ee..f36d12d638 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -628,9 +628,16 @@ void LLStatusBar::refresh() mTextParcelName->setRect(r); // Set search bar visibility - childSetVisible("search_editor", search_visible); - childSetVisible("search_btn", search_visible); - childSetVisible("menubar_search_bevel_bg", search_visible); + + if (gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + // don't monkey with search visibility in mouselook - it will be set + // with setVisibleForMouselook() below + childSetVisible("search_editor", search_visible); + childSetVisible("search_btn", search_visible); + childSetVisible("menubar_search_bevel_bg", search_visible); + } + mSGBandwidth->setVisible(! search_visible); mSGPacketLoss->setVisible(! search_visible); childSetEnabled("stat_btn", ! search_visible); @@ -643,6 +650,7 @@ void LLStatusBar::setVisibleForMouselook(bool visible) childSetVisible("buycurrency", visible); childSetVisible("search_editor", visible); childSetVisible("search_btn", visible); + childSetVisible("menubar_search_bevel_bg", visible); mSGBandwidth->setVisible(visible); mSGPacketLoss->setVisible(visible); setBackgroundVisible(visible); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 69723f622a..a3966ed666 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1254,7 +1254,7 @@ void LLTextureCache::purgeTextures(bool validate) else if (validate) { // make sure file exists and is the correct size - S32 uuididx = entries[idx].mID.mData[0]; + U32 uuididx = entries[idx].mID.mData[0]; if (uuididx == validate_idx) { LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mSize << LL_ENDL; diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index da9f3c5bd7..6a3ada0474 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -65,7 +65,6 @@ LLTool::~LLTool() } } - BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask) { if (gDebugClicks) @@ -125,6 +124,20 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) // llinfos << "LLTool::handleRightMouseDown" << llendl; return FALSE; } + +BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleMiddleMouseDown" << llendl; + return FALSE; +} + +BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleMiddleMouseUp" << llendl; + return FALSE; +} BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 249088fd3d..f954a8c243 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -57,6 +57,9 @@ public: // Virtual functions inherited from LLMouseHandler virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 351c02b4c0..4e8274a6ef 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -128,8 +128,8 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); gViewerWindow->pickAsync(x, y, mask, pickCallback); - // don't steal focus from UI - return FALSE; + + return TRUE; } void LLToolCamera::pickCallback(const LLPickInfo& pick_info) diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index ed9ca851d3..d9811dac6c 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -210,22 +210,29 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) if (!objectp->usePhysics()) { - // In mouselook, we shouldn't be able to grab non-physical, - // non-touchable objects. If it has a touch handler, we - // do grab it (so llDetectedGrab works), but movement is - // blocked on the server side. JC - if (gAgent.cameraMouselook() && !script_touch) + if (script_touch) { - mMode = GRAB_LOCKED; - gViewerWindow->hideCursor(); - gViewerWindow->moveCursorToCenter(); + mMode = GRAB_NONPHYSICAL; // if it has a script, use the non-physical grab } else { - mMode = GRAB_NONPHYSICAL; + // In mouselook, we shouldn't be able to grab non-physical, + // non-touchable objects. If it has a touch handler, we + // do grab it (so llDetectedGrab works), but movement is + // blocked on the server side. JC + if (gAgent.cameraMouselook()) + { + mMode = GRAB_LOCKED; + } + else + { + mMode = GRAB_ACTIVE_CENTER; + } + + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + } - // Don't bail out here, go on and grab so buttons can get - // their "touched" event. } else if( !objectp->permMove() ) { diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 8e81152a89..d54cc798d2 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -294,6 +294,7 @@ void LLTracker::trackAvatar( const LLUUID& avatar_id, const std::string& name ) LLAvatarTracker::instance().track( avatar_id, name ); instance()->mTrackingStatus = TRACKING_AVATAR; instance()->mLabel = name; + instance()->mToolTip = ""; } @@ -309,6 +310,7 @@ void LLTracker::trackLandmark( const LLUUID& asset_id, const LLUUID& item_id, co instance()->cacheLandmarkPosition(); instance()->mTrackingStatus = TRACKING_LANDMARK; instance()->mLabel = name; + instance()->mToolTip = ""; } diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index 2ba87f01bd..7f63972c8d 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -103,18 +103,10 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 max_msg_width = 0; std::list msg_lines; - S32 size = msg.size() + 1;// + strlen("Uploading...\n\n"); - char* temp_msg = new char[size]; - - //strcpy(temp_msg,"Uploading...\n\n"); - if (temp_msg == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - strcpy( temp_msg, msg.c_str()); /* Flawfinder: ignore */ - char* token = strtok( temp_msg, "\n" ); + S32 size = msg.size() + 1; + std::vector temp_msg(size); // non-const copy to make strtok happy + strcpy( &temp_msg[0], msg.c_str()); + char* token = strtok( &temp_msg[0], "\n" ); while( token ) { std::string tokstr(token); @@ -123,8 +115,6 @@ void LLUploadDialog::setMessage( const std::string& msg) msg_lines.push_back( tokstr ); token = strtok( NULL, "\n" ); } - delete[] temp_msg; - S32 line_height = S32( font->getLineHeight() + 0.99f ); S32 dialog_width = max_msg_width + 2 * HPAD; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 2c487665d2..eb8cdd82b3 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -63,6 +63,7 @@ #include "llviewerparcelmgr.h" #include "llparcel.h" #include "llnotify.h" +#include "lloverlaybar.h" #include "llkeyboard.h" #include "llerrorcontrol.h" #include "llversionviewer.h" @@ -269,17 +270,21 @@ static bool handleAudioStreamMusicChanged(const LLSD& newvalue) if (LLViewerParcelMgr::getInstance()->getAgentParcel() && !LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL().empty()) { - // if stream is already playing, don't call this - // otherwise music will briefly stop - if ( !gAudiop->isInternetStreamPlaying() ) + // if music isn't playing, start it + if (gOverlayBar && !gOverlayBar->musicPlaying()) { - gAudiop->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL()); + LLOverlayBar::toggleMusicPlay(NULL); } } } else { - gAudiop->stopInternetStream(); + // if music is playing, stop it. + if (gOverlayBar && gOverlayBar->musicPlaying()) + { + LLOverlayBar::toggleMusicPlay(NULL); + } + } } return true; diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 652e50e20c..9f7e4d338b 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -992,6 +992,13 @@ void LLViewerJoystick::scanJoystick() #endif updateStatus(); + // App focus check Needs to happen AFTER updateStatus in case the joystick + // is not centred when the app loses focus. + if (!gFocusMgr.getAppHasFocus()) + { + return; + } + static long toggle_flycam = 0; if (mBtn[0] == 1) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 96a4f74927..4fd0c8dc8a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -762,7 +762,7 @@ void init_client_menu(LLMenuGL* menu) /*menu->append(new LLMenuItemCallGL("Reload settings/colors", &handle_reload_settings, NULL, NULL));*/ menu->append(new LLMenuItemCallGL("Reload personal setting overrides", - &reload_personal_settings_overrides, NULL, NULL, KEY_F2, MASK_CONTROL|MASK_SHIFT)); + &reload_personal_settings_overrides, NULL, NULL, KEY_F12, MASK_CONTROL|MASK_SHIFT)); sub_menu = new LLMenuGL("HUD Info"); { @@ -1084,94 +1084,95 @@ void init_debug_rendering_menu(LLMenuGL* menu) // sub_menu = new LLMenuGL("Types"); menu->appendMenu(sub_menu); - + sub_menu->append(new LLMenuItemCheckGL("Simple", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_SIMPLE, '1', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_SIMPLE, '1', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Alpha", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_ALPHA, '2', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_ALPHA, '2', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Tree", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_TREE, '3', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_TREE, '3', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Character", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_AVATAR, '4', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_AVATAR, '4', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("SurfacePatch", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_TERRAIN, '5', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_TERRAIN, '5', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Sky", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_SKY, '6', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_SKY, '6', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Water", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_WATER, '7', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_WATER, '7', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Ground", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_GROUND, '8', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_GROUND, '8', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Volume", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_VOLUME, '9', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_VOLUME, '9', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Grass", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_GRASS, '0', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_GRASS, '0', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Clouds", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_CLOUDS, '-', MASK_CONTROL|MASK_ALT| MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_CLOUDS, '-', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_PARTICLES, '=', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_PARTICLES, '`', MASK_ALT|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Bump", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_BUMP, '\\', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); + (void*)LLPipeline::RENDER_TYPE_BUMP, '\\', MASK_ALT|MASK_SHIFT)); + sub_menu->createJumpKeys(); sub_menu = new LLMenuGL("Features"); menu->appendMenu(sub_menu); sub_menu->append(new LLMenuItemCheckGL("UI", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_UI, KEY_F1, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_UI, KEY_F1, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Selected", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_SELECTED, KEY_F2, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_SELECTED, KEY_F2, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Highlighted", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED, KEY_F3, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED, KEY_F3, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Dynamic Textures", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES, KEY_F4, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES, KEY_F4, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL( "Foot Shadows", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS, KEY_F5, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS, KEY_F5, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Fog", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOG, KEY_F6, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOG, KEY_F6, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL("Test FRInfo", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO, KEY_F8, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO, KEY_F8, MASK_CONTROL|MASK_SHIFT)); sub_menu->append(new LLMenuItemCheckGL( "Flexible Objects", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE, KEY_F9, MASK_ALT|MASK_CONTROL)); + (void*)LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE, KEY_F9, MASK_CONTROL|MASK_SHIFT)); sub_menu->createJumpKeys(); ///////////////////////////// @@ -1328,8 +1329,11 @@ void init_debug_avatar_menu(LLMenuGL* menu) menu->appendMenu(sub_menu); sub_menu = new LLMenuGL("Character Tests"); - sub_menu->append(new LLMenuItemToggleGL("Go Away/AFK When Idle", - &gAllowIdleAFK)); + sub_menu->append(new LLMenuItemCheckGL("Go Away/AFK When Idle", + menu_toggle_control, + NULL, + menu_check_control, + (void*)"AllowIdleAFK")); sub_menu->append(new LLMenuItemCallGL("Appearance To XML", &LLVOAvatar::dumpArchetypeXML)); @@ -4730,25 +4734,29 @@ class LLWorldSetBusy : public view_listener_t } }; +bool can_create_landmark() +{ + BOOL can = FALSE; + + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (agent_parcel) + { + + if (agent_parcel->getAllowLandmark() + || LLViewerParcelMgr::isParcelOwnedByAgent(agent_parcel, GP_LAND_ALLOW_LANDMARK)) + { + can = TRUE; + } + } + + return can; +} class LLWorldCreateLandmark : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerRegion* agent_region = gAgent.getRegion(); - if(!agent_region) - { - llwarns << "No agent region" << llendl; - return true; - } - LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (!agent_parcel) - { - llwarns << "No agent parcel" << llendl; - return true; - } - if (!agent_parcel->getAllowLandmark() - && !LLViewerParcelMgr::isParcelOwnedByAgent(agent_parcel, GP_LAND_ALLOW_LANDMARK)) + if (!can_create_landmark()) { LLNotifications::instance().add("CannotCreateLandmarkNotOwner"); return true; @@ -6284,25 +6292,28 @@ class LLToolsEnableTakeCopy : public view_listener_t bool all_valid = false; if (LLSelectMgr::getInstance()) { - all_valid = true; + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + all_valid = true; #ifndef HACKED_GODLIKE_VIEWER # ifdef TOGGLE_HACKED_GODLIKE_VIEWER - if (LLViewerLogin::getInstance()->isInProductionGrid() - || !gAgent.isGodlike()) + if (LLViewerLogin::getInstance()->isInProductionGrid() + || !gAgent.isGodlike()) # endif - { - struct f : public LLSelectedObjectFunctor { - virtual bool apply(LLViewerObject* obj) + struct f : public LLSelectedObjectFunctor { - return (!obj->permCopy() || obj->isAttachment()); - } - } func; - const bool firstonly = true; - bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); - all_valid = !any_invalid; - } + virtual bool apply(LLViewerObject* obj) + { + return (!obj->permCopy() || obj->isAttachment()); + } + } func; + const bool firstonly = true; + bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); + all_valid = !any_invalid; + } #endif // HACKED_GODLIKE_VIEWER + } } gMenuHolder->findControl(userdata["control"].asString())->setValue(all_valid); @@ -6496,9 +6507,10 @@ class LLWorldEnableCreateLandmark : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gAgent.isGodlike() || - (gAgent.getRegion() && gAgent.getRegion()->getAllowLandmark()); + bool new_value = can_create_landmark(); + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + return true; } }; @@ -7544,8 +7556,8 @@ void initialize_menus() addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake"); addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy"); - addMenu(new LLToolsEnableSaveToInventory(), "Tools.SaveToInventory"); - addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.SaveToObjectInventory"); + addMenu(new LLToolsEnableSaveToInventory(), "Tools.EnableSaveToInventory"); + addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory"); /*addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject"); addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/ diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 2925916e2a..5240fd3211 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -658,7 +658,7 @@ void upload_new_resource(const std::string& src_filename, std::string name, { // read in the file header char buf[16384]; /* Flawfinder: ignore */ - S32 read; /* Flawfinder: ignore */ + size_t readbytes; S32 version; if (fscanf(in, "LindenResource\nversion %d\n", &version)) { @@ -741,9 +741,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, LLFILE* out = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (out) { - while((read = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */ + while((readbytes = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */ { - if (fwrite(buf, 1, read, out) != read) + if (fwrite(buf, 1, readbytes, out) != readbytes) { llwarns << "Short write" << llendl; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6ffb19bcdf..088ba62d0c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1343,27 +1343,6 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) LLNotifications::instance().add(p); } - -bool group_vote_callback(const LLSD& notification, const LLSD& response) -{ - LLUUID group_id = notification["payload"]["group_id"].asUUID(); - S32 option = LLNotification::getSelectedOption(notification, response); - switch(option) - { - case 0: - // Vote Now - // Open up the voting tab - LLFloaterGroupInfo::showFromUUID(group_id, "voting_tab"); - break; - default: - // Vote Later or - // close button - break; - } - return false; -} -static LLNotificationFunctorRegistration group_vote_callback_reg("GroupVote", group_vote_callback); - bool lure_callback(const LLSD& notification, const LLSD& response) { S32 option = 0; @@ -1514,7 +1493,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // initiated by the other party) then... std::string my_name; gAgent.buildFullname(my_name); - std::string response = gSavedPerAccountSettings.getText("BusyModeResponse"); + std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2"); pack_instant_message( gMessageSystem, gAgent.getID(), @@ -1847,17 +1826,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLNotifications::instance().add("InventoryDeclined", args); break; } + // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 case IM_GROUP_VOTE: - { - LLSD args; - args["NAME"] = name; - args["MESSAGE"] = message; - - LLSD payload; - payload["group_id"] = session_id; - LLNotifications::instance().add("GroupVote", args, payload); - } - break; + { + LL_WARNS("Messaging") << "Received IM: IM_GROUP_VOTE_DEPRECATED" << LL_ENDL; + } + break; case IM_GROUP_ELECTION_DEPRECATED: { @@ -2113,7 +2087,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id) { std::string my_name; gAgent.buildFullname(my_name); - std::string response = gSavedPerAccountSettings.getText("BusyModeResponse"); + std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2"); pack_instant_message( gMessageSystem, gAgent.getID(), @@ -4362,11 +4336,11 @@ void mean_name_callback(const LLUUID &id, const std::string& first, const std::s return; } - static const int max_collision_list_size = 20; + static const U32 max_collision_list_size = 20; if (gMeanCollisionList.size() > max_collision_list_size) { mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); - for (S32 i=0; igetUUID("Data", "ObjectID", object_id); + + if (LLMuteList::getInstance()->isMuted(object_id)) + { + return; + } + std::string message; std::string first_name; std::string last_name; std::string title; - LLUUID object_id; S32 chat_channel; - msg->getUUID("Data", "ObjectID", object_id); msg->getString("Data", "FirstName", first_name); msg->getString("Data", "LastName", last_name); msg->getString("Data", "ObjectName", title); @@ -5526,25 +5505,18 @@ void onCovenantLoadComplete(LLVFS *vfs, S32 file_length = file.getSize(); - char* buffer = new char[file_length+1]; - if (buffer == NULL) - { - LL_ERRS("Messaging") << "Memory Allocation failed" << LL_ENDL; - return; - } - - file.read((U8*)buffer, file_length); /* Flawfinder: ignore */ - + std::vector buffer(file_length+1); + file.read((U8*)&buffer[0], file_length); // put a EOS at the end - buffer[file_length] = 0; + buffer[file_length] = '\0'; - if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) + if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { LLViewerTextEditor* editor = new LLViewerTextEditor(std::string("temp"), LLRect(0,0,0,0), file_length+1); - if( !editor->importBuffer( buffer, file_length+1 ) ) + if( !editor->importBuffer( &buffer[0], file_length+1 ) ) { LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; covenant_text = "Problem importing estate covenant."; @@ -5554,7 +5526,6 @@ void onCovenantLoadComplete(LLVFS *vfs, // Version 0 (just text, doesn't include version number) covenant_text = editor->getText(); } - delete[] buffer; delete editor; } else diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index d7313c1653..32c89e158c 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2441,7 +2441,11 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) msg->getS16Fast(_PREHASH_InventoryData, _PREHASH_Serial, object->mInventorySerialNum); LLFilenameAndTask* ft = new LLFilenameAndTask; ft->mTaskID = task_id; - msg->getStringFast(_PREHASH_InventoryData, _PREHASH_Filename, ft->mFilename); + + std::string unclean_filename; + msg->getStringFast(_PREHASH_InventoryData, _PREHASH_Filename, unclean_filename); + ft->mFilename = LLDir::getScrubbedFileName(unclean_filename); + if(ft->mFilename.empty()) { lldebugs << "Task has no inventory" << llendl; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 194029398d..07203ce0f4 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -650,10 +650,9 @@ BOOL LLViewerParcelMgr::agentCanBuild() const { if (mAgentParcel) { - return (gAgent.isGodlike() - || (mAgentParcel->allowModifyBy( - gAgent.getID(), - gAgent.getGroupID()))); + return (gAgent.isGodlike() || + (mAgentParcel->allowModifyBy(gAgent.getID(), gAgent.getGroupID())) || + (isParcelOwnedByAgent(mAgentParcel, GP_LAND_ALLOW_CREATE))); } else { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 750151ea2d..44d0304533 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -318,7 +318,7 @@ void LLViewerRegion::loadCache() LLUUID cache_id; nread = fread(&cache_id.mData, 1, UUID_BYTES, fp); - if (nread != UUID_BYTES || mCacheID != cache_id) + if (nread != (size_t)UUID_BYTES || mCacheID != cache_id) { llinfos << "Cache ID doesn't match for this region, discarding" << llendl; @@ -394,7 +394,7 @@ void LLViewerRegion::saveCache() } // write the cache id for this sim - if (fwrite(&mCacheID.mData, 1, UUID_BYTES, fp) != UUID_BYTES) + if (fwrite(&mCacheID.mData, 1, UUID_BYTES, fp) != (size_t)UUID_BYTES) { llwarns << "Short write" << llendl; } @@ -1387,11 +1387,12 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegion::setSeedCapability(const std::string& url) { - if (getCapability("Seed") == url) + if (getCapability("Seed") == url) { - llwarns << "Ignoring duplicate seed capability" << llendl; - return; + // llwarns << "Ignoring duplicate seed capability" << llendl; + return; } + delete mEventPoll; mEventPoll = NULL; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 1fd31a013a..728509e39c 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -894,51 +894,9 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; - - // let scrollbar have first dibs - handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL; - - // Used to enable I Agree checkbox if the user scrolled through entire text - BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); - if (mOnScrollEndCallback && was_scrolled_to_bottom) - { - mOnScrollEndCallback(mOnScrollEndData); - } - - if( !handled && mTakesNonScrollClicks) - { - if( mIsSelecting ) - { - // Finish selection - if( y > getTextRect().mTop ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); - } - else - if( y < getTextRect().mBottom ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); - } - - setCursorAtLocalPos( x, y, TRUE ); - endSelection(); - - updateScrollFromCursor(); - } - - if( !hasSelection() ) - { - handleMouseUpOverSegment( x, y, mask ); - } - - handled = TRUE; - } - - // Delay cursor flashing - resetKeystrokeTimer(); + BOOL handled = FALSE; - if( hasMouseCapture() ) + if( hasMouseCapture() ) { if (mDragItem) { @@ -957,8 +915,15 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) } } mDragItem = NULL; - gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + } + + handled = LLTextEditor::handleMouseUp(x,y,mask); + + // Used to enable I Agree checkbox if the user scrolled through entire text + BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); + if (mOnScrollEndCallback && was_scrolled_to_bottom) + { + mOnScrollEndCallback(mOnScrollEndData); } return handled; @@ -1000,6 +965,24 @@ BOOL LLViewerTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) return handled; } +BOOL LLViewerTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + BOOL handled = FALSE; + handled = childrenHandleMiddleMouseDown(x, y, mask) != NULL; + if (!handled) + { + handled = LLTextEditor::handleMiddleMouseDown(x, y, mask); + } + return handled; +} + +BOOL LLViewerTextEditor::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + BOOL handled = childrenHandleMiddleMouseUp(x, y, mask) != NULL; + + return handled; +} + BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -1022,7 +1005,6 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) } } } - setCursorAtLocalPos( x, y, FALSE ); deselect(); @@ -1060,6 +1042,9 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing resetKeystrokeTimer(); + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } return handled; diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h index 0aa9164c90..1ed60a57fe 100644 --- a/indra/newview/llviewertexteditor.h +++ b/indra/newview/llviewertexteditor.h @@ -59,6 +59,8 @@ public: // mousehandler overrides virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 71406d268d..26ddf213d2 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -589,19 +589,46 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh) return false; } -BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { + std::string buttonname; + std::string buttonstatestr; + BOOL handled = FALSE; S32 x = pos.mX; S32 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) + if (down) + { + buttonstatestr = "down" ; + } + else { - llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; + buttonstatestr = "up" ; } + + switch (clicktype) + { + case LLMouseHandler::CLICK_LEFT: + mLeftMouseDown = down; + buttonname = "Left"; + break; + case LLMouseHandler::CLICK_RIGHT: + mRightMouseDown = down; + buttonname = "Right"; + break; + case LLMouseHandler::CLICK_MIDDLE: + mMiddleMouseDown = down; + buttonname = "Middle"; + break; + case LLMouseHandler::CLICK_DOUBLELEFT: + mLeftMouseDown = down; + buttonname = "Left Double Click"; + break; + } + + LLView::sMouseHandlerMessage.clear(); if (gMenuBarView) { @@ -609,18 +636,24 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask gMenuBarView->resetMenuTrigger(); } - mLeftMouseDown = TRUE; + if (gDebugClicks) + { + llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; + } - // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); + // Make sure we get a corresponding mouseup event, even if the mouse leaves the window + if (down) + mWindow->captureMouse(); + else + mWindow->releaseMouse(); // Indicate mouse was active gMouseIdleTimer.reset(); // Hide tooltips on mousedown - mToolTipBlocked = TRUE; + mToolTipBlocked = down; - // Also hide hover info on mousedown + // Also hide hover info on mousedown/mouseup if (gHoverView) { gHoverView->cancelHover(); @@ -629,7 +662,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask // Don't let the user move the mouse out of the window until mouse up. if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) { - mWindow->setMouseClipping(TRUE); + mWindow->setMouseClipping(down); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -640,10 +673,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl; } - - return mouse_captor->handleMouseDown(local_x, local_y, mask); + return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); } // Topmost view gets a chance before the hierarchy @@ -652,215 +684,99 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask { S32 local_x, local_y; top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) + if (down) { - return top_ctrl->handleMouseDown(local_x, local_y, mask); + if (top_ctrl->pointInView(local_x, local_y)) + { + return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; + } + else + { + gFocusMgr.setTopCtrl(NULL); + } } else { - gFocusMgr.setTopCtrl(NULL); + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); } } // Give the UI views a chance to process the click - if( mRootView->handleMouseDown(x, y, mask) ) + if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ) { if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl; } return TRUE; } else if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down not handled by view" << llendl; - } - - if (gDisconnected) - { - return FALSE; + llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl; } - if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) + if (down) { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } - - return FALSE; -} - -BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) -{ - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl; - } - - mLeftMouseDown = TRUE; - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) + if (gDisconnected) { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; + return FALSE; + } + + if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) + { + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; } - - return mouse_captor->handleDoubleClick(local_x, local_y, mask); } - - // Check for hit on UI. - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) + else { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) + if( !handled ) { - return top_ctrl->handleDoubleClick(local_x, local_y, mask); + handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down); } - else + + if( !handled ) { - gFocusMgr.setTopCtrl(NULL); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if (tool) + { + handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down); + } } } - if (mRootView->handleDoubleClick(x, y, mask)) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down not handled by view" << llendl; - } + // If we got this far on a down-click, it wasn't handled. + // Up-clicks, though, are always handled as far as the OS is concerned. + BOOL default_rtn = !down; + return default_rtn; +} - // Why is this here? JC 9/3/2002 - if (gNoRender) - { - return TRUE; - } +BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +{ + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); +} - if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) +BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) +{ + // try handling as a double-click first, then a single-click if that + // wasn't handled. + BOOL down = TRUE; + if (handleAnyMouseClick(window, pos, mask, + LLMouseHandler::CLICK_DOUBLELEFT, down)) { return TRUE; } - - // if we got this far and nothing handled a double click, pass a normal mouse down return handleMouseDown(window, pos, mask); } BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse up" << llendl; - } - - mLeftMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Left Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -871,91 +787,10 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; - } - - if (gMenuBarView) - { - // stop ALT-key access to menu - gMenuBarView->resetMenuTrigger(); - } - - mRightMouseDown = TRUE; - - // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mousedown - if (gHoverView) - { - gHoverView->cancelHover(); - } - - // Don't let the user move the mouse out of the window until mouse up. - if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(TRUE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseDown(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleRightMouseDown(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } - - if( mRootView->handleRightMouseDown(x, y, mask) ) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down not handled by view" << llendl; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } + BOOL down = TRUE; + BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); + if (handle) + return handle; // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. @@ -973,107 +808,27 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - // Don't care about caps lock for mouse events. - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse up" << llendl; - } - - mRightMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleRightMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Right Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleRightMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = TRUE; gVoiceClient->middleMouseState(true); - - // Always handled as far as the OS is concerned. + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); + + // Always handled as far as the OS is concerned. return TRUE; } - + BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = FALSE; gVoiceClient->middleMouseState(false); - - // Always handled as far as the OS is concerned. + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); + + // Always handled as far as the OS is concerned. return TRUE; } @@ -1279,7 +1034,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) else { mActive = FALSE; - if (gAllowIdleAFK) + if (gSavedSettings.getBOOL("AllowIdleAFK")) { gAgent.setAFK(); } @@ -1447,6 +1202,7 @@ LLViewerWindow::LLViewerWindow( mWindowRect(0, height, width, 0), mVirtualWindowRect(0, height, width, 0), mLeftMouseDown(FALSE), + mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), mToolTip(NULL), mToolTipBlocked(FALSE), @@ -5288,11 +5044,15 @@ void LLPickInfo::fetchResults() // put global position into land_pos LLVector3d land_pos; - if (gViewerWindow->mousePointOnLandGlobal(mPickPt.mX, mPickPt.mY, &land_pos)) + if (!gViewerWindow->mousePointOnLandGlobal(mPickPt.mX, mPickPt.mY, &land_pos)) { - // Fudge the land focus a little bit above ground. - mPosGlobal = land_pos + LLVector3d::z_axis * 0.1f; + // The selected point is beyond the draw distance or is otherwise + // not selectable. Return before calling mPickCallback(). + return; } + + // Fudge the land focus a little bit above ground. + mPosGlobal = land_pos + LLVector3d::z_axis * 0.1f; } else { diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 1520e779ab..e0ddac6fa5 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -49,6 +49,7 @@ #include "llstat.h" #include "llalertdialog.h" #include "llnotifications.h" +#include "llmousehandler.h" class LLView; class LLViewerObject; @@ -59,7 +60,6 @@ class LLVelocityBar; class LLTextBox; class LLImageRaw; class LLHUDIcon; -class LLMouseHandler; #define PICK_HALF_WIDTH 5 #define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1) @@ -83,7 +83,7 @@ public: static bool isFlora(LLViewerObject* object); - typedef enum e_pick_type + typedef enum { PICK_OBJECT, PICK_FLORA, @@ -152,6 +152,7 @@ public: /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended + /*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleCloseRequest(LLWindow *window); @@ -214,6 +215,7 @@ public: LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } + BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } const LLPickInfo& getLastPick() const { return mLastPick; } @@ -281,7 +283,7 @@ public: // snapshot functionality. // perhaps some of this should move to llfloatershapshot? -MG - typedef enum e_snapshot_type + typedef enum { SNAPSHOT_TYPE_COLOR, SNAPSHOT_TYPE_DEPTH, @@ -387,6 +389,7 @@ protected: LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame LLStat mMouseVelocityStat; BOOL mLeftMouseDown; + BOOL mMiddleMouseDown; BOOL mRightMouseDown; LLProgressView *mProgressView; diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index b79d7d10ff..e52fec7909 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -214,7 +214,7 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y, return TRUE; } -static const S32 BASE_SIZE = 128; +static const U32 BASE_SIZE = 128; BOOL LLVLComposition::generateComposition() { @@ -349,9 +349,9 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, tex_comps = texturep->getComponents(); tex_stride = tex_width * tex_comps; - S32 st_comps = 3; - S32 st_width = BASE_SIZE; - S32 st_height = BASE_SIZE; + U32 st_comps = 3; + U32 st_width = BASE_SIZE; + U32 st_height = BASE_SIZE; if (tex_comps != st_comps) { diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index a5f4dc934a..f705531723 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -294,7 +294,7 @@ BOOL LLWearable::importFile( LLFILE* file ) } // name - char next_char = fgetc( file ); /* Flawfinder: ignore */ + int next_char = fgetc( file ); /* Flawfinder: ignore */ if( '\n' == next_char ) { // no name diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index c9cc86bbbc..3fdef29540 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -367,9 +367,14 @@ LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVe clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY]; } - // clamp to < 256 to stay in sim + // clamp to within region dimensions LLVector3d final_region_pos = LLVector3d(region_coord) - (delta_pos * clip_factor); - final_region_pos.clamp(0.0, 255.999); + final_region_pos.mdV[VX] = llclamp(final_region_pos.mdV[VX], 0.0, + (F64)(region_width - F_ALMOST_ZERO)); + final_region_pos.mdV[VY] = llclamp(final_region_pos.mdV[VY], 0.0, + (F64)(region_width - F_ALMOST_ZERO)); + final_region_pos.mdV[VZ] = llclamp(final_region_pos.mdV[VZ], 0.0, + (F64)(LLWorld::getInstance()->getRegionMaxHeight() - F_ALMOST_ZERO)); return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos)); } diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 7f8f4cc026..62c4d832cf 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -181,11 +181,11 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) const S32 DIR_WIDTH = 10; const S32 DIR_HEIGHT = 10; LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); + LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); + mTextBoxNorth->setColor( minor_color ); addChild( mTextBoxNorth ); - - LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); mTextBoxEast->setColor( minor_color ); -- cgit v1.2.3