diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 23 | ||||
-rw-r--r-- | indra/llui/llsdparam.cpp | 116 | ||||
-rw-r--r-- | indra/llui/llsdparam.h | 12 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lluistring.cpp | 19 | ||||
-rw-r--r-- | indra/llui/lluistring.h | 9 |
6 files changed, 128 insertions, 58 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index d4d161f2c9..9ab2cfef4b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -541,23 +541,7 @@ BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL r setNeedsSort(); break; - case ADD_SORTED: - { - // sort by column 0, in ascending order - std::vector<sort_column_t> single_sort_column; - single_sort_column.push_back(std::make_pair(0, TRUE)); - - mItemList.push_back(item); - std::stable_sort( - mItemList.begin(), - mItemList.end(), - SortScrollListItem(single_sort_column,mSortCallback)); - - // ADD_SORTED just sorts by first column... - // this might not match user sort criteria, so flag list as being in unsorted state - setNeedsSort(); - break; - } + case ADD_DEFAULT: case ADD_BOTTOM: mItemList.push_back(item); setNeedsSort(); @@ -2762,9 +2746,10 @@ LLScrollListColumn* LLScrollListCtrl::getColumn(const std::string& name) return NULL; } - +LLFastTimer::DeclareTimer FTM_ADD_SCROLLLIST_ELEMENT("Add Scroll List Item"); LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata) { + LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); LLScrollListItem::Params item_params; LLParamSDParser::instance().readSD(element, item_params); item_params.userdata = userdata; @@ -2773,12 +2758,14 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_p, EAddPosition pos) { + LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); LLScrollListItem *new_item = new LLScrollListItem(item_p); return addRow(new_item, item_p, pos); } LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& item_p, EAddPosition pos) { + LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); if (!item_p.validateBlock() || !new_item) return NULL; new_item->setNumColumns(mColumns.size()); diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 4bb45a3065..7d37127584 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -43,33 +43,16 @@ LLParamSDParser::LLParamSDParser() { using boost::bind; - registerParserFuncs<S32>(bind(&LLParamSDParser::readTypedValue<S32>, this, _1, &LLSD::asInteger), - bind(&LLParamSDParser::writeTypedValue<S32>, this, _1, _2)); - registerParserFuncs<U32>(bind(&LLParamSDParser::readTypedValue<U32>, this, _1, &LLSD::asInteger), - bind(&LLParamSDParser::writeU32Param, this, _1, _2)); - registerParserFuncs<F32>(bind(&LLParamSDParser::readTypedValue<F32>, this, _1, &LLSD::asReal), - bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); - registerParserFuncs<F64>(bind(&LLParamSDParser::readTypedValue<F64>, this, _1, &LLSD::asReal), - bind(&LLParamSDParser::writeTypedValue<F64>, this, _1, _2)); - registerParserFuncs<bool>(bind(&LLParamSDParser::readTypedValue<F32>, this, _1, &LLSD::asBoolean), - bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); - registerParserFuncs<std::string>(bind(&LLParamSDParser::readTypedValue<std::string>, this, _1, &LLSD::asString), - bind(&LLParamSDParser::writeTypedValue<std::string>, this, _1, _2)); - registerParserFuncs<LLUUID>(bind(&LLParamSDParser::readTypedValue<LLUUID>, this, _1, &LLSD::asUUID), - bind(&LLParamSDParser::writeTypedValue<LLUUID>, this, _1, _2)); - registerParserFuncs<LLDate>(bind(&LLParamSDParser::readTypedValue<LLDate>, this, _1, &LLSD::asDate), - bind(&LLParamSDParser::writeTypedValue<LLDate>, this, _1, _2)); - registerParserFuncs<LLURI>(bind(&LLParamSDParser::readTypedValue<LLURI>, this, _1, &LLSD::asURI), - bind(&LLParamSDParser::writeTypedValue<LLURI>, this, _1, _2)); - registerParserFuncs<LLSD>(bind(&LLParamSDParser::readSDParam, this, _1), - bind(&LLParamSDParser::writeTypedValue<LLSD>, this, _1, _2)); -} - -bool LLParamSDParser::readSDParam(void* value_ptr) -{ - if (!mCurReadSD) return false; - *((LLSD*)value_ptr) = *mCurReadSD; - return true; + registerParserFuncs<S32>(readS32, bind(&LLParamSDParser::writeTypedValue<S32>, this, _1, _2)); + registerParserFuncs<U32>(readU32, bind(&LLParamSDParser::writeU32Param, this, _1, _2)); + registerParserFuncs<F32>(readF32, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); + registerParserFuncs<F64>(readF64, bind(&LLParamSDParser::writeTypedValue<F64>, this, _1, _2)); + registerParserFuncs<bool>(readBool, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); + registerParserFuncs<std::string>(readString, bind(&LLParamSDParser::writeTypedValue<std::string>, this, _1, _2)); + registerParserFuncs<LLUUID>(readUUID, bind(&LLParamSDParser::writeTypedValue<LLUUID>, this, _1, _2)); + registerParserFuncs<LLDate>(readDate, bind(&LLParamSDParser::writeTypedValue<LLDate>, this, _1, _2)); + registerParserFuncs<LLURI>(readURI, bind(&LLParamSDParser::writeTypedValue<LLURI>, this, _1, _2)); + registerParserFuncs<LLSD>(readSD, bind(&LLParamSDParser::writeTypedValue<LLSD>, this, _1, _2)); } // special case handling of U32 due to ambiguous LLSD::assign overload @@ -148,3 +131,82 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) return mWriteSD; } +bool LLParamSDParser::readS32(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((S32*)val_ptr) = self.mCurReadSD->asInteger(); + return true; +} + +bool LLParamSDParser::readU32(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((U32*)val_ptr) = self.mCurReadSD->asInteger(); + return true; +} + +bool LLParamSDParser::readF32(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((F32*)val_ptr) = self.mCurReadSD->asReal(); + return true; +} + +bool LLParamSDParser::readF64(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((F64*)val_ptr) = self.mCurReadSD->asReal(); + return true; +} + +bool LLParamSDParser::readBool(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((bool*)val_ptr) = self.mCurReadSD->asBoolean(); + return true; +} + +bool LLParamSDParser::readString(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((std::string*)val_ptr) = self.mCurReadSD->asString(); + return true; +} + +bool LLParamSDParser::readUUID(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((LLUUID*)val_ptr) = self.mCurReadSD->asUUID(); + return true; +} + +bool LLParamSDParser::readDate(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((LLDate*)val_ptr) = self.mCurReadSD->asDate(); + return true; +} + +bool LLParamSDParser::readURI(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((LLURI*)val_ptr) = self.mCurReadSD->asURI(); + return true; +} + +bool LLParamSDParser::readSD(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + + *((LLSD*)val_ptr) = *self.mCurReadSD; + return true; +} diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index 12f28f876f..71b0a45630 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -79,9 +79,19 @@ private: LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack); - bool readSDParam(void* value_ptr); bool writeU32Param(const void* value_ptr, const parser_t::name_stack_t& name_stack); + static bool readS32(Parser& parser, void* val_ptr); + static bool readU32(Parser& parser, void* val_ptr); + static bool readF32(Parser& parser, void* val_ptr); + static bool readF64(Parser& parser, void* val_ptr); + static bool readBool(Parser& parser, void* val_ptr); + static bool readString(Parser& parser, void* val_ptr); + static bool readUUID(Parser& parser, void* val_ptr); + static bool readDate(Parser& parser, void* val_ptr); + static bool readURI(Parser& parser, void* val_ptr); + static bool readSD(Parser& parser, void* val_ptr); + Parser::name_stack_t mNameStack; const LLSD* mCurReadSD; LLSD* mWriteSD; diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index a46d961709..6ad104c1f4 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -99,10 +99,11 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa std::string filename = std::string("widgets") + gDirUtilp->getDirDelimiter() + widget_tag + ".xml"; LLXMLNodePtr root_node; - if (LLUICtrlFactory::getLayeredXMLNode(filename, root_node)) + std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getXUIPaths().front(), filename); + if (!full_filename.empty()) { - LLUICtrlFactory::instance().pushFileName(filename); - LLXUIParser::instance().readXUI(root_node, block, filename); + LLUICtrlFactory::instance().pushFileName(full_filename); + LLFastXUIParser::instance().readXUI(full_filename, block); LLUICtrlFactory::instance().popFileName(); } } diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index ac9e71665f..385292e792 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -40,7 +40,7 @@ LLFastTimer::DeclareTimer FTM_UI_STRING("UI String"); LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args) : mOrig(instring), - mArgs(args) + mArgs(new LLStringUtil::format_map_t(args)) { dirty(); } @@ -54,7 +54,7 @@ void LLUIString::assign(const std::string& s) void LLUIString::setArgList(const LLStringUtil::format_map_t& args) { - mArgs = args; + getArgs() = args; dirty(); } @@ -74,7 +74,7 @@ void LLUIString::setArgs(const LLSD& sd) void LLUIString::setArg(const std::string& key, const std::string& replacement) { - mArgs[key] = replacement; + getArgs()[key] = replacement; dirty(); } @@ -135,14 +135,14 @@ void LLUIString::updateResult() const mResult = mOrig; // get the defailt args + local args - if (mArgs.empty()) + if (!mArgs || mArgs->empty()) { LLStringUtil::format(mResult, LLTrans::getDefaultArgs()); } else { LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs(); - combined_args.insert(mArgs.begin(), mArgs.end()); + combined_args.insert(mArgs->begin(), mArgs->end()); LLStringUtil::format(mResult, combined_args); } } @@ -153,3 +153,12 @@ void LLUIString::updateWResult() const mWResult = utf8str_to_wstring(getUpdatedResult()); } + +LLStringUtil::format_map_t& LLUIString::getArgs() +{ + if (!mArgs) + { + mArgs = new LLStringUtil::format_map_t; + } + return *mArgs; +}
\ No newline at end of file diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 32cfc0d9cd..3f91856e26 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -64,9 +64,9 @@ class LLUIString public: // These methods all perform appropriate argument substitution // and modify mOrig where appropriate - LLUIString() : mNeedsResult(false), mNeedsWResult(false) {} + LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {} LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args); - LLUIString(const std::string& instring) { assign(instring); } + LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); } void assign(const std::string& instring); LLUIString& operator=(const std::string& s) { assign(s); return *this; } @@ -86,7 +86,7 @@ public: S32 length() const { return getUpdatedWResult().size(); } void clear(); - void clearArgs() { mArgs.clear(); } + void clearArgs() { if (mArgs) mArgs->clear(); } // These utility functions are included for text editing. // They do not affect mOrig and do not perform argument substitution @@ -105,11 +105,12 @@ private: // do actual work of updating strings (non-inlined) void updateResult() const; void updateWResult() const; + LLStringUtil::format_map_t& getArgs(); std::string mOrig; mutable std::string mResult; mutable LLWString mWResult; // for displaying - LLStringUtil::format_map_t mArgs; + LLStringUtil::format_map_t* mArgs; // controls lazy evaluation mutable bool mNeedsResult; |