diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index e81965cc6..08daa9681 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -77,7 +77,6 @@ if (VIEWER) add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger) add_subdirectory(${LIBS_OPEN_PREFIX}llplugin) add_subdirectory(${LIBS_OPEN_PREFIX}llui) - add_subdirectory(${LIBS_OPEN_PREFIX}llxuixml) # viewer plugins directory add_subdirectory(${LIBS_OPEN_PREFIX}plugins) diff --git a/indra/cmake/LLXUIXML.cmake b/indra/cmake/LLXUIXML.cmake deleted file mode 100644 index b8bfe48c7..000000000 --- a/indra/cmake/LLXUIXML.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLXUIXML_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llxuixml - ) - -set(LLXUIXML_LIBRARIES llxuixml) diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index c80b71688..2d54073ee 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -43,6 +43,7 @@ #include "lluuid.h" #include "llframetimer.h" #include "llassettype.h" +#include "llextendedstatus.h" #include "lllistener.h" diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 29feeebc4..64e0140e1 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -15,8 +15,8 @@ include_directories( ) set(llcommon_SOURCE_FILES - aiframetimer.cpp - imageids.cpp + aiframetimer.cpp + imageids.cpp indra_constants.cpp llallocator.cpp llallocator_heap_profile.cpp @@ -24,7 +24,7 @@ set(llcommon_SOURCE_FILES llapr.cpp llaprpool.cpp llassettype.cpp - llavatarname.cpp + llavatarname.cpp llbase32.cpp llbase64.cpp llcommon.cpp @@ -53,6 +53,7 @@ set(llcommon_SOURCE_FILES llformat.cpp llframetimer.cpp llheartbeat.cpp + llinitparam.cpp llinstancetracker.cpp llindraconfigfile.cpp llliveappconfig.cpp @@ -171,6 +172,7 @@ set(llcommon_HEADER_FILES llheartbeat.h llhttpstatuscodes.h llindexedqueue.h + llinitparam.h llinstancetracker.h llindraconfigfile.h llkeythrottle.h @@ -212,6 +214,7 @@ set(llcommon_HEADER_FILES llsingleton.h llskiplist.h llskipmap.h + llsortedvector.h llstack.h llstacktrace.h llstat.h @@ -226,6 +229,7 @@ set(llcommon_HEADER_FILES llthreadsafequeue.h lltimer.h lltreeiterators.h + lltypeinfolookup.h lluri.h lluuid.h lluuidhashmap.h diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h index d486359c7..a0d64b3f8 100644 --- a/indra/llcommon/linden_common.h +++ b/indra/llcommon/linden_common.h @@ -33,6 +33,11 @@ #ifndef LL_LINDEN_COMMON_H #define LL_LINDEN_COMMON_H +// *NOTE: Please keep includes here to a minimum! +// +// Files included here are included in every library .cpp file and +// are not precompiled. + #include "cwdebug.h" #if defined(LL_WINDOWS) && defined(_DEBUG) @@ -55,33 +60,15 @@ #include #include -// Work around Microsoft compiler warnings in STL headers -#ifdef LL_WINDOWS -#pragma warning (disable : 4702) // unreachable code -#pragma warning (disable : 4244) // conversion from time_t to S32 -#endif // LL_WINDOWS - // *TODO: Eliminate these, most library .cpp files don't need them. // Add them to llviewerprecompiledheaders.h if necessary. #include -#include -#include -#include - -#ifdef LL_WINDOWS -// Reenable warnings we disabled above -#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4 -// moved msvc warnings to llpreprocessor.h *TODO - delete this comment after merge conflicts are unlikely -brad -#endif // LL_WINDOWS // Linden only libs in alpha-order other than stdtypes.h // *NOTE: Please keep includes here to a minimum, see above. #include "stdtypes.h" #include "lldefs.h" #include "llerror.h" -#include "llextendedstatus.h" -// Don't do this, adds 15K lines of header code to every library file. -//#include "llfasttimer.h" #include "llfile.h" #include "llformat.h" diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llcommon/llinitparam.cpp similarity index 100% rename from indra/llxuixml/llinitparam.cpp rename to indra/llcommon/llinitparam.cpp diff --git a/indra/llxuixml/llinitparam.h b/indra/llcommon/llinitparam.h similarity index 98% rename from indra/llxuixml/llinitparam.h rename to indra/llcommon/llinitparam.h index 7285d3c48..542b4ab15 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -35,6 +35,7 @@ #include #include "llerror.h" +#include "lltypeinfolookup.h" namespace LLInitParam { @@ -205,7 +206,7 @@ namespace LLInitParam mutable std::string mValueName; }; - class Parser + class LL_COMMON_API Parser { LOG_CLASS(Parser); @@ -227,9 +228,9 @@ namespace LLInitParam typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); typedef boost::function parser_inspect_func_t; - typedef std::map parser_read_func_map_t; - typedef std::map parser_write_func_map_t; - typedef std::map parser_inspect_func_map_t; + typedef LLTypeInfoLookup parser_read_func_map_t; + typedef LLTypeInfoLookup parser_write_func_map_t; + typedef LLTypeInfoLookup parser_inspect_func_map_t; Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), @@ -301,7 +302,7 @@ namespace LLInitParam class Param; // various callbacks and constraints associated with an individual param - struct ParamDescriptor + struct LL_COMMON_API ParamDescriptor { struct UserData { @@ -341,7 +342,7 @@ namespace LLInitParam typedef boost::shared_ptr ParamDescriptorPtr; // each derived Block class keeps a static data structure maintaining offsets to various params - class BlockDescriptor + class LL_COMMON_API BlockDescriptor { public: BlockDescriptor(); @@ -369,7 +370,7 @@ namespace LLInitParam class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed }; - class BaseBlock + class LL_COMMON_API BaseBlock { public: //TODO: implement in terms of owned_ptr @@ -566,7 +567,7 @@ namespace LLInitParam static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); } }; - class Param + class LL_COMMON_API Param { public: void setProvided(bool is_provided = true) @@ -1253,15 +1254,16 @@ namespace LLInitParam return mValues.back(); } - void add(const value_t& item) + self_t& add(const value_t& item) { param_value_t param_value; param_value.setValue(item); mValues.push_back(param_value); setProvided(); + return *this; } - void add(const typename name_value_lookup_t::name_t& name) + self_t& add(const typename name_value_lookup_t::name_t& name) { value_t value; @@ -1271,6 +1273,8 @@ namespace LLInitParam add(value); mValues.back().setValueName(name); } + + return *this; } // implicit conversion @@ -1441,13 +1445,14 @@ namespace LLInitParam return mValues.back(); } - void add(const value_t& item) + self_t& add(const value_t& item) { mValues.push_back(item); setProvided(); + return *this; } - void add(const typename name_value_lookup_t::name_t& name) + self_t& add(const typename name_value_lookup_t::name_t& name) { value_t value; @@ -1457,6 +1462,7 @@ namespace LLInitParam add(value); mValues.back().setValueName(name); } + return *this; } // implicit conversion @@ -2057,8 +2063,8 @@ namespace LLInitParam // block param interface - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); + LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { //TODO: implement LLSD params as schema type Any diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h new file mode 100644 index 000000000..391b82ee4 --- /dev/null +++ b/indra/llcommon/llsortedvector.h @@ -0,0 +1,152 @@ +/** + * @file llsortedvector.h + * @author Nat Goodspeed + * @date 2012-04-08 + * @brief LLSortedVector class wraps a vector that we maintain in sorted + * order so we can perform binary-search lookups. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLSORTEDVECTOR_H) +#define LL_LLSORTEDVECTOR_H + +#include +#include + +/** + * LLSortedVector contains a std::vector that we keep sorted on the + * first of the pair. This makes insertion somewhat more expensive than simple + * std::vector::push_back(), but allows us to use binary search for lookups. + * It's intended for small aggregates where lookup is far more performance- + * critical than insertion; in such cases a binary search on a small, sorted + * std::vector can be more performant than a std::map lookup. + */ +template +class LLSortedVector +{ +public: + typedef LLSortedVector self; + typedef KEY key_type; + typedef VALUE mapped_type; + typedef std::pair value_type; + typedef std::vector PairVector; + typedef typename PairVector::iterator iterator; + typedef typename PairVector::const_iterator const_iterator; + + /// Empty + LLSortedVector() {} + + /// Fixed initial size + LLSortedVector(std::size_t size): + mVector(size) + {} + + /// Bulk load + template + LLSortedVector(ITER begin, ITER end): + mVector(begin, end) + { + // Allow caller to dump in a bunch of (pairs convertible to) + // value_type if desired, but make sure we sort afterwards. + std::sort(mVector.begin(), mVector.end()); + } + + /// insert(key, value) + std::pair insert(const key_type& key, const mapped_type& value) + { + return insert(value_type(key, value)); + } + + /// insert(value_type) + std::pair insert(const value_type& pair) + { + typedef std::pair iterbool; + iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair, + less()); + // have to check for end() before it's even valid to dereference + if (found == mVector.end()) + { + std::size_t index(mVector.size()); + mVector.push_back(pair); + // don't forget that push_back() invalidates 'found' + return iterbool(mVector.begin() + index, true); + } + if (found->first == pair.first) + { + return iterbool(found, false); + } + // remember that insert() invalidates 'found' -- save index + std::size_t index(found - mVector.begin()); + mVector.insert(found, pair); + // okay, convert from index back to iterator + return iterbool(mVector.begin() + index, true); + } + + iterator begin() { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator begin() const { return mVector.begin(); } + const_iterator end() const { return mVector.end(); } + + bool empty() const { return mVector.empty(); } + std::size_t size() const { return mVector.size(); } + + /// find + iterator find(const key_type& key) + { + iterator found = std::lower_bound(mVector.begin(), mVector.end(), + value_type(key, mapped_type()), + less()); + if (found == mVector.end() || found->first != key) + return mVector.end(); + return found; + } + + const_iterator find(const key_type& key) const + { + return const_cast(this)->find(key); + } + +private: + // Define our own 'less' comparator so we can specialize without messing + // with std::less. + template + struct less: public std::less {}; + + // Specialize 'less' for an LLSortedVector::value_type involving + // std::type_info*. This is one of LLSortedVector's foremost use cases. We + // specialize 'less' rather than just defining a specific comparator + // because LLSortedVector should be usable for other key_types as well. + template + struct less< std::pair >: + public std::binary_function, + std::pair, + bool> + { + bool operator()(const std::pair& lhs, + const std::pair& rhs) const + { + return lhs.first->before(*rhs.first); + } + }; + + // Same as above, but with const std::type_info*. + template + struct less< std::pair >: + public std::binary_function, + std::pair, + bool> + { + bool operator()(const std::pair& lhs, + const std::pair& rhs) const + { + return lhs.first->before(*rhs.first); + } + }; + + PairVector mVector; +}; + +#endif /* ! defined(LL_LLSORTEDVECTOR_H) */ diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h index 7d1b80710..b4f310a51 100644 --- a/indra/llcommon/llstrider.h +++ b/indra/llcommon/llstrider.h @@ -42,10 +42,10 @@ template class LLStrider U8* mBytep; }; U32 mSkip; - //U32 mTypeSize; + public: - LLStrider() { mObjectp = NULL; /*mTypeSize = */mSkip = sizeof(Object); } + LLStrider() { mObjectp = NULL; mSkip = sizeof(Object); } ~LLStrider() { } const LLStrider& operator = (Object *first) { mObjectp = first; return *this;} @@ -60,9 +60,6 @@ public: return ret; } - //void setTypeSize (S32 typeBytes){ mTypeSize = (typeBytes ? typeBytes : sizeof(Object)); } - - //bool isStrided() const { return mTypeSize != mSkip; } void skip(const U32 index) { mBytep += mSkip*index;} U32 getSkip() const { return mSkip; } Object* get() { return mObjectp; } @@ -70,72 +67,9 @@ public: Object& operator *() { return *mObjectp; } Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; } Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; } + Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); } - /*void assignArray(U8* __restrict source, const size_t elem_size, const size_t elem_count) - { - llassert_always(sizeof(Object) <= elem_size); - - U8* __restrict dest = mBytep; //refer to dest instead of mBytep to benefit from __restrict hint - const U32 bytes = elem_size * elem_count; //total bytes to copy from source to dest - - //stride == sizeof(element) implies entire buffer is unstrided and thus memcpy-able, provided source buffer elements match in size. - //Because LLStrider is often passed an LLVector3 even if the reprensentation is LLVector4 in the vertex buffer, mTypeSize is set to - //the TRUE vbo datatype size via VertexBufferStrider::get - if(!isStrided() && mTypeSize == elem_size) - { - if(bytes >= sizeof(LLVector4) * 4) //Should be able to pull at least 3 16byte blocks from this. Smaller isn't really beneficial. - { - U8* __restrict aligned_source = LL_NEXT_ALIGNED_ADDRESS(source); - U8* __restrict aligned_dest = LL_NEXT_ALIGNED_ADDRESS(dest); - const U32 source_offset = aligned_source - source; //Offset to first aligned location in source buffer. - const U32 dest_offset = aligned_dest - dest; //Offset to first aligned location in dest buffer. - llassert_always(source_offset < 16); - llassert_always(dest_offset < 16); - if(source_offset == dest_offset) //delta to aligned location matches between source and destination! _mm_*_ps should be viable. - { - const U32 end_offset = (bytes - source_offset) % sizeof(LLVector4); //buffers may not neatly end on a 16byte alignment boundary. - const U32 aligned_bytes = bytes - source_offset - end_offset; //how many bytes to copy from aligned start to aligned end. - - llassert_always(aligned_bytes > 0); - - if(source_offset) //memcpy up to the aligned location if needed - memcpy(dest,source,source_offset); - LLVector4a::memcpyNonAliased16((F32*) aligned_dest, (F32*) aligned_source, aligned_bytes); - if(end_offset) //memcpy to the very end if needed. - memcpy(aligned_dest+aligned_bytes,aligned_source+aligned_bytes,end_offset); - } - else //buffers non-uniformly offset from aligned location. Using _mm_*u_ps. - { - U32 end = bytes/sizeof(LLVector4); //sizeof(LLVector4) = 16 bytes = 128 bits - - llassert_always(end > 0); - - __m128* dst = (__m128*) dest; - __m128* src = (__m128*) source; - - for (U32 i = 0; i < end; i++) //copy 128bit chunks - { - __m128 res = _mm_loadu_ps((F32*)&src[i]); - _mm_storeu_ps((F32*)&dst[i], res); - } - end*=16;//Convert to real byte offset - if(end < bytes) //just memcopy the rest - memcpy(dest+end,source+end,bytes-end); - } - } - else //Too small. just do a simple memcpy. - memcpy(dest,source,bytes); - } - else - { - for(U32 i=0;i + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLTYPEINFOLOOKUP_H) +#define LL_LLTYPEINFOLOOKUP_H + +#include "llsortedvector.h" +#include + +/** + * LLTypeInfoLookup is specifically designed for use cases for which you might + * consider std::map. We have several such data + * structures in the viewer. The trouble with them is that at least on Linux, + * you can't rely on always getting the same std::type_info* for a given type: + * different load modules will produce different std::type_info*. + * LLTypeInfoLookup contains a workaround to address this issue. + * + * Specifically, when we don't find the passed std::type_info*, + * LLTypeInfoLookup performs a linear search over registered entries to + * compare name() strings. Presuming that this succeeds, we cache the new + * (previously unrecognized) std::type_info* to speed future lookups. + * + * This worst-case fallback search (linear search with string comparison) + * should only happen the first time we look up a given type from a particular + * load module other than the one from which we initially registered types. + * (However, a lookup which wouldn't succeed anyway will always have + * worst-case performance.) This class is probably best used with less than a + * few dozen different types. + */ +template +class LLTypeInfoLookup +{ +public: + typedef LLTypeInfoLookup self; + typedef LLSortedVector vector_type; + typedef typename vector_type::key_type key_type; + typedef typename vector_type::mapped_type mapped_type; + typedef typename vector_type::value_type value_type; + typedef typename vector_type::iterator iterator; + typedef typename vector_type::const_iterator const_iterator; + + LLTypeInfoLookup() {} + + iterator begin() { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator begin() const { return mVector.begin(); } + const_iterator end() const { return mVector.end(); } + bool empty() const { return mVector.empty(); } + std::size_t size() const { return mVector.size(); } + + std::pair insert(const std::type_info* key, const VALUE& value) + { + return insert(value_type(key, value)); + } + + std::pair insert(const value_type& pair) + { + return mVector.insert(pair); + } + + // const find() forwards to non-const find(): this can alter mVector! + const_iterator find(const std::type_info* key) const + { + return const_cast(this)->find(key); + } + + // non-const find() caches previously-unknown type_info* to speed future + // lookups. + iterator find(const std::type_info* key) + { + iterator found = mVector.find(key); + if (found != mVector.end()) + { + // If LLSortedVector::find() found, great, we're done. + return found; + } + // Here we didn't find the passed type_info*. On Linux, though, even + // for the same type, typeid(sametype) produces a different type_info* + // when used in different load modules. So the fact that we didn't + // find the type_info* we seek doesn't mean this type isn't + // registered. Scan for matching name() string. + for (typename vector_type::iterator ti(mVector.begin()), tend(mVector.end()); + ti != tend; ++ti) + { + if (std::string(ti->first->name()) == key->name()) + { + // This unrecognized 'key' is for the same type as ti->first. + // To speed future lookups, insert a new entry that lets us + // look up ti->second using this same 'key'. + return insert(key, ti->second).first; + } + } + // We simply have never seen a type with this type_info* from any load + // module. + return mVector.end(); + } + +private: + vector_type mVector; +}; + +#endif /* ! defined(LL_LLTYPEINFOLOOKUP_H) */ diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 3eaf74b04..3782ff1cf 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -35,8 +35,8 @@ #include "lluuid.h" #include "llstring.h" -#include "llmemtype.h" #include "llthread.h" +#include "llmemtype.h" #include "aithreadsafe.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index 989e8b2ca..f9348eb11 100644 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -29,6 +29,7 @@ #include "message.h" #include "lltimer.h" +#include "llextendedstatus.h" const S32 LL_XFER_LARGE_PAYLOAD = 7680; diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 92a54d021..22651bd5d 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -12,7 +12,6 @@ include(LLRender) include(LLWindow) include(LLVFS) include(LLXML) -include(LLXUIXML) include_directories( ${LLCOMMON_INCLUDE_DIRS} @@ -24,7 +23,6 @@ include_directories( ${LLWINDOW_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} ) set(llui_SOURCE_FILES @@ -73,6 +71,7 @@ set(llui_SOURCE_FILES lltextparser.cpp lltrans.cpp llui.cpp + lluicolor.cpp lluictrl.cpp lluictrlfactory.cpp lluiimage.cpp @@ -142,6 +141,7 @@ set(llui_HEADER_FILES lluictrl.h lluifwd.h llui.h + lluicolor.h lluiimage.h lluistring.h lluixmltags.h @@ -165,7 +165,6 @@ target_link_libraries(llui llwindow llimage llvfs # ugh, just for LLDir - llxuixml llxml llcommon # must be after llimage, llwindow, llrender llmath diff --git a/indra/llxuixml/lluicolor.cpp b/indra/llui/lluicolor.cpp similarity index 100% rename from indra/llxuixml/lluicolor.cpp rename to indra/llui/lluicolor.cpp diff --git a/indra/llxuixml/lluicolor.h b/indra/llui/lluicolor.h similarity index 100% rename from indra/llxuixml/lluicolor.h rename to indra/llui/lluicolor.h diff --git a/indra/llxuixml/CMakeLists.txt b/indra/llxuixml/CMakeLists.txt deleted file mode 100644 index bc98a43bd..000000000 --- a/indra/llxuixml/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# -*- cmake -*- - -project(llxuixml) - -include(00-Common) -include(LLCommon) -include(LLMath) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) - -set(llxuixml_SOURCE_FILES - llinitparam.cpp - lluicolor.cpp - ) - -set(llxuixml_HEADER_FILES - CMakeLists.txt - - llinitparam.h - lluicolor.h - ) - -set_source_files_properties(${llxuixml_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - -list(APPEND llxuixml_SOURCE_FILES ${llxuixml_HEADER_FILES}) - -add_library (llxuixml ${llxuixml_SOURCE_FILES}) -# Libraries on which this library depends, needed for Linux builds -# Sort by high-level to low-level -target_link_libraries(llxuixml - llxml - llcommon - llmath - ) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c41698c34..91203f19b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -37,7 +37,6 @@ include(LLUI) include(LLVFS) include(LLWindow) include(LLXML) -include(LLXUIXML) include(LScript) include(Linking) include(NDOF) @@ -72,7 +71,6 @@ include_directories( ${LLVFS_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS}/lscript_compile ) @@ -98,11 +96,7 @@ set(viewer_SOURCE_FILES ascentprefschat.cpp ascentprefssys.cpp ascentprefsvan.cpp - #dhparam.cpp - #dsaparam.cpp emeraldboobutils.cpp - dofloaterhex.cpp - dohexeditor.cpp floatersculptpreview.cpp hbfloatergrouptitles.cpp hgfloatertexteditor.cpp @@ -593,8 +587,6 @@ set(viewer_HEADER_FILES ascentprefssys.h ascentprefsvan.h emeraldboobutils.h - dofloaterhex.h - dohexeditor.h floatersculptpreview.h hbfloatergrouptitles.h hgfloatertexteditor.h @@ -1548,7 +1540,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${LLXML_LIBRARIES} - ${LLXUIXML_LIBRARIES} ${LSCRIPT_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} diff --git a/indra/newview/dhparam.cpp b/indra/newview/dhparam.cpp deleted file mode 100644 index 917eb714d..000000000 --- a/indra/newview/dhparam.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* Generated using openssl */ -#include "llviewerprecompiledheaders.h" -#include - -DH *get_dh2048() - { - static unsigned char dh2048_p[]={ - 0xAC,0x31,0xAA,0xFD,0x76,0x1B,0x47,0x24,0x99,0x6D,0xF8,0xD5, - 0x5B,0x4B,0xD1,0x7E,0xF9,0x1A,0x41,0xF6,0x29,0xCC,0xA9,0x02, - 0x6B,0xED,0xFD,0xC9,0x37,0xCE,0xF6,0x11,0x78,0x6F,0x37,0x38, - 0x7D,0x49,0x3F,0x78,0x36,0x83,0x0A,0x6F,0xBA,0x6F,0x74,0xD9, - 0xB1,0xC1,0xC4,0x5A,0x7D,0x84,0x26,0x56,0x8B,0x53,0xF4,0xFE, - 0xD1,0x34,0xF1,0xE0,0x08,0x65,0xA6,0xFD,0xDB,0x5D,0xAC,0x14, - 0xCD,0xC9,0x7E,0x79,0xE9,0x3B,0xAF,0x92,0xC7,0x4D,0x91,0x15, - 0x0B,0x1E,0x2F,0x0A,0x56,0x4E,0x0D,0x3A,0x4D,0x9E,0xB0,0xB5, - 0xFC,0x0D,0xB1,0x55,0x40,0xC6,0x30,0x99,0xCD,0xE8,0x7E,0x72, - 0x08,0x93,0x9C,0x7F,0x55,0x23,0x27,0x09,0xF4,0x50,0xF2,0x96, - 0xB5,0x30,0x35,0x6A,0x99,0x4C,0xD6,0x85,0x72,0x8D,0x9C,0x19, - 0x70,0x9A,0x77,0x52,0xE8,0x33,0x03,0x7A,0x00,0xDA,0xFE,0xD7, - 0x98,0xD0,0x7B,0x26,0xBA,0xD7,0xFF,0xD1,0x49,0x61,0x27,0x3E, - 0xFC,0x12,0x81,0xC9,0xB0,0xAF,0x34,0x14,0x97,0x66,0xFB,0xEF, - 0xD3,0xFE,0xC9,0x01,0x25,0xEC,0xF4,0xE8,0xA8,0xD8,0x21,0x45, - 0x20,0x6F,0xFC,0xA8,0xB3,0xCE,0xCF,0x0D,0xA1,0x14,0xCC,0x38, - 0x81,0x74,0x6A,0x5E,0x36,0x09,0x1D,0xBE,0x4C,0x08,0x52,0x5E, - 0xC2,0x5F,0xA4,0x48,0x3A,0x71,0x85,0xF2,0x97,0x32,0xEC,0x3B, - 0xFB,0x1B,0x9A,0x8A,0x4B,0x20,0x32,0xFE,0x6A,0x94,0x4C,0x02, - 0xB2,0xD7,0xC3,0x1B,0xF8,0x90,0x54,0x76,0x70,0x49,0x81,0x86, - 0x30,0x12,0xD2,0x91,0xF0,0xFD,0x1B,0x53,0x2E,0x60,0x13,0x78, - 0x8B,0x3F,0x1B,0x13, - }; - static unsigned char dh2048_g[]={ - 0x05, - }; - DH *dh; - - if ((dh=DH_new()) == NULL) return(NULL); - dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL); - dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL); - if ((dh->p == NULL) || (dh->g == NULL)) - { DH_free(dh); return(NULL); } - return(dh); - } diff --git a/indra/newview/dofloaterhex.cpp b/indra/newview/dofloaterhex.cpp deleted file mode 100644 index ed700be4c..000000000 --- a/indra/newview/dofloaterhex.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/** - * @file dofloaterhex.h - * @brief Hex Editor Floater made by Day - * @author Day Oh - * - * $LicenseInfo:firstyear=2009&license=WTFPLV2$ - * - */ - -// - -#include "llviewerprecompiledheaders.h" - -#include "dofloaterhex.h" -#include "lluictrlfactory.h" -#include "llinventorybackup.h" // for downloading -#include "llviewercontrol.h" // gSavedSettings -#include "llviewerwindow.h" // alertXML -#include "llagent.h" // gAgent getID -#include "llviewermenufile.h" -#include "llviewerregion.h" // getCapability -#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder -#include "llinventorymodel.h" // gInventory.updateItem -#include "llappviewer.h" // System Folders -#include "llfloaterperms.h" //get default perms -#include "llnotificationsutil.h" - -std::list DOFloaterHex::sInstances; -S32 DOFloaterHex::sUploadAmount = 10; - -DOFloaterHex::DOFloaterHex(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type) -: LLFloater() -{ - sInstances.push_back(this); - - mVFS = vfs; - - //we are editing an asset directly from the VFS - if(vfs) - { - mAssetId = item_id; - mAssetType = asset_type; - - //we are editing an inventory item - } else { - mItem = (LLInventoryItem*)gInventory.getItem(item_id); - mAssetId = mItem->getAssetUUID(); - mAssetType = mItem->getType(); - } - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml"); -} - -//this bit should be rewritten entirely -void DOFloaterHex::show(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type) -{ - if(!vfs) - { - LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id); - if(item) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("FloaterHexRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - - DOFloaterHex* floaterp = new DOFloaterHex(item_id); - floaterp->setRect(rect); - - gFloaterView->adjustToFitScreen(floaterp, FALSE); - } - } else if (item_id.notNull() && asset_type != LLAssetType::AT_NONE) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("FloaterHexRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - DOFloaterHex* floaterp = new DOFloaterHex(item_id, true, asset_type); - floaterp->setRect(rect); - - llinfos << "Asset ID: " << item_id.asString() << llendl; - - gFloaterView->adjustToFitScreen(floaterp, FALSE); - } -} - -DOFloaterHex::~DOFloaterHex() -{ - sInstances.remove(this); -} - -void DOFloaterHex::close(bool app_quitting) -{ - LLFloater::close(app_quitting); -} - -BOOL DOFloaterHex::postBuild(void) -{ - DOHexEditor* editor = getChild("hex"); - mEditor = editor; -#ifndef COLUMN_SPAN - // Set number of columns - U8 columns = U8(gSavedSettings.getU32("HexEditorColumns")); - editor->setColumns(columns); - // Reflect clamped U8ness in settings - gSavedSettings.setU32("HexEditorColumns", U32(columns)); -#endif - handleSizing(); - - childSetEnabled("upload_btn", false); - childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload")); - childSetAction("upload_btn", onClickUpload, this); - childSetEnabled("save_btn", false); - childSetAction("save_btn", onClickSave, this); - - if(!mVFS && mItem) - { - std::string title = "Hex editor: " + mItem->getName(); - const char* asset_type_name = LLAssetType::lookup(mItem->getType()); - if(asset_type_name) - { - title.append(" (" + std::string(asset_type_name) + ")"); - } - setTitle(title); - } - if(!mVFS) - { - // Load the asset - editor->setVisible(FALSE); - childSetText("status_text", std::string("Loading...")); - LLInventoryBackup::download(mItem, this, imageCallback, assetCallback); - } - else if (mVFS) //the asset already exists in the VFS, we don't need to fetch it - //and we don't want to associate it with an item - { - setTitle(mAssetId.asString()); - readVFile(); - } else { - this->close(false); - } - - return TRUE; -} - -// static -void DOFloaterHex::imageCallback(BOOL success, - LLViewerFetchedTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata) -{ - - if(final) - { - LLInventoryBackup::callbackdata* data = static_cast(userdata); - DOFloaterHex* floater = (DOFloaterHex*)(data->floater); - if(!floater) return; - if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash - //LLInventoryItem* item = data->item; - - if(!success) - { - floater->childSetText("status_text", std::string("Unable to download asset.")); - return; - } - - U8* src_data = src->getData(); - S32 size = src->getDataSize(); - std::vector new_data; - for(S32 i = 0; i < size; i++) - new_data.push_back(src_data[i]); - - floater->mEditor->setValue(new_data); - floater->mEditor->setVisible(TRUE); - floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet")); - - floater->childSetEnabled("save_btn", false); - floater->childSetEnabled("upload_btn", true); - floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); - } - else - { - src_vi->setBoostLevel(LLViewerTexture::BOOST_UI); - } -} - -// static -void DOFloaterHex::assetCallback(LLVFS *vfs, - const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status) -{ - - LLInventoryBackup::callbackdata* data = static_cast(user_data); - DOFloaterHex* floater = (DOFloaterHex*)(data->floater); - if(!floater) return; - if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash - LLInventoryItem* item = data->item; - - if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD) - { - floater->childSetText("status_text", std::string("Unable to download asset.")); - return; - } - - // Todo: this doesn't work for static vfs shit - LLVFile file(vfs, asset_uuid, type, LLVFile::READ); - S32 size = file.getSize(); - - char* buffer = new char[size]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - file.read((U8*)buffer, size); - - std::vector new_data; - for(S32 i = 0; i < size; i++) - new_data.push_back(buffer[i]); - - delete[] buffer; - - floater->mEditor->setValue(new_data); - floater->mEditor->setVisible(TRUE); - floater->childSetText("status_text", std::string("")); - - floater->childSetEnabled("upload_btn", true); - floater->childSetEnabled("save_btn", false); - if(item->getPermissions().allowModifyBy(gAgent.getID())) - { - switch(item->getType()) - { - case LLAssetType::AT_TEXTURE: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_SOUND: - floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); - break; - case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_CALLINGCARD: - floater->childSetEnabled("upload_btn", false); - floater->childSetEnabled("save_btn", false); - break; - default: - floater->childSetEnabled("save_btn", true); - break; - } - } - else - { - switch(item->getType()) - { - case LLAssetType::AT_TEXTURE: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_SOUND: - floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); - break; - default: - break; - } - } - - // Never enable save if it's a pretend item - if(gInventory.isObjectDescendentOf(item->getUUID(), gSystemFolderRoot)) - { - floater->childSetEnabled("save_btn", false); - } -} - -// static -void DOFloaterHex::onClickUpload(void* user_data) -{ - - DOFloaterHex* floater = (DOFloaterHex*)user_data; - LLInventoryItem* item = floater->mItem; - - LLTransactionID transaction_id; - transaction_id.generate(); - LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); - - std::vector value = floater->mEditor->getValue(); - int size = value.size(); - U8* buffer = new U8[size]; - for(int i = 0; i < size; i++) - buffer[i] = value[i]; - value.clear(); - - LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); - file.setMaxSize(size); - if (!file.write(buffer, size)) - { - LLSD args; - args["ERROR_MESSAGE"] = "Couldn't write data to file"; - LLNotificationsUtil::add("ErrorMessage", args); - return; - } - delete[] buffer; - - LLAssetStorage::LLStoreAssetCallback callback = NULL; - void *fake_user_data = NULL; - - if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT - && item->getType() != LLAssetType::AT_NOTECARD) - { - upload_new_resource(transaction_id, - item->getType(), - item->getName(), - item->getDescription(), - 0, - LLFolderType::assetTypeToFolderType(item->getType()), - item->getInventoryType(), - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), - item->getName(), - callback, - sUploadAmount, - fake_user_data); - } - else // gestures and scripts, create an item first - { // AND notecards - //if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true; - create_inventory_item( gAgent.getID(), - gAgent.getSessionID(), - item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()), - LLTransactionID::tnull, - item->getName(), - fake_asset_id.asString(), - item->getType(), - item->getInventoryType(), - (LLWearableType::EType)item->getFlags(), - PERM_ITEM_UNRESTRICTED, - new NewResourceItemCallback); - } -} - -struct LLSaveInfo -{ - LLSaveInfo(DOFloaterHex* floater, LLTransactionID transaction_id) - : mFloater(floater), mTransactionID(transaction_id) - { - } - - DOFloaterHex* mFloater; - LLTransactionID mTransactionID; -}; - -// static -void DOFloaterHex::onClickSave(void* user_data) -{ - DOFloaterHex* floater = (DOFloaterHex*)user_data; - LLInventoryItem* item = floater->mItem; - - LLTransactionID transaction_id; - transaction_id.generate(); - LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); - - std::vector value = floater->mEditor->getValue(); - int size = value.size(); - U8* buffer = new U8[size]; - for(int i = 0; i < size; i++) - buffer[i] = value[i]; - value.clear(); - - LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); - file.setMaxSize(size); - if (!file.write(buffer, size)) - { - LLSD args; - args["ERROR_MESSAGE"] = "Couldn't write data to file"; - LLNotificationsUtil::add("ErrorMessage", args); - return; - } - delete[] buffer; - - - bool caps = false; - std::string url; - LLSD body; - body["item_id"] = item->getUUID(); - - switch(item->getType()) - { - case LLAssetType::AT_GESTURE: - url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory"); - caps = true; - break; - case LLAssetType::AT_LSL_TEXT: - url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); - body["target"] = "mono"; - caps = true; - break; - case LLAssetType::AT_NOTECARD: - url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory"); - caps = true; - break; - default: // wearables & notecards, Oct 12 2009 - // ONLY WEARABLES, Oct 15 2009 - floater->childSetText("status_text", std::string("Saving...")); - LLSaveInfo* info = new LLSaveInfo(floater, transaction_id); - gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info); - caps = false; - break; - } - - if(caps) - { - LLHTTPClient::post(url, body, - new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType())); - } -} - -void DOFloaterHex::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) -{ - LLSaveInfo* info = (LLSaveInfo*)user_data; - DOFloaterHex* floater = info->mFloater; - if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash - LLInventoryItem* item = floater->mItem; - - floater->childSetText("status_text", std::string("")); - - if(item && (status == 0)) - { - LLPointer new_item = new LLViewerInventoryItem(item); - new_item->setDescription(item->getDescription()); - new_item->setTransactionID(info->mTransactionID); - new_item->setAssetUUID(asset_uuid); - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - LLSD args; - args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status); - LLNotificationsUtil::add("ErrorMessage", args); - } -} - -void DOFloaterHex::onCommitColumnCount(LLUICtrl *control, void *user_data) -{ - if(control && user_data) - { - DOFloaterHex *instance = (DOFloaterHex *)user_data; - U8 columns = llclamp((U8)llfloor(control->getValue().asReal()), 0x00, 0xFF); - instance->mEditor->setColumns(columns); - gSavedSettings.setU32("HexEditorColumns", (U32)instance->mEditor->getColumns()); - instance->handleSizing(); - } -} - -void DOFloaterHex::handleSizing() -{ - // Reshape a little based on columns - S32 min_width = S32(mEditor->getSuggestedWidth(MIN_COLS)) + 20; - setResizeLimits(min_width, getMinHeight()); - if(getRect().getWidth() < min_width) - { - //LLRect rect = getRect(); - //rect.setOriginAndSize(rect.mLeft, rect.mBottom, min_width, rect.getHeight()); - //setRect(rect); - - reshape(min_width, getRect().getHeight(), FALSE); - mEditor->reshape(mEditor->getRect().getWidth(), mEditor->getRect().getHeight(), TRUE); - } -} - -void DOFloaterHex::readVFile() -{ - if(!mVFS) return; - // quick cut paste job - // Todo: this doesn't work for static vfs shit - LLVFile file(gVFS, mAssetId, mAssetType, LLVFile::READ); - if(file.getVFSThread()) - { - S32 size = file.getSize(); - - char* buffer = new char[size]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - file.read((U8*)buffer, size); - - std::vector new_data; - for(S32 i = 0; i < size; i++) - new_data.push_back(buffer[i]); - - delete[] buffer; - - mEditor->setValue(new_data); - mEditor->setVisible(TRUE); - - } - - childSetText("status_text", std::string("Editing VFile")); - - childSetEnabled("upload_btn", false); - childSetEnabled("save_btn", false); -} - -// diff --git a/indra/newview/dofloaterhex.h b/indra/newview/dofloaterhex.h deleted file mode 100644 index 62ef709d8..000000000 --- a/indra/newview/dofloaterhex.h +++ /dev/null @@ -1,51 +0,0 @@ -// - - -#ifndef LL_LLFLOATERHEX_H -#define LL_LLFLOATERHEX_H - -#include "llfloater.h" -#include "dohexeditor.h" -#include "llinventory.h" -#include "llviewertexture.h" -#include "llassettype.h" - -class DOFloaterHex -: public LLFloater -{ -public: - DOFloaterHex(LLUUID item_id, BOOL vfs=false, LLAssetType::EType asset_type = LLAssetType::AT_NONE); - static void show(LLUUID item_id, BOOL vfs=false, LLAssetType::EType asset_type = LLAssetType::AT_NONE); - BOOL postBuild(void); - void close(bool app_quitting); - static void imageCallback(BOOL success, - LLViewerFetchedTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata); - static void assetCallback(LLVFS *vfs, - const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); - static void onClickSave(void* user_data); - static void onClickUpload(void* user_data); - static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); - static void onCommitColumnCount(LLUICtrl *control, void *user_data); - void handleSizing(); - void readVFile(); - LLInventoryItem* mItem; - LLUUID mAssetId; - LLAssetType::EType mAssetType; - BOOL mVFS; - DOHexEditor* mEditor; - static std::list sInstances; -private: - virtual ~DOFloaterHex(); -protected: - static S32 sUploadAmount; -}; - -#endif -// diff --git a/indra/newview/dohexeditor.cpp b/indra/newview/dohexeditor.cpp deleted file mode 100644 index 046360785..000000000 --- a/indra/newview/dohexeditor.cpp +++ /dev/null @@ -1,1243 +0,0 @@ -/** - * @file dohexeditor.cpp - * @brief DOHexEditor Widget - * @author Day Oh - * - * $LicenseInfo:firstyear=2009&license=WTFPLV2$ - * - */ - -// -#include "llviewerprecompiledheaders.h" - -#include "linden_common.h" -#include "dohexeditor.h" -#include "llfocusmgr.h" -#include "llkeyboard.h" -#include "llclipboard.h" -#include "lllocalcliprect.h" -#include "llwindow.h" // setCursor -#include "lllocalinventory.h" - -static LLRegisterWidget r("hex_editor"); - -DOHexEditor::DOHexEditor(const std::string& name, const LLRect& rect) -: LLUICtrl(name, rect, TRUE, NULL, NULL), - LLEditMenuHandler(), - mColumns(16), - mCursorPos(0), - mSecondNibble(FALSE), - mSelecting(FALSE), - mHasSelection(FALSE), - mInData(FALSE), - mSelectionStart(0), - mSelectionEnd(0) -{ - mGLFont = LLFontGL::getFontMonospace(); - - mTextRect.setOriginAndSize( - 5, // border + padding - 1, // border - getRect().getWidth() - SCROLLBAR_SIZE - 6, - getRect().getHeight() - 5); - - S32 line_height = llround( mGLFont->getLineHeight() ); - S32 page_size = mTextRect.getHeight() / line_height; - - // Init the scrollbar - LLRect scroll_rect; - scroll_rect.setOriginAndSize( - getRect().getWidth() - SCROLLBAR_SIZE, - 1, - SCROLLBAR_SIZE, - getRect().getHeight() - 1); - S32 lines_in_doc = getLineCount(); - mScrollbar = new LLScrollbar( std::string("Scrollbar"), scroll_rect, - LLScrollbar::VERTICAL, - lines_in_doc, - 0, - page_size, - NULL, this ); - mScrollbar->setFollowsRight(); - mScrollbar->setFollowsTop(); - mScrollbar->setFollowsBottom(); - mScrollbar->setEnabled( TRUE ); - mScrollbar->setVisible( TRUE ); - mScrollbar->setOnScrollEndCallback(NULL, NULL); - addChild(mScrollbar); - - mBorder = new LLViewBorder( std::string("text ed border"), - LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), - LLViewBorder::BEVEL_IN, - LLViewBorder::STYLE_LINE, - 1 ); // border width - addChild( mBorder ); - - changedLength(); - - mUndoBuffer = new LLUndoBuffer(DOUndoHex::create, 128); -} - -DOHexEditor::~DOHexEditor() -{ - gFocusMgr.releaseFocusIfNeeded(this); -} - -LLView* DOHexEditor::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory) -{ - std::string name("text_editor"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - DOHexEditor* editor = new DOHexEditor(name, rect); - - editor->initFromXML(node, parent); - - return editor; -} - -void DOHexEditor::setValue(const LLSD& value) -{ - mValue = value.asBinary(); - changedLength(); -} - -LLSD DOHexEditor::getValue() const -{ - return LLSD(mValue); -} - -void DOHexEditor::setColumns(U8 columns) -{ - //mColumns = columns; - mColumns = llclamp(llfloor(columns), 8, 64); //clamp this ffs - changedLength(); -} - -U32 DOHexEditor::getLineCount() -{ - U32 lines = mValue.size(); - lines /= mColumns; - lines++; // incomplete or extra line at bottom - return lines; -} - -void DOHexEditor::getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble) -{ - pos = 0; - - F32 line_height = mGLFont->getLineHeight(); - F32 char_width = mGLFont->getWidthF32("."); - F32 data_column_width = char_width * 3; // " 00"; - F32 text_x = mTextRect.mLeft; - F32 text_x_data = text_x + (char_width * 10.1f); // "00000000 ", dunno why it's a fraction off - F32 text_x_ascii = text_x_data + (data_column_width * mColumns) + (char_width * 2); - F32 text_y = (F32)(mTextRect.mTop - line_height); - U32 first_line = mScrollbar->getDocPos(); - //U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - S32 first_line_y = text_y - line_height; - - S32 ly = -(y - first_line_y); // negative vector from first line to y - ly -= 5; // slight skew - S32 line = ly / line_height; - if(line < 0) line = 0; - line += first_line; - - if(!force_context) - { - in_data = (x < (text_x_ascii - char_width)); // char width for less annoying - } - S32 lx = x; - S32 offset; - if(in_data) - { - lx -= char_width; // subtracting char width because idk - lx -= text_x_data; - offset = lx / data_column_width; - - // Now, which character - S32 rem = S32( (F32)lx - (data_column_width * offset) - (char_width * 0.25) ); - if(rem > 0) - { - if(rem > char_width) - { - offset++; // next byte - second_nibble = FALSE; - } - else second_nibble = TRUE; - } - else second_nibble = FALSE; - } - else - { - second_nibble = FALSE; - lx += char_width; // adding char width because idk - lx -= text_x_ascii; - offset = lx / char_width; - } - if(offset < 0) offset = 0; - if(offset >= mColumns)//offset = mColumns - 1; - { - offset = 0; - line++; - second_nibble = FALSE; - } - - pos = (line * mColumns) + offset; - if(pos < 0) pos = 0; - if(pos > mValue.size()) pos = mValue.size(); - if(pos == mValue.size()) - { - second_nibble = FALSE; - } -} - -void DOHexEditor::changedLength() -{ - S32 line_height = llround( mGLFont->getLineHeight() ); - S32 page_size = mTextRect.getHeight() / line_height; - page_size -= 2; // don't count the spacer and header - - mScrollbar->setDocSize(getLineCount()); - mScrollbar->setPageSize(page_size); - - moveCursor(mCursorPos, mSecondNibble); // cursor was off end after undo of paste -} - -void DOHexEditor::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLView::reshape( width, height, called_from_parent ); - mTextRect.setOriginAndSize( - 5, // border + padding - 1, // border - getRect().getWidth() - SCROLLBAR_SIZE - 6, - getRect().getHeight() - 5); - LLRect scrollrect; - scrollrect.setOriginAndSize( - getRect().getWidth() - SCROLLBAR_SIZE, - 1, - SCROLLBAR_SIZE, - getRect().getHeight() - 1); - mScrollbar->setRect(scrollrect); - mBorder->setRect(LLRect(0, getRect().getHeight(), getRect().getWidth(), 0)); - changedLength(); -} - -void DOHexEditor::setFocus(BOOL b) -{ - if(b) - { - LLEditMenuHandler::gEditMenuHandler = this; - } - else - { - mSelecting = FALSE; - gFocusMgr.releaseFocusIfNeeded(this); - if(gEditMenuHandler == this) - { - gEditMenuHandler = NULL; - } - } - LLUICtrl::setFocus(b); -} - -F32 DOHexEditor::getSuggestedWidth(U8 cols) -{ - cols = cols>1?cols:mColumns; - F32 char_width = mGLFont->getWidthF32("."); - F32 data_column_width = char_width * 3; // " 00"; - F32 text_x = mTextRect.mLeft; - F32 text_x_data = text_x + (char_width * 10.1f); // "00000000 ", dunno why it's a fraction off - F32 text_x_ascii = text_x_data + (data_column_width * cols) + (char_width * 2); - F32 suggested_width = text_x_ascii + (char_width * cols); - suggested_width += mScrollbar->getRect().getWidth(); - suggested_width += 10.0f; - return suggested_width; -} - -U32 DOHexEditor::getProperSelectionStart() -{ - return (mSelectionStart < mSelectionEnd) ? mSelectionStart : mSelectionEnd; -} - -U32 DOHexEditor::getProperSelectionEnd() -{ - return (mSelectionStart < mSelectionEnd) ? mSelectionEnd : mSelectionStart; -} - -BOOL DOHexEditor::handleScrollWheel(S32 x, S32 y, S32 clicks) -{ - mScrollbar->handleScrollWheel( 0, 0, clicks ); - return TRUE; -} - -BOOL DOHexEditor::handleMouseDown(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; - if(!handled) - { - setFocus(TRUE); - gFocusMgr.setMouseCapture(this); - handled = TRUE; - if(!mSelecting) - { - if(mask & MASK_SHIFT) - { - // extend a selection - getPosAndContext(x, y, FALSE, mCursorPos, mInData, mSecondNibble); - mSelectionEnd = mCursorPos; - mHasSelection = (mSelectionStart != mSelectionEnd); - mSelecting = TRUE; - } - else - { - // start selecting - getPosAndContext(x, y, FALSE, mCursorPos, mInData, mSecondNibble); - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - mHasSelection = FALSE; - mSelecting = TRUE; - } - } - } - return handled; -} - -BOOL DOHexEditor::handleHover(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - if(!hasMouseCapture()) - { - handled = childrenHandleHover(x, y, mask) != NULL; - } - if(!handled && mSelecting && hasMouseCapture()) - { - // continuation of selecting - getPosAndContext(x, y, TRUE, mCursorPos, mInData, mSecondNibble); - mSelectionEnd = mCursorPos; - mHasSelection = (mSelectionStart != mSelectionEnd); - handled = TRUE; - } - return handled; -} - -BOOL DOHexEditor::handleMouseUp(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL; - if(!handled && mSelecting && hasMouseCapture()) - { - gFocusMgr.setMouseCapture(NULL); - mSelecting = FALSE; - } - return handled; -} - -BOOL DOHexEditor::handleKeyHere(KEY key, MASK mask) -{ - return FALSE; -} - -BOOL DOHexEditor::handleKey(KEY key, MASK mask, BOOL called_from_parent) -{ - BOOL handled = FALSE; - - BOOL moved_cursor = FALSE; - U32 old_cursor = mCursorPos; - U32 cursor_line = mCursorPos / mColumns; - U32 doc_first_line = 0; - U32 doc_last_line = mValue.size() / mColumns; - //U32 first_line = mScrollbar->getDocPos(); - //U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - U32 beginning_of_line = mCursorPos - (mCursorPos % mColumns); - U32 end_of_line = beginning_of_line + mColumns - 1; - - handled = TRUE; - switch( key ) - { - - // Movement keys - - case KEY_UP: - if(cursor_line > doc_first_line) - { - moveCursor(mCursorPos - mColumns, mSecondNibble); - moved_cursor = TRUE; - } - break; - case KEY_DOWN: - if(cursor_line < doc_last_line) - { - moveCursor(mCursorPos + mColumns, mSecondNibble); - moved_cursor = TRUE; - } - break; - case KEY_LEFT: - if(mCursorPos) - { - if(!mSecondNibble) moveCursor(mCursorPos - 1, FALSE); - else moveCursor(mCursorPos, FALSE); - moved_cursor = TRUE; - } - break; - case KEY_RIGHT: - moveCursor(mCursorPos + 1, FALSE); - moved_cursor = TRUE; - break; - case KEY_PAGE_UP: - mScrollbar->pageUp(1); - break; - case KEY_PAGE_DOWN: - mScrollbar->pageDown(1); - break; - case KEY_HOME: - if(mask & MASK_CONTROL) - moveCursor(0, FALSE); - else - moveCursor(beginning_of_line, FALSE); - moved_cursor = TRUE; - break; - case KEY_END: - if(mask & MASK_CONTROL) - moveCursor(mValue.size(), FALSE); - else - moveCursor(end_of_line, FALSE); - moved_cursor = TRUE; - break; - - // Special - - case KEY_INSERT: - gKeyboard->toggleInsertMode(); - break; - - case KEY_ESCAPE: - gFocusMgr.releaseFocusIfNeeded(this); - break; - - // Editing - case KEY_BACKSPACE: - if(mHasSelection) - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - del(start, end - 1, TRUE); - moveCursor(start, FALSE); - } - else if(mCursorPos && (!mSecondNibble)) - { - del(mCursorPos - 1, mCursorPos - 1, TRUE); - moveCursor(mCursorPos - 1, FALSE); - } - break; - - case KEY_DELETE: - if(mHasSelection) - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - del(start, end - 1, TRUE); - moveCursor(start, FALSE); - } - else if((mCursorPos != mValue.size()) && (!mSecondNibble)) - { - del(mCursorPos, mCursorPos, TRUE); - } - break; - - default: - handled = FALSE; - break; - } - - if(moved_cursor) - { - // Selecting and deselecting - if(mask & MASK_SHIFT) - { - if(!mHasSelection) mSelectionStart = old_cursor; - mSelectionEnd = mCursorPos; - } - else - { - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - } - mHasSelection = mSelectionStart != mSelectionEnd; - } - - return handled; -} - -BOOL DOHexEditor::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) -{ - U8 c = uni_char & 0xff; - if(mInData) - { - if(c > 0x39) - { - if(c > 0x46) c -= 0x20; - if(c >= 0x41 && c <= 0x46) c = (c & 0x0f) + 0x09; - else return TRUE; - } - else if(c < 0x30) return TRUE; - else c &= 0x0f; - } - - if(uni_char < 0x20) return FALSE; - - if( (LL_KIM_INSERT == gKeyboard->getInsertMode() && (!mHasSelection)) - || (!mHasSelection && (mCursorPos == mValue.size())) )// last byte? always insert - { - // Todo: this should overwrite if there's a selection - if(!mInData) - { - std::vector new_data; - new_data.push_back(c); - insert(mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - else if(!mSecondNibble) - { - c <<= 4; - std::vector new_data; - new_data.push_back(c); - insert(mCursorPos, new_data, TRUE); - moveCursor(mCursorPos, TRUE); - } - else - { - c |= (mValue[mCursorPos] & 0xF0); - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - } - else // overwrite mode - { - if(mHasSelection) - { - if(mInData) c <<= 4; - std::vector new_data; - new_data.push_back(c); - U8 start = getProperSelectionStart(); - overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE); - if(mInData) moveCursor(start, TRUE); // we only entered a nibble - else moveCursor(start + 1, FALSE); // we only entered a byte - } - else if(!mInData) - { - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - else if(!mSecondNibble) - { - c <<= 4; - c |= (mValue[mCursorPos] & 0x0F); - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos, TRUE); - } - else - { - c |= (mValue[mCursorPos] & 0xF0); - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - } - - return TRUE; -} - -BOOL DOHexEditor::handleUnicodeCharHere(llwchar uni_char) -{ - return FALSE; -} - -void DOHexEditor::draw() -{ - S32 left = 0; - S32 top = getRect().getHeight(); - S32 right = getRect().getWidth(); - S32 bottom = 0; - - BOOL has_focus = gFocusMgr.getKeyboardFocus() == this; - - F32 line_height = mGLFont->getLineHeight(); - F32 char_width = mGLFont->getWidthF32("."); - F32 data_column_width = char_width * 3; // " 00"; - F32 text_x = mTextRect.mLeft; - F32 text_x_data = text_x + (char_width * 10.1f); // "00000000 ", dunno why it's a fraction off -#ifdef COLUMN_SPAN - mColumns = (right - char_width * 2 - text_x_data - mScrollbar->getRect().getWidth()) / (char_width * 4); // touch this if you dare... -#endif - F32 text_x_ascii = text_x_data + (data_column_width * mColumns) + (char_width * 2); - F32 text_y = (F32)(mTextRect.mTop - line_height); - - U32 data_length = mValue.size(); - U32 line_count = getLineCount(); - U32 first_line = mScrollbar->getDocPos(); - U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - - LLRect clip(getRect()); - clip.mRight = mScrollbar->getRect().mRight; - clip.mLeft -= 10; - clip.mBottom -= 10; - LLLocalClipRect bgclip(clip); - - // Background - gl_rect_2d(left, top, right, bottom, LLColor4::white); - - // Let's try drawing some helpful guides - LLColor4 guide_color_light = LLColor4(1.0f, 1.0f, 0.9f); - LLColor4 guide_color_dark = LLColor4(1.0f, 1.0f, 0.8f); - for(U32 col = 0; col < mColumns; col += 2) - { - // Behind hex - F32 box_left = text_x_data + (col * data_column_width) + 2; // skew 2 - F32 box_right = box_left + data_column_width; - gl_rect_2d(box_left, top, box_right, bottom, (col & 3) ? guide_color_light : guide_color_dark); - // Behind ASCII - //box_left = text_x_ascii + (col * char_width) - 1; // skew 1 - //box_right = box_left + char_width; - //gl_rect_2d(box_left, top, box_right, bottom, guide_color); - } - - - // Scrollbar & border (drawn twice?) - mBorder->setKeyboardFocusHighlight(has_focus); - LLView::draw(); - - - LLLocalClipRect textrect_clip(mTextRect); - - - // Selection stuff is reused - U32 selection_start = getProperSelectionStart(); - U32 selection_end = getProperSelectionEnd(); - U32 selection_first_line = selection_start / mColumns; - U32 selection_last_line = selection_end / mColumns; - U32 selection_start_column = selection_start % mColumns; - U32 selection_end_column = selection_end % mColumns; - - // Don't pretend a selection there is visible - if(!selection_end_column) - { - selection_last_line--; - selection_end_column = mColumns; - } - - if(mHasSelection) - { - LLColor4 selection_color_context(LLColor4::black); - LLColor4 selection_color_not_context(LLColor4::grey3); - LLColor4 selection_color_data(selection_color_not_context); - LLColor4 selection_color_ascii(selection_color_not_context); - if(mInData) selection_color_data = selection_color_context; - else selection_color_ascii = selection_color_context; - - - // Setup for selection in data - F32 selection_pixel_x_base = text_x_data + char_width - 3; // skew 3 - F32 selection_pixel_x_right_base = selection_pixel_x_base + (data_column_width * mColumns) - char_width + 4; - F32 selection_pixel_x; - F32 selection_pixel_x_right; - F32 selection_pixel_y = (F32)(mTextRect.mTop - line_height) - 3; // skew 3; - selection_pixel_y -= line_height * 2; - selection_pixel_y -= line_height * (S32(selection_first_line) - S32(first_line)); - - // Selection in data, First line - if(selection_first_line >= first_line && selection_first_line <= last_line) - { - selection_pixel_x = selection_pixel_x_base; - selection_pixel_x += (data_column_width * selection_start_column); - if(selection_first_line == selection_last_line) - { - // Select to last character - selection_pixel_x_right = selection_pixel_x_base + (data_column_width * selection_end_column); - selection_pixel_x_right -= (char_width - 4); - } - else - { - // Select to end of line - selection_pixel_x_right = selection_pixel_x_right_base; - } - gl_rect_2d(selection_pixel_x, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_data); - } - - // Selection in data, Middle lines - for(U32 line = selection_first_line + 1; line < selection_last_line; line++) - { - selection_pixel_y -= line_height; - if(line >= first_line && line <= last_line) - { - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right_base, selection_pixel_y, selection_color_data); - } - } - - // Selection in data, Last line - if(selection_first_line != selection_last_line - && selection_last_line >= first_line && selection_last_line <= last_line) - { - selection_pixel_x_right = selection_pixel_x_base + (data_column_width * selection_end_column); - selection_pixel_x_right -= (char_width - 4); - selection_pixel_y -= line_height; - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_data); - } - - selection_pixel_y = (F32)(mTextRect.mTop - line_height) - 3; // skew 3; - selection_pixel_y -= line_height * 2; - selection_pixel_y -= line_height * (S32(selection_first_line) - S32(first_line)); - - // Setup for selection in ASCII - selection_pixel_x_base = text_x_ascii - 1; - selection_pixel_x_right_base = selection_pixel_x_base + (char_width * mColumns); - - // Selection in ASCII, First line - if(selection_first_line >= first_line && selection_first_line <= last_line) - { - selection_pixel_x = selection_pixel_x_base; - selection_pixel_x += (char_width * selection_start_column); - if(selection_first_line == selection_last_line) - { - // Select to last character - selection_pixel_x_right = selection_pixel_x_base + (char_width * selection_end_column); - } - else - { - // Select to end of line - selection_pixel_x_right = selection_pixel_x_right_base; - } - gl_rect_2d(selection_pixel_x, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_ascii); - } - - // Selection in ASCII, Middle lines - for(U32 line = selection_first_line + 1; line < selection_last_line; line++) - { - selection_pixel_y -= line_height; - if(line >= first_line && line <= last_line) - { - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right_base, selection_pixel_y, selection_color_ascii); - } - } - - // Selection in ASCII, Last line - if(selection_first_line != selection_last_line - && selection_last_line >= first_line && selection_last_line <= last_line) - { - selection_pixel_x_right = selection_pixel_x_base + (char_width * selection_end_column); - selection_pixel_y -= line_height; - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_ascii); - } - } - - - // Insert/Overwrite - std::string text = (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) ? "OVERWRITE" : "INSERT"; - mGLFont->renderUTF8(text, 0, text_x, text_y, LLColor4::purple); - // Offset on top - text = ""; - for(U32 i = 0; i < mColumns; i++) - { - text.append(llformat(" %02X", i)); - } - mGLFont->renderUTF8(text, 0, text_x_data, text_y, LLColor4::blue); - // Size - { - S32 size = mValue.size(); - std::string size_desc; - if(size < 1000) size_desc = llformat("%d bytes", size); - else - { - if(size < 1000000) - { - size_desc = llformat("%f", F32(size) / 1000.0f); - int i = size_desc.length() - 1; - for(; i && size_desc.substr(i, 1) == "0"; i--); - if(size_desc.substr(i, 1) == ".") i--; - size_desc = size_desc.substr(0, i + 1); - size_desc.append(" KB"); - } - else - { - size_desc = llformat("%f", F32(size) / 1000000.0f); - int i = size_desc.length() - 1; - for(; i && size_desc.substr(i, 1) == "0"; i--); - if(size_desc.substr(i, 1) == ".") i--; - size_desc = size_desc.substr(0, i + 1); - size_desc.append(" MB"); - } - } - F32 x = text_x_ascii; - x += (char_width * (mColumns - size_desc.length())); - mGLFont->renderUTF8(size_desc, 0, x, text_y, LLColor4::purple); - } - // Leave a blank line - text_y -= (line_height * 2); - - // Everything below "header" - for(U32 line = first_line; line <= last_line; line++) - { - if(line >= line_count) break; - - // Offset on left - text = llformat("%08X", line * mColumns); // offset on left - mGLFont->renderUTF8(text, 0, text_x, text_y, LLColor4::blue); - - // Setup for rendering hex and ascii - U32 line_char_offset = mColumns * line; - U32 colstart0 = 0; - U32 colend0 = mColumns; - U32 colstart1 = mColumns; - U32 colend1 = mColumns; - U32 colstart2 = mColumns; - U32 colend2 = mColumns; - if(mHasSelection) - { - if(line == selection_first_line) - { - colend0 = selection_start_column; - colstart1 = selection_start_column; - if(selection_first_line == selection_last_line) - { - colend1 = selection_end_column; - colstart2 = selection_end_column; - colend2 = mColumns; - } - } - else if(line > selection_first_line && line < selection_last_line) - { - colend0 = 0; - colstart1 = 0; - colend1 = mColumns; - } - else if(line == selection_last_line) - { - colend0 = 0; - colstart1 = 0; - colend1 = selection_end_column; - colstart2 = selection_end_column; - colend2 = mColumns; - } - } - - // Data in hex - text = ""; - for(U32 c = colstart0; c < colend0; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) text.append(" "); - else text.append(llformat(" %02X", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_data + (colstart0 * data_column_width), text_y, LLColor4::black); - text = ""; - for(U32 c = colstart1; c < colend1; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) text.append(" "); - else text.append(llformat(" %02X", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_data + (colstart1 * data_column_width), text_y, LLColor4::white); - text = ""; - for(U32 c = colstart2; c < colend2; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) text.append(" "); - else text.append(llformat(" %02X", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_data + (colstart2 * data_column_width), text_y, LLColor4::black); - - // ASCII - text = ""; - for(U32 c = colstart0; c < colend0; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) break; - if((mValue[o] < 0x20) || (mValue[o] >= 0x7F)) text.append("."); - else text.append(llformat("%c", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_ascii + (colstart0 * char_width), text_y, LLColor4::black); - text = ""; - for(U32 c = colstart1; c < colend1; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) break; - if((mValue[o] < 0x20) || (mValue[o] >= 0x7F)) text.append("."); - else text.append(llformat("%c", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_ascii + (colstart1 * char_width), text_y, LLColor4::white); - text = ""; - for(U32 c = colstart2; c < colend2; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) break; - if((mValue[o] < 0x20) || (mValue[o] >= 0x7F)) text.append("."); - else text.append(llformat("%c", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_ascii + (colstart2 * char_width), text_y, LLColor4::black); - - text_y -= line_height; - } - - - - // Cursor - if(has_focus && !mHasSelection && (U32(LLTimer::getElapsedSeconds() * 2.0f) & 0x1)) - { - U32 cursor_line = mCursorPos / mColumns; - if((cursor_line >= first_line) && (cursor_line <= last_line)) - { - F32 pixel_y = (F32)(mTextRect.mTop - line_height); - pixel_y -= line_height * (2 + (cursor_line - first_line)); - - U32 cursor_offset = mCursorPos % mColumns; // bytes - F32 pixel_x = mInData ? text_x_data : text_x_ascii; - if(mInData) - { - pixel_x += data_column_width * cursor_offset; - pixel_x += char_width; - if(mSecondNibble) pixel_x += char_width; - } - else - { - pixel_x += char_width * cursor_offset; - } - pixel_x -= 2.0f; - pixel_y -= 2.0f; - gl_rect_2d(pixel_x, pixel_y + line_height, pixel_x + 2, pixel_y, LLColor4::black); - } - } -} - -void DOHexEditor::deselect() -{ - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - mHasSelection = FALSE; - mSelecting = FALSE; -} - -BOOL DOHexEditor::canUndo() const -{ - return mUndoBuffer->canUndo(); -} - -void DOHexEditor::undo() -{ - mUndoBuffer->undoAction(); -} - -BOOL DOHexEditor::canRedo() const -{ - return mUndoBuffer->canRedo(); -} - -void DOHexEditor::redo() -{ - mUndoBuffer->redoAction(); -} - - - - -void DOHexEditor::moveCursor(U32 pos, BOOL second_nibble) -{ - mCursorPos = pos; - - // Clamp and handle second nibble - if(mCursorPos >= mValue.size()) - { - mCursorPos = mValue.size(); - mSecondNibble = FALSE; - } - else - { - mSecondNibble = mInData ? second_nibble : FALSE; - } - - // Change selection - mSelectionEnd = mCursorPos; - if(!mHasSelection) mSelectionStart = mCursorPos; - - // Scroll - U32 line = mCursorPos / mColumns; - U32 first_line = mScrollbar->getDocPos(); - U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - if(line < first_line) mScrollbar->setDocPos(line); - if(line > (last_line - 2)) mScrollbar->setDocPos(line - mScrollbar->getPageSize() + 1); -} - -BOOL DOHexEditor::canCut() const -{ - return mHasSelection; -} - -void DOHexEditor::cut() -{ - if(!canCut()) return; - - copy(); - - U32 start = getProperSelectionStart(); - del(start, getProperSelectionEnd() - 1, TRUE); - - moveCursor(start, FALSE); -} - -BOOL DOHexEditor::canCopy() const -{ - return mHasSelection; -} - -void DOHexEditor::copy() -{ - if(!canCopy()) return; - - std::string text; - if(mInData) - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - for(U32 i = start; i < end; i++) - text.append(llformat("%02X", mValue[i])); - } - else - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - for(U32 i = start; i < end; i++) - text.append(llformat("%c", mValue[i])); - } - LLWString wtext = utf8str_to_wstring(text); - gClipboard.copyFromSubstring(wtext, 0, wtext.length()); -} - -BOOL DOHexEditor::canPaste() const -{ - return TRUE; -} - -void DOHexEditor::paste() -{ - if(!canPaste()) return; - - std::string clipstr = wstring_to_utf8str(gClipboard.getPasteWString()); - const char* clip = clipstr.c_str(); - - std::vector new_data; - if(mInData) - { - int len = strlen(clip); - for(int i = 0; (i + 1) < len; i += 2) - { - int c = 0; - if(sscanf(&(clip[i]), "%02X", &c) != 1) break; - new_data.push_back(U8(c)); - } - } - else - { - int len = strlen(clip); - for(int i = 0; i < len; i++) - { - U8 c = 0; - if(sscanf(&(clip[i]), "%c", &c) != 1) break; - new_data.push_back(c); - } - } - - U32 start = mCursorPos; - if(!mHasSelection) - insert(start, new_data, TRUE); - else - { - start = getProperSelectionStart(); - overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE); - } - - moveCursor(start + new_data.size(), FALSE); -} - -BOOL DOHexEditor::canDoDelete() const -{ - return mValue.size() > 0; -} - -void DOHexEditor::doDelete() -{ - if(!canDoDelete()) return; - - U32 start = getProperSelectionStart(); - del(start, getProperSelectionEnd(), TRUE); - - moveCursor(start, FALSE); -} - -BOOL DOHexEditor::canSelectAll() const -{ - return mValue.size() > 0; -} - -void DOHexEditor::selectAll() -{ - if(!canSelectAll()) return; - - mSelectionStart = 0; - mSelectionEnd = mValue.size(); - mHasSelection = mSelectionStart != mSelectionEnd; -} - -BOOL DOHexEditor::canDeselect() const -{ - return mHasSelection; -} - -void DOHexEditor::insert(U32 pos, std::vector new_data, BOOL undoable) -{ - if(pos > mValue.size()) - { - llwarns << "pos outside data!" << llendl; - return; - } - - deselect(); - - if(undoable) - { - DOUndoHex* action = (DOUndoHex*)(mUndoBuffer->getNextAction()); - action->set(this, &(DOUndoHex::undoInsert), &(DOUndoHex::redoInsert), pos, pos, std::vector(), new_data); - } - - std::vector::iterator wheres = mValue.begin() + pos; - - mValue.insert(wheres, new_data.begin(), new_data.end()); - - changedLength(); -} - -void DOHexEditor::overwrite(U32 first_pos, U32 last_pos, std::vector new_data, BOOL undoable) -{ - if(first_pos > mValue.size() || last_pos > mValue.size()) - { - llwarns << "pos outside data!" << llendl; - return; - } - - deselect(); - - std::vector::iterator first = mValue.begin() + first_pos; - std::vector::iterator last = mValue.begin() + last_pos; - - std::vector old_data; - if(last_pos > 0) old_data = std::vector(first, last + 1); - - if(undoable) - { - DOUndoHex* action = (DOUndoHex*)(mUndoBuffer->getNextAction()); - action->set(this, &(DOUndoHex::undoOverwrite), &(DOUndoHex::redoOverwrite), first_pos, last_pos, old_data, new_data); - } - - mValue.erase(first, last + 1); - first = mValue.begin() + first_pos; - mValue.insert(first, new_data.begin(), new_data.end()); - - changedLength(); -} - -void DOHexEditor::del(U32 first_pos, U32 last_pos, BOOL undoable) -{ - if(first_pos > mValue.size() || last_pos > mValue.size()) - { - llwarns << "pos outside data!" << llendl; - return; - } - - deselect(); - - std::vector::iterator first = mValue.begin() + first_pos; - std::vector::iterator last = mValue.begin() + last_pos; - - std::vector old_data; - if(last_pos > 0) old_data = std::vector(first, last + 1); - - if(undoable) - { - DOUndoHex* action = (DOUndoHex*)(mUndoBuffer->getNextAction()); - action->set(this, &(DOUndoHex::undoDel), &(DOUndoHex::redoDel), first_pos, last_pos, old_data, std::vector()); - } - - mValue.erase(first, last + 1); - - changedLength(); -} - -void DOUndoHex::set(DOHexEditor* hex_editor, - void (*undo_action)(DOUndoHex*), - void (*redo_action)(DOUndoHex*), - U32 first_pos, - U32 last_pos, - std::vector old_data, - std::vector new_data) -{ - mHexEditor = hex_editor; - mUndoAction = undo_action; - mRedoAction = redo_action; - mFirstPos = first_pos; - mLastPos = last_pos; - mOldData = old_data; - mNewData = new_data; -} - -void DOUndoHex::undo() -{ - mUndoAction(this); -} - -void DOUndoHex::redo() -{ - mRedoAction(this); -} - -void DOUndoHex::undoInsert(DOUndoHex* action) -{ - //action->mHexEditor->del(action->mFirstPos, action->mLastPos, FALSE); - action->mHexEditor->del(action->mFirstPos, action->mFirstPos + action->mNewData.size() - 1, FALSE); -} - -void DOUndoHex::redoInsert(DOUndoHex* action) -{ - action->mHexEditor->insert(action->mFirstPos, action->mNewData, FALSE); -} - -void DOUndoHex::undoOverwrite(DOUndoHex* action) -{ - //action->mHexEditor->overwrite(action->mFirstPos, action->mLastPos, action->mOldData, FALSE); - action->mHexEditor->overwrite(action->mFirstPos, action->mFirstPos + action->mNewData.size() - 1, action->mOldData, FALSE); -} - -void DOUndoHex::redoOverwrite(DOUndoHex* action) -{ - action->mHexEditor->overwrite(action->mFirstPos, action->mLastPos, action->mNewData, FALSE); -} - -void DOUndoHex::undoDel(DOUndoHex* action) -{ - action->mHexEditor->insert(action->mFirstPos, action->mOldData, FALSE); -} - -void DOUndoHex::redoDel(DOUndoHex* action) -{ - action->mHexEditor->del(action->mFirstPos, action->mLastPos, FALSE); -} - - -// diff --git a/indra/newview/dohexeditor.h b/indra/newview/dohexeditor.h deleted file mode 100644 index 8790d7913..000000000 --- a/indra/newview/dohexeditor.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file dohexeditor.h - * @brief DOHexEditor Widget - * @author Day Oh - * - * $LicenseInfo:firstyear=2009&license=WTFPLV2$ - * - */ - -// -#ifndef DO_DOHEXEDITOR_H -#define DO_DOHEXEDITOR_H - -#define MIN_COLS 8 -#define MAX_COLS 48 - -#ifndef COLUMN_SPAN -#define COLUMN_SPAN -#endif - -#include "lluictrl.h" -#include "llscrollbar.h" -#include "llviewborder.h" -#include "llundo.h" -#include "lleditmenuhandler.h" - -class DOHexEditor : public LLUICtrl, public LLEditMenuHandler -{ -public: - DOHexEditor(const std::string& name, const LLRect& rect); - ~DOHexEditor(); - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); - void setValue(const LLSD& value); - LLSD getValue() const; - void setColumns(U8 columns); - U8 getColumns() { return mColumns; }; - U32 getLineCount(); - F32 getSuggestedWidth(U8 cols = -1); - U32 getProperSelectionStart(); - U32 getProperSelectionEnd(); - void reshape(S32 width, S32 height, BOOL called_from_parent); - void setFocus(BOOL b); - - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleMouseUp(S32 x, S32 y, MASK mask); - - BOOL handleKeyHere(KEY key, MASK mask); - BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - BOOL handleUnicodeCharHere(llwchar uni_char); - - void draw(); - - void moveCursor(U32 pos, BOOL second_nibble); - - void insert(U32 pos, std::vector new_data, BOOL undoable); - void overwrite(U32 first_pos, U32 last_pos, std::vector new_data, BOOL undoable); - void del(U32 first_pos, U32 last_pos, BOOL undoable); - - virtual void cut(); - virtual BOOL canCut() const; - - virtual void copy(); - virtual BOOL canCopy() const; - - virtual void paste(); - virtual BOOL canPaste() const; - - virtual void doDelete(); - virtual BOOL canDoDelete() const; - - virtual void selectAll(); - virtual BOOL canSelectAll() const; - - virtual void deselect(); - virtual BOOL canDeselect() const; - - virtual void undo(); - virtual BOOL canUndo() const; - - virtual void redo(); - virtual BOOL canRedo() const; - -private: - std::vector mValue; - U8 mColumns; - - U32 mCursorPos; - BOOL mSecondNibble; - BOOL mInData; - BOOL mSelecting; - BOOL mHasSelection; - U32 mSelectionStart; - U32 mSelectionEnd; - - LLFontGL* mGLFont; - LLRect mTextRect; - LLScrollbar* mScrollbar; - LLViewBorder* mBorder; - - LLUndoBuffer* mUndoBuffer; - - void changedLength(); - void getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble); -}; - -class DOUndoHex : public LLUndoBuffer::LLUndoAction -{ -protected: - DOUndoHex() { } - DOHexEditor* mHexEditor; - U32 mFirstPos; - U32 mLastPos; - std::vector mOldData; - std::vector mNewData; -public: - static LLUndoAction* create() { return new DOUndoHex(); } - virtual void set(DOHexEditor* hex_editor, - void (*undo_action)(DOUndoHex*), - void (*redo_action)(DOUndoHex*), - U32 first_pos, - U32 last_pos, - std::vector old_data, - std::vector new_data); - void (*mUndoAction)(DOUndoHex*); - void (*mRedoAction)(DOUndoHex*); - virtual void undo(); - virtual void redo(); - - static void undoInsert(DOUndoHex* action); - static void redoInsert(DOUndoHex* action); - static void undoOverwrite(DOUndoHex* action); - static void redoOverwrite(DOUndoHex* action); - static void undoDel(DOUndoHex* action); - static void redoDel(DOUndoHex* action); -}; - -class DOHexInsert : public DOUndoHex -{ - virtual void undo(); - virtual void redo(); -}; - -class DOHexOverwrite : public DOUndoHex -{ - virtual void undo(); - virtual void redo(); -}; - -class DOHexDel : public DOUndoHex -{ - virtual void undo(); - virtual void redo(); -}; - -#endif -// diff --git a/indra/newview/dsaparam.cpp b/indra/newview/dsaparam.cpp deleted file mode 100644 index c7720e61e..000000000 --- a/indra/newview/dsaparam.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Generated using openssl */ -#include "llviewerprecompiledheaders.h" -#include - -static unsigned char dsa2048_p[]={ - 0xD4,0x63,0x93,0xFA,0x69,0x87,0xDB,0x60,0x68,0xFB,0xCC,0x8F, - 0x55,0x85,0x7A,0xAC,0xAD,0x1F,0x8E,0xF0,0x2C,0x62,0x2F,0xE6, - 0xA6,0xA4,0xF3,0x57,0x42,0xDC,0xF0,0xE0,0x0E,0xC6,0x67,0x01, - 0x95,0x22,0x6F,0x03,0x00,0x2A,0xB4,0xBF,0x62,0x6D,0xA1,0xBD, - 0xB7,0x10,0x81,0xB4,0x20,0x1C,0x7D,0x41,0x75,0xCE,0x0F,0xCF, - 0x9D,0x03,0xEC,0xE6,0x7E,0xBC,0x76,0x97,0xBC,0x5C,0x70,0xFE, - 0xD5,0x64,0x15,0x20,0xD8,0xA8,0x25,0x73,0xD4,0xA2,0x77,0x99, - 0xC7,0x3B,0xF7,0x4E,0x20,0x40,0x43,0xD7,0x7C,0xFD,0xBC,0x2F, - 0x75,0xB5,0x18,0xA3,0x8C,0x85,0x79,0x86,0x53,0x62,0x73,0xBA, - 0x66,0x73,0xE2,0x48,0x15,0xAF,0x04,0x65,0xE2,0x4D,0x15,0x47, - 0x74,0x33,0x79,0xAE,0xBF,0x90,0xC0,0xF7,0x2F,0x04,0xFB,0xEE, - 0x29,0xEC,0x42,0xC7,0x36,0x14,0xAC,0xB2,0xBC,0xE1,0x71,0x13, - 0x65,0xBA,0x0D,0x61,0x11,0x89,0x49,0x41,0x5D,0xCC,0xE2,0x72, - 0x7B,0x93,0xF2,0x2E,0xD1,0x23,0x37,0xF9,0xFF,0x55,0x59,0xF6, - 0x41,0x78,0x87,0xC9,0xCD,0x95,0xD2,0xE5,0x1B,0x3A,0x25,0x7A, - 0xD8,0x16,0x2F,0x58,0xFE,0x3B,0xD5,0xB1,0x59,0x63,0x3C,0x90, - 0xA0,0xBF,0xA0,0x21,0x54,0xB0,0xB0,0x3F,0x9D,0xC6,0xB5,0x31, - 0xBA,0x86,0xDC,0x86,0x41,0xB7,0xBA,0xCE,0x58,0x09,0x8B,0xD9, - 0xD4,0xF1,0xD2,0x3B,0x5F,0x87,0xEE,0x66,0xFD,0x77,0x8C,0x2C, - 0x66,0x3E,0xC9,0xDA,0x3E,0x2A,0x38,0x03,0x23,0x71,0xC9,0x04, - 0x3E,0x9D,0x18,0x7F,0xBB,0x82,0x21,0x8E,0x5F,0xF0,0xAF,0xC8, - 0x08,0x2D,0xA6,0x3F, - }; -static unsigned char dsa2048_q[]={ - 0xAE,0xCA,0x67,0x69,0x21,0x7A,0xE1,0x9B,0x64,0x74,0xED,0x58, - 0xF0,0x28,0xE0,0x45,0x2B,0x39,0xBC,0x79, - }; -static unsigned char dsa2048_g[]={ - 0x51,0x1D,0xB0,0xF6,0x4E,0x8B,0xAF,0x1C,0x59,0x71,0x62,0x3C, - 0xC3,0xE2,0x44,0x35,0xCE,0x11,0xB4,0x49,0x04,0x41,0xA1,0x1C, - 0x22,0x59,0x47,0x8C,0x70,0x1D,0xA1,0x0C,0x51,0xFE,0x86,0x43, - 0x7B,0x75,0x5C,0xB7,0x68,0xA5,0xBE,0x81,0x9C,0x6F,0x6D,0x32, - 0x03,0xB0,0x28,0xA4,0x6B,0x5B,0x37,0xC3,0x35,0xCF,0xBD,0x92, - 0xC3,0x66,0x2E,0xAB,0xB4,0x13,0xEC,0x23,0xA3,0xE3,0x09,0x4E, - 0x47,0x7D,0xA5,0x90,0x33,0x80,0x5D,0x68,0xD6,0x39,0x54,0xBE, - 0x35,0xB0,0x61,0x5B,0x96,0x63,0x05,0x67,0xB7,0x3C,0x21,0x17, - 0x37,0x50,0x17,0x78,0xEA,0xC0,0x10,0x73,0xDF,0xE2,0x70,0x19, - 0x17,0xF7,0x11,0x82,0x73,0xDB,0xFF,0x3E,0x8D,0x98,0x2F,0x2F, - 0xA2,0x12,0xC3,0xB4,0x08,0xB2,0x2C,0x5B,0xA3,0x51,0xAA,0x7F, - 0x3D,0xE0,0x74,0x39,0xE5,0xAF,0x81,0x32,0xF8,0x45,0x75,0x11, - 0x35,0xD9,0x90,0xA1,0xA3,0x91,0x1A,0xEE,0xE9,0xAC,0x97,0x30, - 0x4C,0xD5,0x5B,0x38,0x49,0x12,0x3B,0xCC,0x0C,0x84,0xA2,0x59, - 0x78,0xB4,0xFD,0x46,0xAC,0x49,0x43,0x08,0xDB,0xF4,0x23,0xFF, - 0x23,0xF8,0x9A,0xFD,0x15,0xAF,0x6B,0x81,0xCE,0x15,0x22,0xEF, - 0x09,0x64,0x0A,0x1F,0x4D,0x6B,0xF1,0x9F,0x16,0x00,0x3E,0xE8, - 0xFC,0x9A,0x24,0x58,0x1C,0xB4,0x5F,0x56,0x3E,0x83,0x8C,0x0C, - 0x51,0x43,0x72,0x25,0xA8,0x1D,0x08,0x30,0x7E,0x17,0xC8,0xD6, - 0x66,0x57,0x0C,0x59,0x76,0xE4,0xA6,0x0C,0x05,0xA8,0x60,0x1D, - 0xA4,0x8F,0xBC,0xC4,0x67,0x55,0x0E,0x81,0x8F,0x66,0xED,0x1B, - 0x84,0xCD,0x02,0x9F, - }; - -DSA *get_dsa2048() - { - DSA *dsa; - - if ((dsa=DSA_new()) == NULL) return(NULL); - dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL); - dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL); - dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL); - if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL)) - { DSA_free(dsa); return(NULL); } - return(dsa); - } diff --git a/indra/newview/llfloatervfsexplorer.cpp b/indra/newview/llfloatervfsexplorer.cpp index 99662b9d9..9c4030bee 100644 --- a/indra/newview/llfloatervfsexplorer.cpp +++ b/indra/newview/llfloatervfsexplorer.cpp @@ -9,7 +9,6 @@ #include "lllocalinventory.h" #include "llviewerwindow.h" #include "llassetconverter.h" -#include "dofloaterhex.h" LLFloaterVFSExplorer* LLFloaterVFSExplorer::sInstance; std::map LLFloaterVFSExplorer::sVFSFileMap; @@ -41,7 +40,6 @@ BOOL LLFloaterVFSExplorer::postBuild() childSetAction("remove_btn", onClickRemove, this); childSetAction("reload_all_btn", onClickReload, this); childSetAction("copy_uuid_btn", onClickCopyUUID, this); - childSetAction("edit_data_btn", onClickEditData, this); childSetAction("item_btn", onClickItem, this); refresh(); return TRUE; @@ -175,13 +173,6 @@ void LLFloaterVFSExplorer::onClickReload(void* user_data) floaterp->reloadAll(); } // static -void LLFloaterVFSExplorer::onClickEditData(void* user_data) -{ - LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data; - LLVFSFileSpecifier file = floaterp->getEditEntry(); - DOFloaterHex::show(file.mFileID, true, file.mFileType); -} -// static void LLFloaterVFSExplorer::onClickItem(void* user_data) { LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1995efd2c..e2f6144fb 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -113,7 +113,6 @@ #include "llfloateranimpreview.h" // for reuploads #include "llfloaterimagepreview.h" // for reuploads //#include "llcheats.h" -#include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "statemachine/aifilepicker.h" // diff --git a/indra/newview/lllocalinventory.cpp b/indra/newview/lllocalinventory.cpp index c6578ed8c..1bb9cf102 100644 --- a/indra/newview/lllocalinventory.cpp +++ b/indra/newview/lllocalinventory.cpp @@ -11,7 +11,6 @@ #include "llpreviewtexture.h" #include "llpreviewgesture.h" #include "llpreviewlandmark.h" -#include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "llappviewer.h" @@ -151,8 +150,7 @@ void LLLocalInventory::open(LLUUID item_id) } else { - llwarns << "Dunno how to open type " << type << ", falling back to hex editor" << llendl; - DOFloaterHex::show(item_id); + llwarns << "Dunno how to open type " << type << llendl; } } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 669c57d43..0135e4d1d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -245,7 +245,6 @@ #include "lltexlayer.h" // -#include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "llfloatervfs.h" #include "llfloatervfsexplorer.h" @@ -473,7 +472,6 @@ void handle_force_ground_sit(void*); void handle_phantom_avatar(void*); void handle_hide_typing_notification(void*); void handle_close_all_notifications(void*); -void handle_reopen_with_hex_editor(void*); //void handle_open_message_log(void*); void handle_edit_ao(void*); void handle_local_assets(void*); @@ -3638,11 +3636,6 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**) // -void handle_reopen_with_hex_editor(void*) -{ - -} - /*void handle_open_message_log(void*) { LLFloaterMessageLog::show(); diff --git a/indra/newview/skins/default/xui/en-us/floater_hex.xml b/indra/newview/skins/default/xui/en-us/floater_hex.xml deleted file mode 100644 index 36f02f068..000000000 --- a/indra/newview/skins/default/xui/en-us/floater_hex.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Loading... - -