From 5062351a0a2a95c3cbca27297b57afddc23d7a4f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 4 Aug 2010 19:01:18 -0700 Subject: deprecated ADD_SORTED due to n^2 behavior, set the sort order on the scroll list instead --- indra/llcommon/stdenums.h | 4 ++-- indra/llui/llscrolllistctrl.cpp | 23 +++++----------------- indra/newview/llfloatergroups.cpp | 7 ++++--- indra/newview/llfloaterland.cpp | 4 ++-- indra/newview/llfloaterlandholdings.cpp | 9 ++++----- indra/newview/llfloatermediabrowser.cpp | 3 ++- indra/newview/llfloaterpreference.cpp | 6 ++---- indra/newview/llfloaterscriptlimits.cpp | 2 +- indra/newview/llpanelgroupgeneral.cpp | 2 +- indra/newview/llpanelgrouplandmoney.cpp | 2 +- indra/newview/llpanelgrouproles.cpp | 2 +- indra/newview/llpanellogin.cpp | 3 ++- indra/newview/llpanelprimmediacontrols.cpp | 2 +- .../default/xui/en/panel_group_land_money.xml | 2 ++ .../default/xui/en/panel_preferences_alerts.xml | 4 ++++ .../xui/en/panel_script_limits_region_memory.xml | 2 ++ 16 files changed, 36 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index 1a5678dde1..e0565204d4 100644 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h @@ -119,8 +119,8 @@ enum EObjectPropertiesExtraID enum EAddPosition { ADD_TOP, - ADD_SORTED, - ADD_BOTTOM + ADD_BOTTOM, + ADD_DEFAULT }; enum LLGroupChange 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 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/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 0bd8215e5c..8558345efa 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -347,11 +347,10 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) if(self) self->enableButtons(); } -void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 powers_mask) +void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask) { S32 count = gAgent.mGroups.count(); LLUUID id; - LLCtrlListInterface *group_list = ctrl->getListInterface(); if (!group_list) return; group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); @@ -375,10 +374,12 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow element["columns"][0]["font"]["name"] = "SANSSERIF"; element["columns"][0]["font"]["style"] = style; - group_list->addElement(element, ADD_SORTED); + group_list->addElement(element); } } + group_list->sortOnce(0, TRUE); + // add "none" to list at top { std::string style = "NORMAL"; diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 625b443abc..19e28720ae 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2440,7 +2440,7 @@ void LLPanelLandAccess::refresh() suffix.append(" " + parent_floater->getString("Remaining") + ")"); } if (mListAccess) - mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); + mListAccess->addNameItem(entry.mID, ADD_DEFAULT, TRUE, suffix); } } @@ -2481,7 +2481,7 @@ void LLPanelLandAccess::refresh() } suffix.append(" " + parent_floater->getString("Remaining") + ")"); } - mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); + mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, suffix); } } diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index 3c8ee6eb9e..12d27b8790 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -75,10 +75,9 @@ BOOL LLFloaterLandHoldings::postBuild() childSetAction("Show on Map", onClickMap, this); // Grant list - getChild("grant list")->setDoubleClickCallback(onGrantList, this); - - LLCtrlListInterface *list = childGetListInterface("grant list"); - if (!list) return TRUE; + LLScrollListCtrl* grant_list = getChild("grant list"); + grant_list->sortByColumnIndex(0, TRUE); + grant_list->setDoubleClickCallback(onGrantList, this); S32 count = gAgent.mGroups.count(); for(S32 i = 0; i < count; ++i) @@ -97,7 +96,7 @@ BOOL LLFloaterLandHoldings::postBuild() element["columns"][1]["value"] = areastr; element["columns"][1]["font"] = "SANSSERIF"; - list->addElement(element, ADD_SORTED); + grant_list->addElement(element); } center(); diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 5405de2f9a..d01488b6b1 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -105,6 +105,7 @@ BOOL LLFloaterMediaBrowser::postBuild() mAddressCombo = getChild("address"); mAddressCombo->setCommitCallback(onEnterAddress, this); + mAddressCombo->sortByName(); childSetAction("back", onClickBack, this); childSetAction("forward", onClickForward, this); @@ -185,7 +186,7 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) if (mCurrentURL != "about:blank") { mAddressCombo->remove(mCurrentURL); - mAddressCombo->add(mCurrentURL, ADD_SORTED); + mAddressCombo->add(mCurrentURL); mAddressCombo->selectByValue(mCurrentURL); // Serialize url history diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7791c037d3..a4b45e04f2 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -826,13 +826,11 @@ void LLFloaterPreference::buildPopupLists() row["columns"][1]["font"] = "SANSSERIF_SMALL"; row["columns"][1]["width"] = 360; } - item = disabled_popups.addElement(row, - ADD_SORTED); + item = disabled_popups.addElement(row); } else { - item = enabled_popups.addElement(row, - ADD_SORTED); + item = enabled_popups.addElement(row); } if (item) diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index e0f646349e..e827e19f82 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -741,7 +741,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) } element["columns"][5]["font"] = "SANSSERIF"; - list->addElement(element, ADD_SORTED); + list->addElement(element); element["owner_id"] = owner_id; element["local_id"] = local_id; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 2302772803..155e000bb8 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -746,7 +746,7 @@ void LLPanelGroupGeneral::updateMembers() sSDTime += sd_timer.getElapsedTimeF32(); element_timer.reset(); - LLScrollListItem* member_row = mListVisibleMembers->addElement(row);//, ADD_SORTED); + LLScrollListItem* member_row = mListVisibleMembers->addElement(row); if ( member->isOwner() ) { diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 1404cfcea2..16d5f8140d 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -528,7 +528,7 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) row["columns"][4]["column"] = "hidden"; row["columns"][4]["value"] = hidden; - mGroupParcelsp->addElement(row, ADD_SORTED); + mGroupParcelsp->addElement(row); } } } diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 7a28d10baf..efc797cfe9 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1631,7 +1631,7 @@ void LLPanelGroupMembersSubTab::updateMembers() row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus(); row["columns"][2]["font"] = "SANSSERIF_SMALL"; - LLScrollListItem* member = mMembersList->addElement(row);//, ADD_SORTED); + LLScrollListItem* member = mMembersList->addElement(row); LLUUID id = member->getUUID(); mHasMatch = TRUE; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4b23e63f12..58ed01896a 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1110,9 +1110,10 @@ void LLPanelLogin::updateServerCombo() { if (!grid_choice->first.empty()) { - server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED); + server_choice_combo->add(grid_choice->second, grid_choice->first); } } + server_choice_combo->sortByName(); server_choice_combo->addSeparator(ADD_TOP); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 0648d99685..81e805974f 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -1171,7 +1171,7 @@ void LLPanelPrimMediaControls::setCurrentURL() // if (media_address_combo && mCurrentURL != "about:blank") // { // media_address_combo->remove(mCurrentURL); -// media_address_combo->add(mCurrentURL, ADD_SORTED); +// media_address_combo->add(mCurrentURL); // media_address_combo->selectByValue(mCurrentURL); // } #else // USE_COMBO_BOX_FOR_MEDIA_URL diff --git a/indra/newview/skins/default/xui/en/panel_group_land_money.xml b/indra/newview/skins/default/xui/en/panel_group_land_money.xml index 76f7484c68..1e1d2d18ca 100644 --- a/indra/newview/skins/default/xui/en/panel_group_land_money.xml +++ b/indra/newview/skins/default/xui/en/panel_group_land_money.xml @@ -60,6 +60,8 @@ left="0" right="-1" top="0" + sort_column="0" + sort_ascending="true" name="group_parcel_list" width="313"> will interpret as "button.rect" + // since there is no widget named "rect" + if (child_name.find(".") == std::string::npos) + { + mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); + num_tokens_pushed++; + } + else + { + // parse out "dotted" name into individual tokens + tokenizer name_tokens(child_name, sep); + + tokenizer::iterator name_token_it = name_tokens.begin(); + if(name_token_it == name_tokens.end()) + { + return; + } + + // check for proper nesting + if(!mScope.empty() && *name_token_it != mScope.back()) + { + return; + } + + // now ignore first token + ++name_token_it; + + // copy remaining tokens on to our running token list + for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) + { + mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + num_tokens_pushed++; + } + mScope.push_back(mNameStack.back().first); + } + } + else + { + mScope.push_back(name); + } + + mTokenSizeStack.push_back(num_tokens_pushed); + readAttributes(atts); +} + +bool LLFastXUIParser::readAttributes(const char **atts) +{ + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("."); + + bool any_parsed = false; + for(S32 i = 0; atts[i] && atts[i+1]; i += 2 ) + { + std::string attribute_name(atts[i]); + mCurAttributeValueBegin = atts[i+1]; + + S32 num_tokens_pushed = 0; + tokenizer name_tokens(attribute_name, sep); + // copy remaining tokens on to our running token list + for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) + { + mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + num_tokens_pushed++; + } + + // child nodes are not necessarily valid attributes, so don't complain once we've recursed + bool silent = mCurReadDepth > 1; + any_parsed |= mBlock->submitValue(mNameStack, *this, silent); + + while(num_tokens_pushed-- > 0) + { + mNameStack.pop_back(); + } + } + return any_parsed; +} + + +void LLFastXUIParser::endElement(const char *name) +{ + mCurReadDepth--; + S32 num_tokens_to_pop = mTokenSizeStack.back(); + mTokenSizeStack.pop_back(); + while(num_tokens_to_pop-- > 0) + { + mNameStack.pop_back(); + } + mScope.pop_back(); +} + +void LLFastXUIParser::characterData(const char *s, int len) +{ +} + + +/*virtual*/ std::string LLFastXUIParser::getCurrentElementName() +{ + std::string full_name; + for (name_stack_t::iterator it = mNameStack.begin(); + it != mNameStack.end(); + ++it) + { + full_name += it->first + "."; // build up dotted names: "button.param.nestedparam." + } + + return full_name; +} + +const S32 LINE_NUMBER_HERE = 0; + +void LLFastXUIParser::parserWarning(const std::string& message) +{ +#ifdef LL_WINDOWS + // use Visual Studo friendly formatting of output message for easy access to originating xml + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); +#else + Parser::parserWarning(message); +#endif +} + +void LLFastXUIParser::parserError(const std::string& message) +{ +#ifdef LL_WINDOWS + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); +#else + Parser::parserError(message); +#endif +} + +bool LLFastXUIParser::readBoolValue(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + if (!strcmp(self.mCurAttributeValueBegin, "true")) + { + *((bool*)val_ptr) = true; + return true; + } + else if (!strcmp(self.mCurAttributeValueBegin, "false")) + { + *((bool*)val_ptr) = false; + return true; + } + + return false; +} + +bool LLFastXUIParser::readStringValue(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + *((std::string*)val_ptr) = self.mCurAttributeValueBegin; + return true; +} + +bool LLFastXUIParser::readU8Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U8*)val_ptr)]).full; +} + +bool LLFastXUIParser::readS8Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S8*)val_ptr)]).full; +} + +bool LLFastXUIParser::readU16Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U16*)val_ptr)]).full; +} + +bool LLFastXUIParser::readS16Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S16*)val_ptr)]).full; +} + +bool LLFastXUIParser::readU32Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U32*)val_ptr)]).full; +} + +bool LLFastXUIParser::readS32Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S32*)val_ptr)]).full; +} + +bool LLFastXUIParser::readF32Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F32*)val_ptr)]).full; +} + +bool LLFastXUIParser::readF64Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F64*)val_ptr)]).full; +} + +bool LLFastXUIParser::readColor4Value(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + LLColor4 value; + + if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) + { + *(LLColor4*)(val_ptr) = value; + return true; + } + return false; +} + +bool LLFastXUIParser::readUIColorValue(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + LLColor4 value; + LLUIColor* colorp = (LLUIColor*)val_ptr; + + if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) + { + colorp->set(value); + return true; + } + return false; +} + +bool LLFastXUIParser::readUUIDValue(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + LLUUID temp_id; + // LLUUID::set is destructive, so use temporary value + if (temp_id.set(self.mCurAttributeValueBegin)) + { + *(LLUUID*)(val_ptr) = temp_id; + return true; + } + return false; +} + +bool LLFastXUIParser::readSDValue(Parser& parser, void* val_ptr) +{ + LLFastXUIParser& self = static_cast(parser); + *((LLSD*)val_ptr) = LLSD(self.mCurAttributeValueBegin); + return true; +} \ No newline at end of file diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 884f4f7578..4deb083e1c 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -120,26 +120,24 @@ public: void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL); private: - typedef std::list > token_list_t; - bool readXUIImpl(LLXMLNodePtr node, const std::string& scope, LLInitParam::BaseBlock& block); bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); //reader helper functions - bool readBoolValue(void* val_ptr); - bool readStringValue(void* val_ptr); - bool readU8Value(void* val_ptr); - bool readS8Value(void* val_ptr); - bool readU16Value(void* val_ptr); - bool readS16Value(void* val_ptr); - bool readU32Value(void* val_ptr); - bool readS32Value(void* val_ptr); - bool readF32Value(void* val_ptr); - bool readF64Value(void* val_ptr); - bool readColor4Value(void* val_ptr); - bool readUIColorValue(void* val_ptr); - bool readUUIDValue(void* val_ptr); - bool readSDValue(void* val_ptr); + static bool readBoolValue(Parser& parser, void* val_ptr); + static bool readStringValue(Parser& parser, void* val_ptr); + static bool readU8Value(Parser& parser, void* val_ptr); + static bool readS8Value(Parser& parser, void* val_ptr); + static bool readU16Value(Parser& parser, void* val_ptr); + static bool readS16Value(Parser& parser, void* val_ptr); + static bool readU32Value(Parser& parser, void* val_ptr); + static bool readS32Value(Parser& parser, void* val_ptr); + static bool readF32Value(Parser& parser, void* val_ptr); + static bool readF64Value(Parser& parser, void* val_ptr); + static bool readColor4Value(Parser& parser, void* val_ptr); + static bool readUIColorValue(Parser& parser, void* val_ptr); + static bool readUUIDValue(Parser& parser, void* val_ptr); + static bool readSDValue(Parser& parser, void* val_ptr); //writer helper functions bool writeBoolValue(const void* val_ptr, const name_stack_t&); @@ -173,5 +171,61 @@ private: std::string mCurFileName; }; +class LLFastXUIParser : public LLInitParam::Parser, public LLSingleton +{ +LOG_CLASS(LLFastXUIParser); + +protected: + LLFastXUIParser(); + virtual ~LLFastXUIParser(); + friend class LLSingleton; +public: + typedef LLInitParam::Parser::name_stack_t name_stack_t; + + /*virtual*/ std::string getCurrentElementName(); + /*virtual*/ void parserWarning(const std::string& message); + /*virtual*/ void parserError(const std::string& message); + + bool readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent=false); + +private: + //reader helper functions + static bool readBoolValue(Parser&, void* val_ptr); + static bool readStringValue(Parser&, void* val_ptr); + static bool readU8Value(Parser&, void* val_ptr); + static bool readS8Value(Parser&, void* val_ptr); + static bool readU16Value(Parser&, void* val_ptr); + static bool readS16Value(Parser&, void* val_ptr); + static bool readU32Value(Parser&, void* val_ptr); + static bool readS32Value(Parser&, void* val_ptr); + static bool readF32Value(Parser&, void* val_ptr); + static bool readF64Value(Parser&, void* val_ptr); + static bool readColor4Value(Parser&, void* val_ptr); + static bool readUIColorValue(Parser&, void* val_ptr); + static bool readUUIDValue(Parser&, void* val_ptr); + static bool readSDValue(Parser&, void* val_ptr); + +private: + static void startElementHandler(void *userData, const char *name, const char **atts); + static void endElementHandler(void *userData, const char *name); + static void characterDataHandler(void *userData, const char *s, int len); + + void startElement(const char *name, const char **atts); + void endElement(const char *name); + void characterData(const char *s, int len); + bool readAttributes(const char **atts); + + LLInitParam::BaseBlock* mBlock; + Parser::name_stack_t mNameStack; + struct XML_ParserStruct* mParser; + S32 mLastWriteGeneration; + LLXMLNodePtr mLastWrittenChild; + S32 mCurReadDepth; + std::string mCurFileName; + const char* mCurAttributeValueBegin; + std::vector mTokenSizeStack; + std::vector mScope; +}; + #endif //LLXUIPARSER_H -- cgit v1.2.3 From d4668787addf870fca0dc1cbf03c756584838261 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 5 Aug 2010 11:16:13 -0700 Subject: Allow targeted links in the embedded browser to open multiple media browser windows. Added an optional "target" parameter" to LLWeb::loadURL and loadInternal. Made LLViewerMediaImpl::handleMediaEvent pass the target attribute of clicked links through. Set floater_media_browser.xml to allow multiple instances. Added LLFloaterMediaBrowser::create() and made LLFloaterMediaBrowser assume the incoming tag is the window's target, not the URL. Reviewed by Richard at http://codereview.lindenlab.com/2641050 --- indra/newview/llfloatermediabrowser.cpp | 30 +++++++++++++++++----- indra/newview/llfloatermediabrowser.h | 3 ++- indra/newview/llviewermedia.cpp | 17 ++++-------- indra/newview/llweb.cpp | 10 ++++---- indra/newview/llweb.h | 9 ++++--- .../skins/default/xui/en/floater_media_browser.xml | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 5405de2f9a..c38ef0c014 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -63,6 +63,30 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& key) } +//static +void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target) +{ + std::string tag = target; + + if(target.empty() || target == "_blank") + { + // create a unique tag for this instance + LLUUID id; + id.generate(); + tag = id.asString(); + } + + // TODO: Figure out whether we need to close an existing instance and/or warn the user about the number of instances they have open + + LLFloaterMediaBrowser *browser = dynamic_cast (LLFloaterReg::showInstance("media_browser", tag)); + llassert(browser); + if(browser) + { + // tell the browser instance to load the specified URL + browser->openMedia(url); + } +} + void LLFloaterMediaBrowser::draw() { getChildView("go")->setEnabled(!mAddressCombo->getValue().asString().empty()); @@ -197,12 +221,6 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) getChildView("reload")->setEnabled(TRUE); } -void LLFloaterMediaBrowser::onOpen(const LLSD& media_url) -{ - LLFloater::onOpen(media_url); - openMedia(media_url.asString()); -} - //static void LLFloaterMediaBrowser::onEnterAddress(LLUICtrl* ctrl, void* user_data) { diff --git a/indra/newview/llfloatermediabrowser.h b/indra/newview/llfloatermediabrowser.h index c315f9e797..1645ed4613 100644 --- a/indra/newview/llfloatermediabrowser.h +++ b/indra/newview/llfloatermediabrowser.h @@ -47,10 +47,11 @@ class LLFloaterMediaBrowser : public: LLFloaterMediaBrowser(const LLSD& key); + static void create(const std::string &url, const std::string& target); + /*virtual*/ BOOL postBuild(); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void draw(); - /*virtual*/ void onOpen(const LLSD& key); // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 77f7740449..7a17bfeb46 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2826,25 +2826,18 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL; // retrieve the event parameters std::string url = plugin->getClickURL(); + std::string target = plugin->getClickTarget(); U32 target_type = plugin->getClickTargetType(); - + switch (target_type) { - case LLPluginClassMedia::TARGET_EXTERNAL: - // force url to external browser - LLWeb::loadURLExternal(url); - break; - case LLPluginClassMedia::TARGET_BLANK: - // open in SL media browser or external browser based on user pref - LLWeb::loadURL(url); - break; case LLPluginClassMedia::TARGET_NONE: // ignore this click and let media plugin handle it break; - case LLPluginClassMedia::TARGET_OTHER: - LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL; + default: + // loadURL now handles distinguishing between _blank, _external, and other named targets. + LLWeb::loadURL(url, target); break; - default: break; } }; break; diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 5c9633c036..b61109d490 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -84,23 +84,23 @@ void LLWeb::initClass() // static -void LLWeb::loadURL(const std::string& url) +void LLWeb::loadURL(const std::string& url, const std::string& target) { - if (gSavedSettings.getBOOL("UseExternalBrowser")) + if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external")) { loadURLExternal(url); } else { - loadURLInternal(url); + loadURLInternal(url, target); } } // static -void LLWeb::loadURLInternal(const std::string &url) +void LLWeb::loadURLInternal(const std::string &url, const std::string& target) { - LLFloaterReg::showInstance("media_browser", url); + LLFloaterMediaBrowser::create(url, target); } diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index 1119b80bb4..20c7391dbf 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -49,11 +49,14 @@ public: static void initClass(); /// Load the given url in the user's preferred web browser - static void loadURL(const std::string& url); + static void loadURL(const std::string& url, const std::string& target); + static void loadURL(const std::string& url) { loadURL(url, LLStringUtil::null); } /// Load the given url in the user's preferred web browser - static void loadURL(const char* url) { loadURL( ll_safe_string(url) ); } + static void loadURL(const char* url, const std::string& target) { loadURL( ll_safe_string(url), target); } + static void loadURL(const char* url) { loadURL( ll_safe_string(url), LLStringUtil::null ); } /// Load the given url in the Second Life internal web browser - static void loadURLInternal(const std::string &url); + static void loadURLInternal(const std::string &url, const std::string& target); + static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null); } /// Load the given url in the operating system's web browser, async if we want to return immediately /// before browser has spawned static void loadURLExternal(const std::string& url); diff --git a/indra/newview/skins/default/xui/en/floater_media_browser.xml b/indra/newview/skins/default/xui/en/floater_media_browser.xml index c02d607586..18f3b9ab06 100644 --- a/indra/newview/skins/default/xui/en/floater_media_browser.xml +++ b/indra/newview/skins/default/xui/en/floater_media_browser.xml @@ -9,7 +9,7 @@ name="floater_about" help_topic="floater_about" save_rect="true" - single_instance="true" + auto_tile="true" title="MEDIA BROWSER" width="820"> Date: Thu, 5 Aug 2010 13:15:22 -0700 Subject: reverted unportable use of typeinfo* as hash key --- indra/llxuixml/llinitparam.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 1cc7d06b73..9890bacea4 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -207,9 +207,9 @@ namespace LLInitParam typedef boost::function parser_write_func_t; typedef boost::function parser_inspect_func_t; - typedef boost::unordered_map parser_read_func_map_t; - typedef boost::unordered_map parser_write_func_map_t; - typedef boost::unordered_map parser_inspect_func_map_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; Parser() : mParseSilently(false), -- cgit v1.2.3 From d26e380a06b343bc46010922de46e9664831e3b4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Aug 2010 13:19:19 -0700 Subject: added newlines at end to make Linux builds happy --- indra/llui/lluistring.cpp | 2 +- indra/llxuixml/llxuiparser.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index 385292e792..e343df0063 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -161,4 +161,4 @@ LLStringUtil::format_map_t& LLUIString::getArgs() mArgs = new LLStringUtil::format_map_t; } return *mArgs; -} \ No newline at end of file +} diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 00128c978a..16571a9969 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -1366,4 +1366,4 @@ bool LLFastXUIParser::readSDValue(Parser& parser, void* val_ptr) LLFastXUIParser& self = static_cast(parser); *((LLSD*)val_ptr) = LLSD(self.mCurAttributeValueBegin); return true; -} \ No newline at end of file +} -- cgit v1.2.3 From a974ed98d04d05d9c682e85d3b25cf591d2b58c0 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 5 Aug 2010 14:18:55 -0700 Subject: Fix for a crash on startup. Richard sent me the diff for this one, just pushing it on his behalf. --- indra/llxuixml/llxuiparser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 16571a9969..fe85ac41cc 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -1122,6 +1122,7 @@ void LLFastXUIParser::startElement(const char *name, const char **atts) { mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); num_tokens_pushed++; + mScope.push_back(child_name); } else { @@ -1154,7 +1155,7 @@ void LLFastXUIParser::startElement(const char *name, const char **atts) } else { - mScope.push_back(name); + mScope.push_back(child_name); } mTokenSizeStack.push_back(num_tokens_pushed); -- cgit v1.2.3 From 60a313a687c5380c4a6d1a451936c85db07b681a Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 6 Aug 2010 11:02:37 -0700 Subject: speed up population of region scripts list --- indra/newview/llfloaterscriptlimits.cpp | 62 ++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index e827e19f82..a77fc4710a 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -712,38 +712,44 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) } } - LLSD element; + LLScrollListItem::Params item_params; + item_params.value = task_id; - element["id"] = task_id; - element["columns"][0]["column"] = "size"; - element["columns"][0]["value"] = llformat("%d", size); - element["columns"][0]["font"] = "SANSSERIF"; - element["columns"][1]["column"] = "urls"; - element["columns"][1]["value"] = llformat("%d", urls); - element["columns"][1]["font"] = "SANSSERIF"; - element["columns"][2]["column"] = "name"; - element["columns"][2]["value"] = name_buf; - element["columns"][2]["font"] = "SANSSERIF"; - element["columns"][3]["column"] = "owner"; - element["columns"][3]["value"] = owner_buf; - element["columns"][3]["font"] = "SANSSERIF"; - element["columns"][4]["column"] = "parcel"; - element["columns"][4]["value"] = parcel_name; - element["columns"][4]["font"] = "SANSSERIF"; - element["columns"][5]["column"] = "location"; - if(has_locations) - { - element["columns"][5]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); - } - else - { - element["columns"][5]["value"] = ""; - } - element["columns"][5]["font"] = "SANSSERIF"; + LLScrollListCell::Params cell_params; + cell_params.font = LLFontGL::getFontSansSerif(); - list->addElement(element); + cell_params.column = "size"; + cell_params.value = size; + item_params.columns.add(cell_params); + + cell_params.column = "urls"; + cell_params.value = urls; + item_params.columns.add(cell_params); + + cell_params.column = "name"; + cell_params.value = name_buf; + item_params.columns.add(cell_params); + + cell_params.column = "owner"; + cell_params.value = owner_buf; + item_params.columns.add(cell_params); + + cell_params.column = "parcel"; + cell_params.value = parcel_name; + item_params.columns.add(cell_params); + + cell_params.column = "location"; + cell_params.value = has_locations + ? llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z) + : ""; + item_params.columns.add(cell_params); + + list->addRow(item_params); + LLSD element; element["owner_id"] = owner_id; + + element["id"] = task_id; element["local_id"] = local_id; mObjectListItems.push_back(element); } -- cgit v1.2.3 From 9609b2c81c1efc43c152e379ca56191c7295973a Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 6 Aug 2010 11:03:15 -0700 Subject: renamed LLFastXUIParser to LLSimpleXUIParser and added support for parsing xml node text contents --- indra/llui/lluictrlfactory.cpp | 2 +- indra/llxuixml/llxuiparser.cpp | 108 ++++++++++++++++++++++------------------- indra/llxuixml/llxuiparser.h | 23 +++++++-- 3 files changed, 78 insertions(+), 55 deletions(-) (limited to 'indra') diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 6ad104c1f4..c5bd6c7fce 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -103,7 +103,7 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa if (!full_filename.empty()) { LLUICtrlFactory::instance().pushFileName(full_filename); - LLFastXUIParser::instance().readXUI(full_filename, block); + LLSimpleXUIParser::instance().readXUI(full_filename, block); LLUICtrlFactory::instance().popFileName(); } } diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 00128c978a..e010b4c125 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -976,7 +976,7 @@ void LLXUIParser::parserError(const std::string& message) // -// LLFastXUIParser +// LLSimpleXUIParser // struct ScopedFile @@ -1008,7 +1008,7 @@ struct ScopedFile LLFILE* mFile; }; -LLFastXUIParser::LLFastXUIParser() +LLSimpleXUIParser::LLSimpleXUIParser() : mLastWriteGeneration(-1), mCurReadDepth(0) { @@ -1028,19 +1028,19 @@ LLFastXUIParser::LLFastXUIParser() registerParserFuncs(readSDValue, NULL); } -LLFastXUIParser::~LLFastXUIParser() +LLSimpleXUIParser::~LLSimpleXUIParser() { } -bool LLFastXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent) +bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent) { LLFastTimer timer(FTM_PARSE_XUI); mParser = XML_ParserCreate(NULL); XML_SetUserData(mParser, this); - XML_SetElementHandler( mParser, startElementHandler, endElementHandler); - XML_SetCharacterDataHandler( mParser, characterDataHandler); + XML_SetElementHandler( mParser, startElementHandler, endElementHandler); + XML_SetCharacterDataHandler( mParser, characterDataHandler); mBlock = █ mNameStack.clear(); @@ -1085,25 +1085,25 @@ bool LLFastXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBloc return true; } -void LLFastXUIParser::startElementHandler(void *userData, const char *name, const char **atts) +void LLSimpleXUIParser::startElementHandler(void *userData, const char *name, const char **atts) { - LLFastXUIParser* self = reinterpret_cast(userData); + LLSimpleXUIParser* self = reinterpret_cast(userData); self->startElement(name, atts); } -void LLFastXUIParser::endElementHandler(void *userData, const char *name) +void LLSimpleXUIParser::endElementHandler(void *userData, const char *name) { - LLFastXUIParser* self = reinterpret_cast(userData); + LLSimpleXUIParser* self = reinterpret_cast(userData); self->endElement(name); } -void LLFastXUIParser::characterDataHandler(void *userData, const char *s, int len) +void LLSimpleXUIParser::characterDataHandler(void *userData, const char *s, int len) { - LLFastXUIParser* self = reinterpret_cast(userData); + LLSimpleXUIParser* self = reinterpret_cast(userData); self->characterData(s, len); } -void LLFastXUIParser::startElement(const char *name, const char **atts) +void LLSimpleXUIParser::startElement(const char *name, const char **atts) { typedef boost::tokenizer > tokenizer; boost::char_separator sep("."); @@ -1122,6 +1122,7 @@ void LLFastXUIParser::startElement(const char *name, const char **atts) { mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); num_tokens_pushed++; + mScope.push_back(child_name); } else { @@ -1154,14 +1155,14 @@ void LLFastXUIParser::startElement(const char *name, const char **atts) } else { - mScope.push_back(name); + mScope.push_back(child_name); } mTokenSizeStack.push_back(num_tokens_pushed); readAttributes(atts); } -bool LLFastXUIParser::readAttributes(const char **atts) +bool LLSimpleXUIParser::readAttributes(const char **atts) { typedef boost::tokenizer > tokenizer; boost::char_separator sep("."); @@ -1194,8 +1195,16 @@ bool LLFastXUIParser::readAttributes(const char **atts) } -void LLFastXUIParser::endElement(const char *name) +void LLSimpleXUIParser::endElement(const char *name) { + if (!mTextContents.empty()) + { + mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); + mCurAttributeValueBegin = mTextContents.c_str(); + mBlock->submitValue(mNameStack, *this); + mNameStack.pop_back(); + mTextContents.clear(); + } mCurReadDepth--; S32 num_tokens_to_pop = mTokenSizeStack.back(); mTokenSizeStack.pop_back(); @@ -1206,12 +1215,13 @@ void LLFastXUIParser::endElement(const char *name) mScope.pop_back(); } -void LLFastXUIParser::characterData(const char *s, int len) +void LLSimpleXUIParser::characterData(const char *s, int len) { + mTextContents += std::string(s, len); } -/*virtual*/ std::string LLFastXUIParser::getCurrentElementName() +/*virtual*/ std::string LLSimpleXUIParser::getCurrentElementName() { std::string full_name; for (name_stack_t::iterator it = mNameStack.begin(); @@ -1226,7 +1236,7 @@ void LLFastXUIParser::characterData(const char *s, int len) const S32 LINE_NUMBER_HERE = 0; -void LLFastXUIParser::parserWarning(const std::string& message) +void LLSimpleXUIParser::parserWarning(const std::string& message) { #ifdef LL_WINDOWS // use Visual Studo friendly formatting of output message for easy access to originating xml @@ -1238,7 +1248,7 @@ void LLFastXUIParser::parserWarning(const std::string& message) #endif } -void LLFastXUIParser::parserError(const std::string& message) +void LLSimpleXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); @@ -1249,9 +1259,9 @@ void LLFastXUIParser::parserError(const std::string& message) #endif } -bool LLFastXUIParser::readBoolValue(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readBoolValue(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); if (!strcmp(self.mCurAttributeValueBegin, "true")) { *((bool*)val_ptr) = true; @@ -1266,64 +1276,64 @@ bool LLFastXUIParser::readBoolValue(Parser& parser, void* val_ptr) return false; } -bool LLFastXUIParser::readStringValue(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readStringValue(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); *((std::string*)val_ptr) = self.mCurAttributeValueBegin; return true; } -bool LLFastXUIParser::readU8Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readU8Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U8*)val_ptr)]).full; } -bool LLFastXUIParser::readS8Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readS8Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S8*)val_ptr)]).full; } -bool LLFastXUIParser::readU16Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readU16Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U16*)val_ptr)]).full; } -bool LLFastXUIParser::readS16Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readS16Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S16*)val_ptr)]).full; } -bool LLFastXUIParser::readU32Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readU32Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U32*)val_ptr)]).full; } -bool LLFastXUIParser::readS32Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readS32Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S32*)val_ptr)]).full; } -bool LLFastXUIParser::readF32Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readF32Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F32*)val_ptr)]).full; } -bool LLFastXUIParser::readF64Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readF64Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F64*)val_ptr)]).full; } -bool LLFastXUIParser::readColor4Value(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readColor4Value(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); LLColor4 value; if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) @@ -1334,9 +1344,9 @@ bool LLFastXUIParser::readColor4Value(Parser& parser, void* val_ptr) return false; } -bool LLFastXUIParser::readUIColorValue(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readUIColorValue(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); LLColor4 value; LLUIColor* colorp = (LLUIColor*)val_ptr; @@ -1348,12 +1358,12 @@ bool LLFastXUIParser::readUIColorValue(Parser& parser, void* val_ptr) return false; } -bool LLFastXUIParser::readUUIDValue(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readUUIDValue(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); LLUUID temp_id; // LLUUID::set is destructive, so use temporary value - if (temp_id.set(self.mCurAttributeValueBegin)) + if (temp_id.set(std::string(self.mCurAttributeValueBegin))) { *(LLUUID*)(val_ptr) = temp_id; return true; @@ -1361,9 +1371,9 @@ bool LLFastXUIParser::readUUIDValue(Parser& parser, void* val_ptr) return false; } -bool LLFastXUIParser::readSDValue(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readSDValue(Parser& parser, void* val_ptr) { - LLFastXUIParser& self = static_cast(parser); + LLSimpleXUIParser& self = static_cast(parser); *((LLSD*)val_ptr) = LLSD(self.mCurAttributeValueBegin); return true; } \ No newline at end of file diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 4deb083e1c..eb7147f49e 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -171,14 +171,25 @@ private: std::string mCurFileName; }; -class LLFastXUIParser : public LLInitParam::Parser, public LLSingleton +// LLSimpleXUIParser is a streamlined SAX-based XUI parser that does not support localization +// or parsing of a tree of independent param blocks, such as child widgets. +// Use this for reading non-localized files that only need a single param block as a result. +// +// NOTE: In order to support nested block parsing, we need callbacks for start element that +// push new blocks contexts on the mScope stack. +// NOTE: To support localization without building a DOM, we need to enforce consistent +// ordering of child elements from base file to localized diff file. Then we can use a pair +// of coroutines to perform matching of xml nodes during parsing. Not sure if the overhead +// of coroutines would offset the gain from SAX parsing + +class LLSimpleXUIParser : public LLInitParam::Parser, public LLSingleton { -LOG_CLASS(LLFastXUIParser); +LOG_CLASS(LLSimpleXUIParser); protected: - LLFastXUIParser(); - virtual ~LLFastXUIParser(); - friend class LLSingleton; + LLSimpleXUIParser(); + virtual ~LLSimpleXUIParser(); + friend class LLSingleton; public: typedef LLInitParam::Parser::name_stack_t name_stack_t; @@ -187,6 +198,7 @@ public: /*virtual*/ void parserError(const std::string& message); bool readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent=false); + void setBlock(LLInitParam::BaseBlock* block); private: //reader helper functions @@ -222,6 +234,7 @@ private: LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; std::string mCurFileName; + std::string mTextContents; const char* mCurAttributeValueBegin; std::vector mTokenSizeStack; std::vector mScope; -- cgit v1.2.3 From 5866710be7b64999ec82c5cd5e2d47d81fdeb918 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 6 Aug 2010 11:03:28 -0700 Subject: fixed crash on entering build mode --- indra/llrender/llrender.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 64238b2008..eb2c54198d 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -901,7 +901,7 @@ LLVector3 LLRender::getUITranslation() { if (mUIOffset.empty()) { - llerrs << "UI offset stack empty." << llendl; + return LLVector3::zero; } return mUIOffset.back(); } @@ -910,7 +910,7 @@ LLVector3 LLRender::getUIScale() { if (mUIScale.empty()) { - llerrs << "UI scale stack empty." << llendl; + return LLVector3(1.f, 1.f, 1.f); } return mUIScale.back(); } -- cgit v1.2.3 From 7b41819377ec1c6ffc835a0a05a1acf571f46aad Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 6 Aug 2010 11:49:43 -0700 Subject: removed spurious parsing of empty text contents --- indra/llxuixml/llxuiparser.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index e010b4c125..b3cb71cd61 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -1199,11 +1199,15 @@ void LLSimpleXUIParser::endElement(const char *name) { if (!mTextContents.empty()) { - mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); - mCurAttributeValueBegin = mTextContents.c_str(); - mBlock->submitValue(mNameStack, *this); - mNameStack.pop_back(); - mTextContents.clear(); + LLStringUtil::trim(mTextContents); + if (!mTextContents.empty()) + { + mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); + mCurAttributeValueBegin = mTextContents.c_str(); + mBlock->submitValue(mNameStack, *this, false); + mNameStack.pop_back(); + mTextContents.clear(); + } } mCurReadDepth--; S32 num_tokens_to_pop = mTokenSizeStack.back(); -- cgit v1.2.3 From 71a45d8f9df0686be078f15dcbfb29f4893865ff Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 6 Aug 2010 14:44:26 -0700 Subject: fixes for right click fast timer export --- indra/newview/llfasttimerview.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 8bc3b5a75f..ec772c2295 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -123,7 +123,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); - mPrintStats = bar_idx; + mPrintStats = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - bar_idx; } return FALSE; } @@ -953,7 +953,7 @@ void LLFastTimerView::draw() { legend_stat += ", "; } - first = true; + first = false; legend_stat += idp->getName(); if (idp->getCollapsed()) @@ -980,8 +980,7 @@ void LLFastTimerView::draw() U64 ticks; if (mPrintStats > 0) { - S32 hidx = (mPrintStats - 1) - mScrollIndex; - ticks = idp->getHistoricalCount(hidx); + ticks = idp->getHistoricalCount(mPrintStats); } else { -- cgit v1.2.3 From a11a8c4027eb949c8a33951b9e8c7475e59a2eeb Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 6 Aug 2010 15:49:38 -0700 Subject: double click to expand all timers in LLFastTimerView --- indra/newview/llfasttimerview.cpp | 11 +++++++++++ indra/newview/llfasttimerview.h | 1 + 2 files changed, 12 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index ec772c2295..696ac4e6fa 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -140,6 +140,17 @@ LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y) return NULL; } +BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != end_timer_tree(); + ++it) + { + (*it)->setCollapsed(false); + } + return TRUE; +} + BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index ac06990913..6f64248f78 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -54,6 +54,7 @@ private: public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); -- cgit v1.2.3 From 879d15903608b26f6b10f499d150bb72a65fa966 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Aug 2010 17:40:17 -0700 Subject: Limit the number of media browser windows the viewer will open at once. The limit is controlled by the debug setting MediaBrowserWindowLimit. When opening a new window would take us over the limit, the least recently opened window will be closed first. --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llfloatermediabrowser.cpp | 26 +++++++++++++++++++++++++- indra/newview/llfloatermediabrowser.h | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4c52fb015f..3326319e2d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6425,6 +6425,17 @@ Value 1.0 + MediaBrowserWindowLimit + + Comment + Maximum number of media brower windows that can be open at once (0 for no limit) + Persist + 1 + Type + S32 + Value + 5 + MediaRollOffRate Comment diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 268a0e0b93..2fc5bd72de 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -76,8 +76,32 @@ void LLFloaterMediaBrowser::create(const std::string &url, const std::string& ta tag = id.asString(); } - // TODO: Figure out whether we need to close an existing instance and/or warn the user about the number of instances they have open + S32 browser_window_limit = gSavedSettings.getS32("MediaBrowserWindowLimit"); + if(LLFloaterReg::findInstance("media_browser", tag) != NULL) + { + // There's already a media browser for this tag, so we won't be opening a new window. + } + else if(browser_window_limit != 0) + { + // showInstance will open a new window. Figure out how many media browsers are already open, + // and close the least recently opened one if this will put us over the limit. + + LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("media_browser"); + lldebugs << "total instance count is " << instances.size() << llendl; + + for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++) + { + lldebugs << " " << (*iter)->getKey() << llendl; + } + + if(instances.size() >= browser_window_limit) + { + // Destroy the least recently opened instance + (*instances.begin())->closeFloater(); + } + } + LLFloaterMediaBrowser *browser = dynamic_cast (LLFloaterReg::showInstance("media_browser", tag)); llassert(browser); if(browser) diff --git a/indra/newview/llfloatermediabrowser.h b/indra/newview/llfloatermediabrowser.h index 1645ed4613..4255d814c0 100644 --- a/indra/newview/llfloatermediabrowser.h +++ b/indra/newview/llfloatermediabrowser.h @@ -45,6 +45,7 @@ class LLFloaterMediaBrowser : public LLViewerMediaObserver { public: + LOG_CLASS(LLFloaterMediaBrowser); LLFloaterMediaBrowser(const LLSD& key); static void create(const std::string &url, const std::string& target); -- cgit v1.2.3 From 010ef13f560ca97807537484781acb332f48b8e2 Mon Sep 17 00:00:00 2001 From: callum Date: Tue, 10 Aug 2010 09:58:56 -0700 Subject: Fix for unsigned/sighed warning that breaks Windows build. --- indra/newview/llfloatermediabrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 2fc5bd72de..90147ff650 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -95,7 +95,7 @@ void LLFloaterMediaBrowser::create(const std::string &url, const std::string& ta lldebugs << " " << (*iter)->getKey() << llendl; } - if(instances.size() >= browser_window_limit) + if(instances.size() >= (size_t)browser_window_limit) { // Destroy the least recently opened instance (*instances.begin())->closeFloater(); -- cgit v1.2.3 From 4e8c33e7252d38d00b5606e1960aa520c75e0227 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 10 Aug 2010 13:04:01 -0700 Subject: Added support for targeted links opening new windows to llmediaplugintest. --- indra/test_apps/llplugintest/llmediaplugintest.cpp | 76 +++++++++++++++++++--- indra/test_apps/llplugintest/llmediaplugintest.h | 6 +- 2 files changed, 72 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 7a544debb2..166905c37c 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -959,6 +959,23 @@ mediaPanel* LLMediaPluginTest::findMediaPanel( LLPluginClassMedia* source ) return result; } +//////////////////////////////////////////////////////////////////////////////// +// +mediaPanel* LLMediaPluginTest::findMediaPanel( const std::string &target_name ) +{ + mediaPanel *result = NULL; + + for( int panel = 0; panel < (int)mMediaPanels.size(); ++panel ) + { + if ( mMediaPanels[ panel ]->mTarget == target_name ) + { + result = mMediaPanels[ panel ]; + } + } + + return result; +} + //////////////////////////////////////////////////////////////////////////////// // void LLMediaPluginTest::navigateToNewURI( std::string uri ) @@ -1571,7 +1588,7 @@ std::string LLMediaPluginTest::pluginNameFromMimeType( std::string& mime_type ) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaPluginTest::addMediaPanel( std::string url ) +mediaPanel* LLMediaPluginTest::addMediaPanel( std::string url ) { // Get the plugin filename using the URL std::string mime_type = mimeTypeFromUrl( url ); @@ -1603,7 +1620,7 @@ void LLMediaPluginTest::addMediaPanel( std::string url ) if (NULL == getcwd( cwd, FILENAME_MAX - 1 )) { std::cerr << "Couldn't get cwd - probably too long - failing to init." << std::endl; - return; + return NULL; } std::string user_data_path = std::string( cwd ) + "/"; #endif @@ -1673,6 +1690,8 @@ void LLMediaPluginTest::addMediaPanel( std::string url ) std::cout << "Adding new media panel for " << url << "(" << media_width << "x" << media_height << ") with index " << panel->mId << " - total panels = " << mMediaPanels.size() << std::endl; } + + return panel; } //////////////////////////////////////////////////////////////////////////////// @@ -1778,15 +1797,15 @@ void LLMediaPluginTest::updateMediaPanel( mediaPanel* panel ) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url ) +mediaPanel* LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url ) { // no media panels so we can't change anything - have to add if ( mMediaPanels.size() == 0 ) - return; + return NULL; // sanity check if ( ! panel ) - return; + return NULL; int index; for(index = 0; index < (int)mMediaPanels.size(); index++) @@ -1798,7 +1817,7 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url ) if(index >= (int)mMediaPanels.size()) { // panel isn't in mMediaPanels - return; + return NULL; } std::cout << "Replacing media panel with index " << panel->mId << std::endl; @@ -1840,7 +1859,7 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url ) if (NULL == getcwd( cwd, FILENAME_MAX - 1 )) { std::cerr << "Couldn't get cwd - probably too long - failing to init." << std::endl; - return; + return NULL; } std::string user_data_path = std::string( cwd ) + "/"; #endif @@ -1880,6 +1899,8 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url ) // load and start the URL panel->mMediaSource->loadURI( url ); panel->mMediaSource->start(); + + return panel; } //////////////////////////////////////////////////////////////////////////////// @@ -2139,7 +2160,46 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e break; case MEDIA_EVENT_CLICK_LINK_HREF: - std::cerr << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, uri is " << self->getClickURL() << std::endl; + { + std::cerr << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, uri is " << self->getClickURL() << ", target is " << self->getClickTarget() << std::endl; + // retrieve the event parameters + std::string url = self->getClickURL(); + std::string target = self->getClickTarget(); + U32 target_type = self->getClickTargetType(); + + switch (target_type) + { + case LLPluginClassMedia::TARGET_NONE: + // ignore this click + break; + + case LLPluginClassMedia::TARGET_EXTERNAL: + // this should open in an external browser, but since this is a test app we don't care. + break; + + case LLPluginClassMedia::TARGET_BLANK: + // Create a new panel with the specified URL. + addMediaPanel(url); + break; + + case LLPluginClassMedia::TARGET_OTHER: + mediaPanel *target_panel = findMediaPanel(target); + if(target_panel) + { + target_panel = replaceMediaPanel(target_panel, url); + } + else + { + target_panel = addMediaPanel(url); + } + + if(target_panel) + { + target_panel->mTarget = target; + } + break; + } + } break; case MEDIA_EVENT_CLICK_LINK_NOFOLLOW: diff --git a/indra/test_apps/llplugintest/llmediaplugintest.h b/indra/test_apps/llplugintest/llmediaplugintest.h index 5d08e42148..ecd6cbfc4f 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.h +++ b/indra/test_apps/llplugintest/llmediaplugintest.h @@ -56,6 +56,7 @@ struct mediaPanel int mId; std::string mStartUrl; std::string mMimeType; + std::string mTarget; LLPluginClassMedia *mMediaSource; int mMediaWidth; int mMediaHeight; @@ -96,16 +97,17 @@ class LLMediaPluginTest : public LLPluginClassMediaOwner void draw( int draw_type ); void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id ); - void addMediaPanel( std::string url ); + mediaPanel* addMediaPanel( std::string url ); void updateMediaPanel( mediaPanel* panel ); void remMediaPanel( mediaPanel* panel ); - void replaceMediaPanel( mediaPanel* panel, std::string url ); + mediaPanel* replaceMediaPanel( mediaPanel* panel, std::string url ); void getRandomMediaSize( int& width, int& height, std::string mime_type ); void navigateToNewURI( std::string uri ); void initUrlHistory( std::string uri ); void selectPanelById( int id ); void selectPanel( mediaPanel* panel ); mediaPanel* findMediaPanel( LLPluginClassMedia* panel ); + mediaPanel* findMediaPanel( const std::string &target_name ); void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels ); void makeChrome(); void resetView(); -- cgit v1.2.3 From 9327ef1ea0107df45c4e2066b379206a51a36c25 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 11 Aug 2010 15:00:12 -0700 Subject: cleaned up LLFirstUse and added ignorable_dialogs to project xml --- indra/newview/CMakeLists.txt | 1 + indra/newview/app_settings/ignorable_dialogs.xml | 176 ---------------------- indra/newview/llfirstuse.cpp | 180 +---------------------- indra/newview/llfirstuse.h | 28 +--- 4 files changed, 4 insertions(+), 381 deletions(-) (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 64bcf12b06..3e0aa587b1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1300,6 +1300,7 @@ set(viewer_APPSETTINGS_FILES app_settings/cmd_line.xml app_settings/grass.xml app_settings/high_graphics.xml + app_settings/ignorable_dialogs.xml app_settings/keys.ini app_settings/keywords.ini app_settings/logcontrol.xml diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml index d0e1f62a84..f11e6b015e 100644 --- a/indra/newview/app_settings/ignorable_dialogs.xml +++ b/indra/newview/app_settings/ignorable_dialogs.xml @@ -1,138 +1,6 @@ - FirstAppearance - - Comment - Enables FirstAppearance warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstAttach - - Comment - Enables FirstAttach warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstBalanceDecrease - - Comment - Enables FirstBalanceDecrease warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstBalanceIncrease - - Comment - Enables FirstBalanceIncrease warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstBuild - - Comment - Enables FirstBuild warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstDebugMenus - - Comment - Enables FirstDebugMenus warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstFlexible - - Comment - Enables FirstFlexible warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstGoTo - - Comment - Enables FirstGoTo warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstInventory - - Comment - Enables FirstInventory warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstLeftClickNoHit - - Comment - Enables FirstLeftClickNoHit warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstMap - - Comment - Enables FirstMap warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstMedia - - Comment - Enables FirstMedia warning dialog - Persist - 1 - Type - Boolean - Value - 1 - FirstOverrideKeys Comment @@ -155,50 +23,6 @@ Value 1 - FirstSculptedPrim - - Comment - Enables FirstSculptedPrim warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstSit - - Comment - Enables FirstSit warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstTeleport - - Comment - Enables FirstTeleport warning dialog - Persist - 1 - Type - Boolean - Value - 1 - - FirstVoice - - Comment - Enables FirstVoice warning dialog - Persist - 1 - Type - Boolean - Value - 1 - AboutDirectX9 Comment diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index b3fdf60b11..7f74b18fd0 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -45,7 +45,7 @@ #include "llappviewer.h" #include "lltracker.h" -/* + // static std::set LLFirstUse::sConfigVariables; @@ -76,107 +76,7 @@ void LLFirstUse::resetFirstUse() gWarningSettings.setBOOL(*iter, TRUE); } } -*/ -/* - -// Called whenever the viewer detects that your balance went up -void LLFirstUse::useBalanceIncrease(S32 delta) -{ - if (gWarningSettings.getBOOL("FirstBalanceIncrease")) - { - gWarningSettings.setBOOL("FirstBalanceIncrease", FALSE); - - LLSD args; - args["AMOUNT"] = llformat("%d",delta); - LLNotificationsUtil::add("FirstBalanceIncrease", args); - } -} - - -// Called whenever the viewer detects your balance went down -void LLFirstUse::useBalanceDecrease(S32 delta) -{ - if (gWarningSettings.getBOOL("FirstBalanceDecrease")) - { - gWarningSettings.setBOOL("FirstBalanceDecrease", FALSE); - - LLSD args; - args["AMOUNT"] = llformat("%d",-delta); - LLNotificationsUtil::add("FirstBalanceDecrease", args); - } -} - - -// static -void LLFirstUse::useSit() -{ - // Our orientation island uses sitting to teach vehicle driving - // so just never show this message. JC - //if (gWarningSettings.getBOOL("FirstSit")) - //{ - // gWarningSettings.setBOOL("FirstSit", FALSE); - // - // LLNotificationsUtil::add("FirstSit"); - //} -} - -// static -void LLFirstUse::useMap() -{ - if (gWarningSettings.getBOOL("FirstMap")) - { - gWarningSettings.setBOOL("FirstMap", FALSE); - - LLNotificationsUtil::add("FirstMap"); - } -} - -// static -void LLFirstUse::useGoTo() -{ - // nothing for now JC -} - -// static -void LLFirstUse::useBuild() -{ - if (gWarningSettings.getBOOL("FirstBuild")) - { - gWarningSettings.setBOOL("FirstBuild", FALSE); - - LLNotificationsUtil::add("FirstBuild"); - } -} - - */ -/* -// static -void LLFirstUse::useLeftClickNoHit() -{ - if (gWarningSettings.getBOOL("FirstLeftClickNoHit")) - { - gWarningSettings.setBOOL("FirstLeftClickNoHit", FALSE); - - LLNotificationsUtil::add("FirstLeftClickNoHit"); - } -} -*/ -/* -// static -void LLFirstUse::useTeleport() -{ - if (gWarningSettings.getBOOL("FirstTeleport")) - { - LLVector3d teleportDestination = LLTracker::getTrackedPositionGlobal(); - if(teleportDestination != LLVector3d::zero) - { - gWarningSettings.setBOOL("FirstTeleport", FALSE); - LLNotificationsUtil::add("FirstTeleport"); - } - } -} -*/ // static void LLFirstUse::useOverrideKeys() { @@ -192,36 +92,6 @@ void LLFirstUse::useOverrideKeys() } } } -/* -// static -void LLFirstUse::useAttach() -{ - // nothing for now -} - -// static -void LLFirstUse::useAppearance() -{ - if (gWarningSettings.getBOOL("FirstAppearance")) - { - gWarningSettings.setBOOL("FirstAppearance", FALSE); - - LLNotificationsUtil::add("FirstAppearance"); - } -} - -// static -void LLFirstUse::useInventory() -{ - if (gWarningSettings.getBOOL("FirstInventory")) - { - gWarningSettings.setBOOL("FirstInventory", FALSE); - - LLNotificationsUtil::add("FirstInventory"); - } -} - -*/ // static void LLFirstUse::useSandbox() @@ -236,51 +106,3 @@ void LLFirstUse::useSandbox() LLNotificationsUtil::add("FirstSandbox", args); } } -/* -// static -void LLFirstUse::useFlexible() -{ - if (gWarningSettings.getBOOL("FirstFlexible")) - { - gWarningSettings.setBOOL("FirstFlexible", FALSE); - - LLNotificationsUtil::add("FirstFlexible"); - } -} - -// static -void LLFirstUse::useDebugMenus() -{ - if (gWarningSettings.getBOOL("FirstDebugMenus")) - { - gWarningSettings.setBOOL("FirstDebugMenus", FALSE); - - LLNotificationsUtil::add("FirstDebugMenus"); - } -} - -// static -void LLFirstUse::useSculptedPrim() -{ - if (gWarningSettings.getBOOL("FirstSculptedPrim")) - { - gWarningSettings.setBOOL("FirstSculptedPrim", FALSE); - - LLNotificationsUtil::add("FirstSculptedPrim"); - - } -} - -// static -void LLFirstUse::useMedia() -{ - if (gWarningSettings.getBOOL("FirstMedia")) - { - gWarningSettings.setBOOL("FirstMedia", FALSE); - - // Popup removed as a short-term fix for EXT-1643. - // Ultimately, the plan is to kill all First Use dialogs - //LLNotificationsUtil::add("FirstMedia"); - } -} -*/ diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index 3c7551f6cb..20ddef04d7 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -79,43 +79,19 @@ object or from inventory. class LLFirstUse { public: -/* + // Add a config variable to be reset on resetFirstUse() static void addConfigVariable(const std::string& var); // Sets all controls back to show the dialogs. static void disableFirstUse(); static void resetFirstUse(); - - // These methods are called each time the appropriate action is - // taken. The functions themselves handle only showing the dialog - // the first time, or subsequent times if the user wishes. - static void useBalanceIncrease(S32 delta); - static void useBalanceDecrease(S32 delta); - static void useSit(); - static void useMap(); - static void useGoTo(); - static void useBuild(); -// static void useLeftClickNoHit(); - static void useTeleport(); -*/ static void useOverrideKeys(); -/* - static void useAttach(); - static void useAppearance(); - static void useInventory(); - */ + static void useSandbox(); -/* - static void useFlexible(); - static void useDebugMenus(); - static void useSculptedPrim(); - static void useMedia(); - protected: static std::set sConfigVariables; -*/ }; #endif -- cgit v1.2.3 From be50a053ed4ae7d0b15fc20f1c6ca0973c56ffd9 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 12 Aug 2010 09:46:45 -0700 Subject: first pass at hints --- indra/newview/CMakeLists.txt | 3 ++ indra/newview/app_settings/ignorable_dialogs.xml | 34 +++++++++++++++++++++ indra/newview/llbottomtray.cpp | 4 ++- indra/newview/llchatbar.cpp | 4 +++ indra/newview/llfirstuse.cpp | 33 ++++++++++++++++++++ indra/newview/llfirstuse.h | 4 +++ indra/newview/llmoveview.cpp | 7 +++++ indra/newview/llnearbychathandler.cpp | 6 +++- indra/newview/llnotificationhandler.h | 14 +++++++++ indra/newview/llnotificationmanager.cpp | 2 ++ indra/newview/llsidetray.cpp | 2 ++ indra/newview/llviewermessage.cpp | 3 ++ indra/newview/llviewerwindow.cpp | 1 + indra/newview/llviewerwindow.h | 2 ++ indra/newview/skins/default/textures/textures.xml | 8 ++++- .../default/textures/windows/hint_arrow_down.png | Bin 0 -> 3239 bytes .../default/textures/windows/hint_arrow_left.png | Bin 0 -> 3163 bytes .../default/textures/windows/hint_arrow_right.png | Bin 0 -> 3155 bytes .../default/textures/windows/hint_arrow_up.png | Bin 0 -> 3248 bytes .../default/textures/windows/hint_background.png | Bin 0 -> 3930 bytes indra/newview/skins/default/xui/en/main_view.xml | 7 +++++ .../newview/skins/default/xui/en/notifications.xml | 24 +++++++++++++++ 22 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_down.png create mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_left.png create mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_right.png create mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_up.png create mode 100644 indra/newview/skins/default/textures/windows/hint_background.png (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3e0aa587b1..7d70b2a49b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -230,6 +230,7 @@ set(viewer_SOURCE_FILES llgroupiconctrl.cpp llgrouplist.cpp llgroupmgr.cpp + llhints.cpp llhomelocationresponder.cpp llhudeffect.cpp llhudeffectbeam.cpp @@ -300,6 +301,7 @@ set(viewer_SOURCE_FILES llnotificationalerthandler.cpp llnotificationgrouphandler.cpp llnotificationhandlerutil.cpp + llnotificationhinthandler.cpp llnotificationmanager.cpp llnotificationofferhandler.cpp llnotificationscripthandler.cpp @@ -754,6 +756,7 @@ set(viewer_HEADER_FILES llgroupiconctrl.h llgrouplist.h llgroupmgr.h + llhints.h llhomelocationresponder.h llhudeffect.h llhudeffectbeam.h diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml index f11e6b015e..a0b9e33aa9 100644 --- a/indra/newview/app_settings/ignorable_dialogs.xml +++ b/indra/newview/app_settings/ignorable_dialogs.xml @@ -1,6 +1,28 @@ + FirstInventoryOffer + + Comment + Shows hint when a person or object offers you an inventory item + Persist + 1 + Type + Boolean + Value + 1 + + FirstOtherChatBeforeUser + + Comment + Shows hint when someone else chats first + Persist + 1 + Type + Boolean + Value + 1 + FirstOverrideKeys Comment @@ -23,6 +45,18 @@ Value 1 + + FirstSit + + Comment + Shows hint when someone sits for the first time + Persist + 1 + Type + Boolean + Value + 1 + AboutDirectX9 Comment diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0e5e8d0fe7..7d4c0be3fa 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -47,6 +47,7 @@ #include "llagentcamera.h" #include "llchiclet.h" #include "llfloatercamera.h" +#include "llhints.h" #include "llimfloater.h" // for LLIMFloater #include "llnearbychatbar.h" #include "llspeakbutton.h" @@ -474,8 +475,9 @@ BOOL LLBottomTray::postBuild() mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gMenuHolder->addChild(mBottomTrayContextMenu); - mNearbyChatBar = getChild("chat_bar"); + LLHints::registerHintTarget("nearby_chat_bar", mNearbyChatBar->LLView::getHandle()); + mToolbarStack = getChild("toolbar_stack"); mMovementButton = getChild("movement_btn"); mCamButton = getChild("camera_btn"); diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 73fbe78298..96001a07a0 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -571,6 +571,10 @@ void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) { + // as soon as we say something, we no longer care about teaching the user + // how to chat + gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE); + // Look for "/20 foo" channel chats. S32 channel = 0; LLWString out_text = stripChannelNumber(wtext, &channel); diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 7f74b18fd0..8906525676 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -93,6 +93,39 @@ void LLFirstUse::useOverrideKeys() } } +// static +void LLFirstUse::otherAvatarChat() +{ + if (gWarningSettings.getBOOL("FirstOtherChatBeforeUser")) + { + gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE); + + LLNotificationsUtil::add("HintChat", LLSD(), LLSD().with("target", "nearby_chat_bar").with("direction", "top")); + } +} + +// static +void LLFirstUse::sit() +{ + if (gWarningSettings.getBOOL("FirstSit")) + { + gWarningSettings.setBOOL("FirstSit", FALSE); + + LLNotificationsUtil::add("HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top")); + } +} + +// static +void LLFirstUse::inventoryOffer() +{ + if (gWarningSettings.getBOOL("FirstInventoryOffer")) + { + gWarningSettings.setBOOL("FirstInventoryOffer", FALSE); + + LLNotificationsUtil::add("HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left")); + } +} + // static void LLFirstUse::useSandbox() { diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index 20ddef04d7..ca7290fe17 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -86,7 +86,11 @@ public: // Sets all controls back to show the dialogs. static void disableFirstUse(); static void resetFirstUse(); + static void useOverrideKeys(); + static void otherAvatarChat(); + static void sit(); + static void inventoryOffer(); static void useSandbox(); diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index fc41137686..19615def93 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -45,7 +45,9 @@ #include "llvoavatarself.h" // to check gAgentAvatarp->isSitting() #include "llbottomtray.h" #include "llbutton.h" +#include "llfirstuse.h" #include "llfloaterreg.h" +#include "llhints.h" #include "lljoystickbutton.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" @@ -566,6 +568,10 @@ void LLPanelStandStopFlying::setStandStopFlyingMode(EStandStopFlyingMode mode) { LLPanelStandStopFlying* panel = getInstance(); + if (mode == SSFM_STAND) + { + LLFirstUse::sit(); + } panel->mStandButton->setVisible(SSFM_STAND == mode); panel->mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode); @@ -596,6 +602,7 @@ BOOL LLPanelStandStopFlying::postBuild() mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this)); mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance, TRUE)); mStandButton->setVisible(FALSE); + LLHints::registerHintTarget("stand_btn", mStandButton->getHandle()); mStopFlyingButton = getChild("stop_fly_btn"); //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE)); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 1fadb126e4..31a59146d6 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -37,6 +37,7 @@ #include "llbottomtray.h" #include "llchatitemscontainerctrl.h" +#include "llfirstuse.h" #include "llfloaterscriptdebug.h" #include "llnearbychat.h" #include "llrecentpeople.h" @@ -347,7 +348,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) if(chat_msg.mMuted == TRUE) return; if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull()) - LLRecentPeople::instance().add(chat_msg.mFromID); + { + LLRecentPeople::instance().add(chat_msg.mFromID); + LLFirstUse::otherAvatarChat(); + } if(chat_msg.mText.empty()) return;//don't process empty messages diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 99a1fedcf3..7b8f530178 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -269,6 +269,20 @@ protected: void onRejectToast(LLUUID& id); }; +/** + * Handler for UI hints. + */ +class LLHintHandler : public LLSingleton +{ +public: + LLHintHandler(); + virtual ~LLHintHandler(); + + // base interface functions + virtual bool processNotification(const LLSD& notify); +}; + + class LLHandlerUtil { public: diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index 4401bb953f..86496c9d02 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -66,6 +66,7 @@ void LLNotificationManager::init() LLNotificationChannel::buildChannel("AlertModal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal")); LLNotificationChannel::buildChannel("IM Notifications", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "notifytoast")); LLNotificationChannel::buildChannel("Offer", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "offer")); + LLNotificationChannel::buildChannel("Hints", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "hint")); LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); @@ -74,6 +75,7 @@ void LLNotificationManager::init() LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); + LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1)); mNotifyHandlers["notify"] = boost::shared_ptr(new LLScriptHandler(NT_NOTIFY, LLSD())); mNotifyHandlers["notifytip"] = boost::shared_ptr(new LLTipHandler(NT_NOTIFY, LLSD())); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 7104f3934d..066b694618 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -37,6 +37,7 @@ #include "llagentcamera.h" #include "llappviewer.h" #include "llbottomtray.h" +#include "llhints.h" #include "llsidetray.h" #include "llviewerwindow.h" #include "llaccordionctrl.h" @@ -430,6 +431,7 @@ void LLSideTray::createButtons () mTabButtons[name] = button; } } + LLHints::registerHintTarget("inventory_btn", mTabButtons["sidebar_inventory"]->getHandle()); } void LLSideTray::processTriState () diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a04c919310..9bb734a3d3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -56,6 +56,7 @@ #include "llagentcamera.h" #include "llcallingcard.h" #include "llbuycurrencyhtml.h" +#include "llfirstuse.h" #include "llfloaterbuyland.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" @@ -1763,6 +1764,8 @@ void inventory_offer_handler(LLOfferInfo* info) return; } + LLFirstUse::inventoryOffer(); + // Avoid the Accept/Discard dialog if the user so desires. JC if (gSavedSettings.getBOOL("AutoAcceptNewInventory") && (info->mType == LLAssetType::AT_NOTECARD diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b36af7d95b..566f4b45ba 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1529,6 +1529,7 @@ void LLViewerWindow::initBase() mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle(); mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle(); mPopupView = main_view->getChild("popup_holder"); + mHintHolder = main_view->getChild("hint_holder")->getHandle(); // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild("Floater View"); diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 1e0200a075..cd1ee8a5fd 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -294,6 +294,7 @@ public: void updateWorldViewRect(bool use_full_window=false); LLView* getNonSideTrayView() { return mNonSideTrayView.get(); } LLView* getFloaterViewHolder() { return mFloaterViewHolder.get(); } + LLView* getHintHolder() { return mHintHolder.get(); } BOOL handleKey(KEY key, MASK mask); void handleScrollWheel (S32 clicks); @@ -453,6 +454,7 @@ protected: LLHandle mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world LLHandle mNonSideTrayView; // parent of world view + bottom bar, etc...everything but the side tray LLHandle mFloaterViewHolder; // container for floater_view + LLHandle mHintHolder; // container for hints LLPopupView* mPopupView; // container for transient popups class LLDebugText* mDebugText; // Internal class for debug text diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 082b37d80b..9fbbfb1d2b 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -645,5 +645,11 @@ with the same filename but different name - + + + + + + + diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_down.png b/indra/newview/skins/default/textures/windows/hint_arrow_down.png new file mode 100644 index 0000000000..11ab3c2d0c Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_arrow_down.png differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_left.png b/indra/newview/skins/default/textures/windows/hint_arrow_left.png new file mode 100644 index 0000000000..e5c597a550 Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_arrow_left.png differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_right.png b/indra/newview/skins/default/textures/windows/hint_arrow_right.png new file mode 100644 index 0000000000..3f89187e13 Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_arrow_right.png differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_up.png b/indra/newview/skins/default/textures/windows/hint_arrow_up.png new file mode 100644 index 0000000000..1050097efb Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_arrow_up.png differ diff --git a/indra/newview/skins/default/textures/windows/hint_background.png b/indra/newview/skins/default/textures/windows/hint_background.png new file mode 100644 index 0000000000..0839a95205 Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_background.png differ diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index a1ca910cbb..0bf5717de8 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -208,6 +208,13 @@ bottom="-1" height="11" /> + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam + + + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam + + + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam + + + - Your CPU speed does not meet the minimum requirements. -- cgit v1.2.3 From e16c1f6fdd300f284f0b39b76b4e82f7366b5cdb Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 12 Aug 2010 10:08:39 -0700 Subject: forgot some files --- indra/newview/llhints.cpp | 250 ++++++++++++++++++++++++++++++++++++++++++++++ indra/newview/llhints.h | 51 ++++++++++ 2 files changed, 301 insertions(+) create mode 100644 indra/newview/llhints.cpp create mode 100644 indra/newview/llhints.h (limited to 'indra') diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp new file mode 100644 index 0000000000..a8c3183301 --- /dev/null +++ b/indra/newview/llhints.cpp @@ -0,0 +1,250 @@ +/** + * @file llhints.cpp + * @brief Hint popups for displaying context sensitive help in a UI overlay + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" // must be first include + +#include "llhints.h" + +#include "llbutton.h" +#include "lltextbox.h" +#include "llviewerwindow.h" +#include "llsdparam.h" + +class LLHintPopup : public LLPanel +{ +public: + + typedef enum e_popup_direction + { + LEFT, + TOP, + RIGHT, + BOTTOM + } EPopupDirection; + + struct PopupDirections : public LLInitParam::TypeValuesHelper + { + static void declareValues() + { + declare("left", LLHintPopup::LEFT); + declare("right", LLHintPopup::RIGHT); + declare("top", LLHintPopup::TOP); + declare("bottom", LLHintPopup::BOTTOM); + } + }; + + struct Params : public LLInitParam::Block + { + Mandatory notification; + Optional target; + Optional direction; + Optional distance; + Optional left_arrow, + up_arrow, + right_arrow, + down_arrow; + + Params() + : direction("direction", TOP), + distance("distance", 24), + target("target"), + left_arrow("left_arrow", LLUI::getUIImage("hint_arrow_left")), + up_arrow("up_arrow", LLUI::getUIImage("hint_arrow_up")), + right_arrow("right_arrow", LLUI::getUIImage("hint_arrow_right")), + down_arrow("down_arrow", LLUI::getUIImage("hint_arrow_down")) + {} + }; + + LLHintPopup(const Params&); + + void setHintTarget(LLHandle target) { mTarget = target; } + /*virtual*/ BOOL postBuild(); + + void onClickClose() { hide(); } + void draw(); + void hide() { die(); } + +private: + LLNotificationPtr mNotification; + LLHandle mTarget; + EPopupDirection mDirection; + S32 mDistance; + LLUIImagePtr mArrowLeft, + mArrowUp, + mArrowRight, + mArrowDown; +}; + + + + +LLHintPopup::LLHintPopup(const LLHintPopup::Params& p) +: mNotification(p.notification), + mDirection(p.direction), + mDistance(p.distance), + mTarget(LLHints::getHintTarget(p.target)), + mArrowLeft(p.left_arrow), + mArrowUp(p.up_arrow), + mArrowRight(p.right_arrow), + mArrowDown(p.down_arrow), + LLPanel(p) +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_hint.xml"); +} + +BOOL LLHintPopup::postBuild() +{ + LLTextBox& hint_text = getChildRef("hint_text"); + hint_text.setText(mNotification->getMessage()); + + getChild("close")->setClickedCallback(boost::bind(&LLHintPopup::onClickClose, this)); + getChild("hint_title")->setText(mNotification->getLabel()); + + LLRect text_bounds = hint_text.getTextBoundingRect(); + S32 delta_height = text_bounds.getHeight() - hint_text.getRect().getHeight(); + reshape(getRect().getWidth(), getRect().getHeight() + delta_height); + return TRUE; +} + +void LLHintPopup::draw() +{ + LLView* targetp = mTarget.get(); + if (!targetp || !targetp->isInVisibleChain()) + { + hide(); + } + else + { + LLRect target_rect; + targetp->localRectToOtherView(targetp->getLocalRect(), &target_rect, getParent()); + + LLRect my_local_rect = getLocalRect(); + LLRect my_rect = getRect(); + LLRect arrow_rect; + LLUIImagePtr arrow_imagep; + + const S32 OVERLAP = 5; + + switch(mDirection) + { + case LEFT: + my_rect.setCenterAndSize( target_rect.mLeft - (my_rect.getWidth() / 2 + mDistance), + target_rect.getCenterY(), + my_rect.getWidth(), + my_rect.getHeight()); + arrow_rect.setCenterAndSize(my_local_rect.mRight + mArrowRight->getWidth() / 2 - OVERLAP, + my_local_rect.getCenterY(), + mArrowRight->getWidth(), + mArrowRight->getHeight()); + arrow_imagep = mArrowRight; + break; + case TOP: + my_rect.setCenterAndSize( target_rect.getCenterX(), + target_rect.mTop + (my_rect.getHeight() / 2 + mDistance), + my_rect.getWidth(), + my_rect.getHeight()); + arrow_rect.setCenterAndSize(my_local_rect.getCenterX(), + my_local_rect.mBottom - mArrowDown->getHeight() / 2 + OVERLAP, + mArrowDown->getWidth(), + mArrowDown->getHeight()); + arrow_imagep = mArrowDown; + break; + case RIGHT: + my_rect.setCenterAndSize( target_rect.getCenterX(), + target_rect.mTop - (my_rect.getHeight() / 2 + mDistance), + my_rect.getWidth(), + my_rect.getHeight()); + arrow_rect.setCenterAndSize(my_local_rect.mLeft - mArrowLeft->getWidth() / 2 + OVERLAP, + my_local_rect.getCenterY(), + mArrowLeft->getWidth(), + mArrowLeft->getHeight()); + arrow_imagep = mArrowLeft; + break; + case BOTTOM: + my_rect.setCenterAndSize( target_rect.mLeft + (my_rect.getWidth() / 2 + mDistance), + target_rect.getCenterY(), + my_rect.getWidth(), + my_rect.getHeight()); + arrow_rect.setCenterAndSize(my_local_rect.getCenterX(), + my_local_rect.mTop + mArrowUp->getHeight() / 2 - OVERLAP, + mArrowUp->getWidth(), + mArrowUp->getHeight()); + arrow_imagep = mArrowUp; + break; + } + setShape(my_rect); + LLPanel::draw(); + + arrow_imagep->draw(arrow_rect); + } +} + + +LLRegistry > LLHints::sTargetRegistry; + +//static +void LLHints::show(LLNotificationPtr hint) +{ + LLHintPopup::Params p; + LLParamSDParser::instance().readSD(hint->getPayload(), p); + + p.notification = hint; + + LLHintPopup* popup = new LLHintPopup(p); + LLView* hint_holder = gViewerWindow->getHintHolder(); + if (hint_holder) + { + hint_holder->addChild(popup); + popup->centerWithin(hint_holder->getLocalRect()); + } +} + +//static +void LLHints::registerHintTarget(const std::string& name, LLHandle target) +{ + sTargetRegistry.defaultRegistrar().add(name, target); +} + +//static +LLHandle LLHints::getHintTarget(const std::string& name) +{ + LLHandle* handlep = sTargetRegistry.getValue(name); + if (handlep) + { + return *handlep; + } + else + { + return LLHandle(); + } +} diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h new file mode 100644 index 0000000000..b5255db95b --- /dev/null +++ b/indra/newview/llhints.h @@ -0,0 +1,51 @@ +/** + * @file llhints.h + * @brief Hint popups for displaying context sensitive help in a UI overlay + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLHINTS_H +#define LL_LLHINTS_H + +#include "llpanel.h" +#include "llnotifications.h" + + +class LLHints +{ +public: + static void show(LLNotificationPtr hint); + static void registerHintTarget(const std::string& name, LLHandle target); + static LLHandle getHintTarget(const std::string& name); +private: + static LLRegistry > sTargetRegistry; +}; + + +#endif \ No newline at end of file -- cgit v1.2.3 From 73f1f43b8bd9ae1c3bc7f96d652c30d772da113b Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 12 Aug 2010 10:11:30 -0700 Subject: forgot another file --- indra/newview/llnotificationhinthandler.cpp | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 indra/newview/llnotificationhinthandler.cpp (limited to 'indra') diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp new file mode 100644 index 0000000000..f5c0330b2a --- /dev/null +++ b/indra/newview/llnotificationhinthandler.cpp @@ -0,0 +1,58 @@ +/** + * @file llnotificationhinthandler.cpp + * @brief Notification Handler Class for UI Hints + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" // must be first include + +#include "llnotificationhandler.h" +#include "llhints.h" +#include "llnotifications.h" + +using namespace LLNotificationsUI; + +LLHintHandler::LLHintHandler() +{ +} + +LLHintHandler::~LLHintHandler() +{ +} + +bool LLHintHandler::processNotification(const LLSD& notify) +{ + if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load") + { + LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); + LLHints::show(notification); + } + return false; +} -- cgit v1.2.3 From 657e462b6a46bee09fe91e84ea37763db79c868c Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 12 Aug 2010 12:19:04 -0700 Subject: forgot yet another file --- indra/newview/skins/default/xui/en/panel_hint.xml | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/panel_hint.xml (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_hint.xml b/indra/newview/skins/default/xui/en/panel_hint.xml new file mode 100644 index 0000000000..7cb8f58c37 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_hint.xml @@ -0,0 +1,34 @@ + + + + + will interpret as "button.rect" - // since there is no widget named "rect" + if (mOutputStack.back().second == 1) + { // root node for this block + mScope.push_back(child_name); + } + else + { // compound attribute if (child_name.find(".") == std::string::npos) { mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); @@ -1153,10 +1199,6 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts) mScope.push_back(mNameStack.back().first); } } - else - { - mScope.push_back(child_name); - } mTokenSizeStack.push_back(num_tokens_pushed); readAttributes(atts); @@ -1183,8 +1225,7 @@ bool LLSimpleXUIParser::readAttributes(const char **atts) } // child nodes are not necessarily valid attributes, so don't complain once we've recursed - bool silent = mCurReadDepth > 1; - any_parsed |= mBlock->submitValue(mNameStack, *this, silent); + any_parsed |= mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); while(num_tokens_pushed-- > 0) { @@ -1204,12 +1245,21 @@ void LLSimpleXUIParser::endElement(const char *name) { mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); mCurAttributeValueBegin = mTextContents.c_str(); - mBlock->submitValue(mNameStack, *this, false); + mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); mNameStack.pop_back(); mTextContents.clear(); } } - mCurReadDepth--; + + if (--mOutputStack.back().second == 0) + { + if (mOutputStack.empty()) + { + LL_ERRS("ReadXUI") << "Parameter block output stack popped while empty." << LL_ENDL; + } + mOutputStack.pop_back(); + } + S32 num_tokens_to_pop = mTokenSizeStack.back(); mTokenSizeStack.pop_back(); while(num_tokens_to_pop-- > 0) diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index eb7147f49e..ee8fcdc369 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -102,14 +102,12 @@ public: -class LLXUIParser : public LLInitParam::Parser, public LLSingleton +class LLXUIParser : public LLInitParam::Parser { LOG_CLASS(LLXUIParser); -protected: - LLXUIParser(); - friend class LLSingleton; public: + LLXUIParser(); typedef LLInitParam::Parser::name_stack_t name_stack_t; /*virtual*/ std::string getCurrentElementName(); @@ -140,20 +138,20 @@ private: static bool readSDValue(Parser& parser, void* val_ptr); //writer helper functions - bool writeBoolValue(const void* val_ptr, const name_stack_t&); - bool writeStringValue(const void* val_ptr, const name_stack_t&); - bool writeU8Value(const void* val_ptr, const name_stack_t&); - bool writeS8Value(const void* val_ptr, const name_stack_t&); - bool writeU16Value(const void* val_ptr, const name_stack_t&); - bool writeS16Value(const void* val_ptr, const name_stack_t&); - bool writeU32Value(const void* val_ptr, const name_stack_t&); - bool writeS32Value(const void* val_ptr, const name_stack_t&); - bool writeF32Value(const void* val_ptr, const name_stack_t&); - bool writeF64Value(const void* val_ptr, const name_stack_t&); - bool writeColor4Value(const void* val_ptr, const name_stack_t&); - bool writeUIColorValue(const void* val_ptr, const name_stack_t&); - bool writeUUIDValue(const void* val_ptr, const name_stack_t&); - bool writeSDValue(const void* val_ptr, const name_stack_t&); + static bool writeBoolValue(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeStringValue(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeU8Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeS8Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeU16Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeS16Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeU32Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeS32Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeF32Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeF64Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeColor4Value(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeUIColorValue(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeUUIDValue(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeSDValue(Parser& parser, const void* val_ptr, const name_stack_t&); LLXMLNodePtr getNode(const name_stack_t& stack); @@ -182,23 +180,22 @@ private: // of coroutines to perform matching of xml nodes during parsing. Not sure if the overhead // of coroutines would offset the gain from SAX parsing -class LLSimpleXUIParser : public LLInitParam::Parser, public LLSingleton +class LLSimpleXUIParser : public LLInitParam::Parser { LOG_CLASS(LLSimpleXUIParser); - -protected: - LLSimpleXUIParser(); - virtual ~LLSimpleXUIParser(); - friend class LLSingleton; public: typedef LLInitParam::Parser::name_stack_t name_stack_t; + typedef LLInitParam::BaseBlock* (*element_start_callback_t)(LLSimpleXUIParser&, const char* block_name); + + LLSimpleXUIParser(element_start_callback_t element_cb = NULL); + virtual ~LLSimpleXUIParser(); /*virtual*/ std::string getCurrentElementName(); /*virtual*/ void parserWarning(const std::string& message); /*virtual*/ void parserError(const std::string& message); bool readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent=false); - void setBlock(LLInitParam::BaseBlock* block); + private: //reader helper functions @@ -227,7 +224,6 @@ private: void characterData(const char *s, int len); bool readAttributes(const char **atts); - LLInitParam::BaseBlock* mBlock; Parser::name_stack_t mNameStack; struct XML_ParserStruct* mParser; S32 mLastWriteGeneration; @@ -238,6 +234,9 @@ private: const char* mCurAttributeValueBegin; std::vector mTokenSizeStack; std::vector mScope; + element_start_callback_t mElementCB; + + std::vector > mOutputStack; }; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index b8776d0af2..ef596c4457 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -677,7 +677,8 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams() LLXMLNodePtr button_xml_node; if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node)) { - LLXUIParser::instance().readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); + LLXUIParser parser; + parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); } params_initialized = true; } diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp index e0ced5caeb..4d7cdc01e5 100644 --- a/indra/newview/llhints.cpp +++ b/indra/newview/llhints.cpp @@ -297,7 +297,8 @@ void LLHints::show(LLNotificationPtr hint) { LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams()); - LLParamSDParser::instance().readSD(hint->getPayload(), p); + LLParamSDParser parser; + parser.readSD(hint->getPayload(), p); p.notification = hint; if (p.validateBlock()) diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index d09f729943..b4c4d4a2ee 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -259,7 +259,8 @@ void LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition po LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata) { LLNameListCtrl::NameItem item_params; - LLParamSDParser::instance().readSD(element, item_params); + LLParamSDParser parser; + parser.readSD(element, item_params); item_params.userdata = userdata; return addNameItemRow(item_params, pos); } diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index d35739d436..7429386871 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -79,7 +79,8 @@ const LLAccordionCtrlTab::Params& get_accordion_tab_params() LLXMLNodePtr xmlNode; if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode)) { - LLXUIParser::instance().readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml"); + LLXUIParser parser; + parser.readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml"); } else { diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 02097ea06d..181c5b4c81 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1550,7 +1550,8 @@ bool LLUIImageList::initFromFile() } UIImageDeclarations images; - LLXUIParser::instance().readXUI(root, images, base_file_path); + LLXUIParser parser; + parser.readXUI(root, images, base_file_path); if (!images.validateBlock()) return false; diff --git a/indra/newview/skins/default/xui/en/floater_aaa.xml b/indra/newview/skins/default/xui/en/floater_aaa.xml index cae6146880..930bbaa8cb 100644 --- a/indra/newview/skins/default/xui/en/floater_aaa.xml +++ b/indra/newview/skins/default/xui/en/floater_aaa.xml @@ -20,7 +20,7 @@ Nudge 1 This string CHANGE2 is extracted. Just a test. changes. - -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. -Really long line that is long enough to wrap once with jyg descenders. - + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + Really long line that is long enough to wrap once with jyg descenders. + -- cgit v1.2.3 From d1294e5aeb78205cbc580b8159f0a15b2102bd26 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 23 Aug 2010 14:31:39 -0700 Subject: fix for gcc --- indra/llui/llmenugl.cpp | 2 +- indra/llui/lluictrlfactory.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 46a7215707..b4d1a5726f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -9,7 +9,7 @@ * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement + * ("GPL"), unless you have obtained a separate licensing agreement * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 82076335d7..207f74c89a 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -229,7 +229,9 @@ fail: static bool getLocalizedXMLNode(const std::string &xui_filename, LLXMLNodePtr& root); private: + //NOTE: both friend declarations are necessary to keep both gcc and msvc happy template friend class LLChildRegistry; + template template friend class LLChildRegistry::Register; static void copyName(LLXMLNodePtr src, LLXMLNodePtr dest); -- cgit v1.2.3 From 0daa627db4f1bba2f69ec717426b26593674d14c Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 24 Aug 2010 11:44:28 -0700 Subject: removed LLLayoutStack::fromXML custom xml parsing --- indra/llui/lllayoutstack.cpp | 435 +++++++-------------- indra/llui/lllayoutstack.h | 74 +++- indra/llui/llsdparam.cpp | 27 +- indra/llui/llsdparam.h | 9 +- indra/llui/llview.cpp | 6 - indra/llui/llview.h | 8 +- indra/llxuixml/llinitparam.cpp | 44 +-- indra/llxuixml/llinitparam.h | 6 +- indra/llxuixml/llxuiparser.cpp | 17 +- indra/llxuixml/llxuiparser.h | 3 +- indra/newview/llbottomtray.cpp | 10 +- indra/newview/llchathistory.cpp | 16 +- indra/newview/llchathistory.h | 2 +- indra/newview/llfavoritesbar.cpp | 7 +- indra/newview/llfloaternotificationsconsole.cpp | 21 +- indra/newview/llnearbychatbar.cpp | 3 +- .../default/xui/da/floater_voice_controls.xml | 12 +- indra/newview/skins/default/xui/da/panel_notes.xml | 8 +- .../default/xui/da/panel_prim_media_controls.xml | 4 +- .../default/xui/de/floater_voice_controls.xml | 12 +- .../default/xui/de/panel_notifications_channel.xml | 24 +- .../default/xui/de/panel_prim_media_controls.xml | 4 +- .../default/xui/en/floater_voice_controls.xml | 4 +- indra/newview/skins/default/xui/en/main_view.xml | 40 +- .../skins/default/xui/en/panel_bottomtray.xml | 55 +-- .../skins/default/xui/en/panel_bottomtray_lite.xml | 35 +- .../default/xui/en/panel_notifications_channel.xml | 10 +- .../default/xui/en/panel_preferences_graphics1.xml | 2 +- .../default/xui/en/panel_prim_media_controls.xml | 4 +- .../skins/default/xui/en/widgets/scroll_bar.xml | 8 +- .../default/xui/en/widgets/simple_text_editor.xml | 3 - .../default/xui/es/floater_voice_controls.xml | 12 +- indra/newview/skins/default/xui/es/panel_notes.xml | 8 +- .../default/xui/es/panel_prim_media_controls.xml | 4 +- .../default/xui/fr/floater_voice_controls.xml | 12 +- .../default/xui/fr/panel_notifications_channel.xml | 24 +- .../default/xui/fr/panel_prim_media_controls.xml | 4 +- .../default/xui/it/floater_voice_controls.xml | 12 +- indra/newview/skins/default/xui/it/panel_notes.xml | 8 +- .../default/xui/it/panel_prim_media_controls.xml | 4 +- .../default/xui/ja/floater_voice_controls.xml | 12 +- .../default/xui/ja/panel_notifications_channel.xml | 24 +- .../default/xui/ja/panel_prim_media_controls.xml | 4 +- .../default/xui/pl/floater_voice_controls.xml | 12 +- indra/newview/skins/default/xui/pl/panel_notes.xml | 8 +- .../default/xui/pl/panel_prim_media_controls.xml | 4 +- .../default/xui/pt/floater_voice_controls.xml | 12 +- indra/newview/skins/default/xui/pt/panel_notes.xml | 8 +- .../default/xui/pt/panel_prim_media_controls.xml | 4 +- 49 files changed, 486 insertions(+), 603 deletions(-) (limited to 'indra') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 2e6e4912bf..92c8416cbc 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -41,92 +41,56 @@ #include "llresizebar.h" #include "llcriticaldamp.h" -static LLDefaultChildRegistry::Register register_layout_stack("layout_stack", &LLLayoutStack::fromXML); - +static LLDefaultChildRegistry::Register register_layout_stack("layout_stack"); +static LLLayoutStack::LayoutStackRegistry::Register register_layout_panel("layout_panel"); // -// LLLayoutStack +// LLLayoutPanel // -struct LLLayoutStack::LayoutPanel +LLLayoutPanel::LLLayoutPanel(const Params& p) +: LLPanel(p), + mMinDim(p.min_dim), + mMaxDim(p.max_dim), + mAutoResize(p.auto_resize), + mUserResize(p.user_resize), + mCollapsed(FALSE), + mCollapseAmt(0.f), + mVisibleAmt(1.f), // default to fully visible + mResizeBar(NULL) { - LayoutPanel(LLPanel* panelp, ELayoutOrientation orientation, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize) : mPanel(panelp), - mMinWidth(min_width), - mMinHeight(min_height), - mMaxWidth(max_width), - mMaxHeight(max_height), - mAutoResize(auto_resize), - mUserResize(user_resize), - mOrientation(orientation), - mCollapsed(FALSE), - mCollapseAmt(0.f), - mVisibleAmt(1.f), // default to fully visible - mResizeBar(NULL) + // panels initialized as hidden should not start out partially visible + if (!getVisible()) { - LLResizeBar::Side side = (orientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM; - LLRect resize_bar_rect = panelp->getRect(); - - S32 min_dim; - if (orientation == HORIZONTAL) - { - min_dim = mMinHeight; - } - else - { - min_dim = mMinWidth; - } - LLResizeBar::Params p; - p.name("resize"); - p.resizing_view(mPanel); - p.min_size(min_dim); - p.side(side); - p.snapping_enabled(false); - mResizeBar = LLUICtrlFactory::create(p); - // panels initialized as hidden should not start out partially visible - if (!mPanel->getVisible()) - { - mVisibleAmt = 0.f; - } + mVisibleAmt = 0.f; } +} - ~LayoutPanel() - { - // probably not necessary, but... - delete mResizeBar; - mResizeBar = NULL; - } +LLLayoutPanel::~LLLayoutPanel() +{ + // probably not necessary, but... + delete mResizeBar; + mResizeBar = NULL; +} - F32 getCollapseFactor() +F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation) +{ + if (orientation == LLLayoutStack::HORIZONTAL) { - if (mOrientation == HORIZONTAL) - { - F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinWidth / (F32)llmax(1, mPanel->getRect().getWidth())); - return mVisibleAmt * collapse_amt; - } - else + F32 collapse_amt = + clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth())); + return mVisibleAmt * collapse_amt; + } + else { - F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinHeight / (F32)llmax(1, mPanel->getRect().getHeight()))); - return mVisibleAmt * collapse_amt; - } + F32 collapse_amt = + clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight()))); + return mVisibleAmt * collapse_amt; } +} - LLPanel* mPanel; - S32 mMinWidth; - S32 mMinHeight; - - // mMaxWidth & mMaxHeight are added to make configurable max width of the nearby chat bar. EXT-5589 - // they are not processed by LLLayoutStack but they can be if necessary - S32 mMaxWidth; - S32 mMaxHeight; - BOOL mAutoResize; - BOOL mUserResize; - BOOL mCollapsed; - LLResizeBar* mResizeBar; - ELayoutOrientation mOrientation; - F32 mVisibleAmt; - F32 mCollapseAmt; -}; +// +// LLLayoutStack +// LLLayoutStack::Params::Params() : orientation("orientation", std::string("vertical")), @@ -163,18 +127,18 @@ void LLLayoutStack::draw() for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { // clip to layout rectangle, not bounding rectangle - LLRect clip_rect = (*panel_it)->mPanel->getRect(); + LLRect clip_rect = (*panel_it)->getRect(); // scale clipping rectangle by visible amount if (mOrientation == HORIZONTAL) { - clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor()); + clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor(mOrientation)); } else { - clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor()); + clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor(mOrientation)); } - LLPanel* panelp = (*panel_it)->mPanel; + LLPanel* panelp = (*panel_it); LLLocalClipRect clip(clip_rect, mClip); // only force drawing invisible children if visible amount is non-zero @@ -185,7 +149,7 @@ void LLLayoutStack::draw() void LLLayoutStack::removeChild(LLView* view) { - LayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast(view)); + LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast(view)); if (embedded_panelp) { @@ -206,149 +170,16 @@ BOOL LLLayoutStack::postBuild() return TRUE; } -static void get_attribute_s32_and_write(LLXMLNodePtr node, - const char* name, - S32 *value, - S32 default_value, - LLXMLNodePtr output_child) -{ - BOOL has_attr = node->getAttributeS32(name, *value); - if (has_attr && *value != default_value && output_child) - { - // create an attribute child node - LLXMLNodePtr child_attr = output_child->createChild(name, TRUE); - child_attr->setIntValue(*value); - } -} - -static void get_attribute_bool_and_write(LLXMLNodePtr node, - const char* name, - BOOL *value, - BOOL default_value, - LLXMLNodePtr output_child) +bool LLLayoutStack::addChild(LLView* child, S32 tab_group) { - BOOL has_attr = node->getAttributeBOOL(name, *value); - if (has_attr && *value != default_value && output_child) + LLLayoutPanel* panelp = dynamic_cast(child); + if (panelp) { - LLXMLNodePtr child_attr = output_child->createChild(name, TRUE); - child_attr->setBoolValue(*value); + mPanels.push_back(panelp); } + return LLView::addChild(child, tab_group); } -//static -LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) -{ - LLLayoutStack::Params p(LLUICtrlFactory::getDefaultParams()); - LLXUIParser parser; - parser.readXUI(node, p, LLUICtrlFactory::getInstance()->getCurFileName()); - - // Export must happen before setupParams() mungles rectangles and before - // this item gets added to parent (otherwise screws up last_child_rect - // logic). JC - if (output_node) - { - Params output_params(p); - setupParamsForExport(output_params, parent); - LLLayoutStack::Params default_params(LLUICtrlFactory::getDefaultParams()); - output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, &default_params); - } - - p.from_xui = true; - applyXUILayout(p, parent); - LLLayoutStack* layout_stackp = LLUICtrlFactory::create(p); - - if (parent && layout_stackp) - { - S32 tab_group = p.tab_group.isProvided() ? p.tab_group() : parent->getLastTabGroup(); - - parent->addChild(layout_stackp, tab_group); - } - - for (LLXMLNodePtr child_node = node->getFirstChild(); child_node.notNull(); child_node = child_node->getNextSibling()) - { - const S32 DEFAULT_MIN_WIDTH = 0; - const S32 DEFAULT_MIN_HEIGHT = 0; - const S32 DEFAULT_MAX_WIDTH = S32_MAX; - const S32 DEFAULT_MAX_HEIGHT = S32_MAX; - const BOOL DEFAULT_AUTO_RESIZE = TRUE; - - S32 min_width = DEFAULT_MIN_WIDTH; - S32 min_height = DEFAULT_MIN_HEIGHT; - S32 max_width = DEFAULT_MAX_WIDTH; - S32 max_height = DEFAULT_MAX_HEIGHT; - BOOL auto_resize = DEFAULT_AUTO_RESIZE; - - LLXMLNodePtr output_child; - if (output_node) - { - output_child = output_node->createChild("", FALSE); - } - - // Layout stack allows child nodes to acquire additional attributes, - // such as "min_width" in: + + + + + + + + +