From 31e7c77a411d94bc87f0232588b339149bb29a49 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sun, 28 Sep 2008 17:21:23 -0500 Subject: Second Life viewer sources 1.21.3-RC --- linden/indra/llui/llcombobox.cpp | 4 ++-- linden/indra/llui/llcombobox.h | 2 +- linden/indra/llui/llfloater.cpp | 5 ++--- linden/indra/llui/llfloater.h | 4 ++-- linden/indra/llui/llpanel.cpp | 18 +++++++++++++----- linden/indra/llui/llpanel.h | 6 +++--- linden/indra/llui/llscrolllistctrl.cpp | 25 +++++++++++++++---------- linden/indra/llui/llscrolllistctrl.h | 2 ++ 8 files changed, 40 insertions(+), 26 deletions(-) (limited to 'linden/indra/llui') diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp index 48050db..9a2e13b 100644 --- a/linden/indra/llui/llcombobox.cpp +++ b/linden/indra/llui/llcombobox.cpp @@ -296,9 +296,9 @@ LLScrollListItem* LLComboBox::addSeparator(EAddPosition pos) return mList->addSeparator(pos); } -void LLComboBox::sortByName() +void LLComboBox::sortByName(BOOL ascending) { - mList->sortByColumnIndex(0, TRUE); + mList->sortOnce(0, ascending); } diff --git a/linden/indra/llui/llcombobox.h b/linden/indra/llui/llcombobox.h index a9dc1c1..f4cf0fb 100644 --- a/linden/indra/llui/llcombobox.h +++ b/linden/indra/llui/llcombobox.h @@ -115,7 +115,7 @@ public: BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed void removeall() { clearRows(); } - void sortByName(); // Sort the entries in the combobox by name + void sortByName(BOOL ascending = TRUE); // Sort the entries in the combobox by name // Select current item by name using selectItemByLabel. Returns FALSE if not found. BOOL setSimple(const LLStringExplicit& name); diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index e795ad2..9f8cd65 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp @@ -724,9 +724,8 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) if (other_view != getParent()) { - LLFloater* other_floaterp = (LLFloater*)other_view; - - if (other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) + const LLFloater* other_floaterp = dynamic_cast(other_view); + if (other_floaterp && other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) { // this is a dependent that is already snapped to us, so don't snap back to it return FALSE; diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h index 636125e..0be5d44 100644 --- a/linden/indra/llui/llfloater.h +++ b/linden/indra/llui/llfloater.h @@ -202,9 +202,9 @@ public: void setSnapTarget(LLHandle handle) { mSnappedTo = handle; } void clearSnapTarget() { mSnappedTo.markDead(); } - LLHandle getSnapTarget() { return mSnappedTo; } + LLHandle getSnapTarget() const { return mSnappedTo; } - LLHandle getHandle() { return mHandle; } + LLHandle getHandle() const { return mHandle; } static void closeFocusedFloater(); diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp index f1ccb01..0389590 100644 --- a/linden/indra/llui/llpanel.cpp +++ b/linden/indra/llui/llpanel.cpp @@ -540,7 +540,7 @@ void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory) child->getAttributeString("name", string_name); if (!string_name.empty()) { - mUIStrings[string_name] = LLUIString(child->getTextContents()); + mUIStrings[string_name] = child->getTextContents(); } } else @@ -612,7 +612,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form if (found_it != mUIStrings.end()) { // make a copy as format works in place - LLUIString formatted_string = found_it->second; + LLUIString formatted_string = LLUIString(found_it->second); formatted_string.setArgList(args); return formatted_string.getString(); } @@ -630,15 +630,23 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form return LLStringUtil::null; } -LLUIString LLPanel::getUIString(const std::string& name) const +std::string LLPanel::getString(const std::string& name) const { ui_string_map_t::const_iterator found_it = mUIStrings.find(name); if (found_it != mUIStrings.end()) { return found_it->second; } - llerrs << "Failed to find string " << name << " in panel " << getName() << llendl; - return LLUIString(LLStringUtil::null); + std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate + if(LLUI::sQAMode) + { + llerrs << err_str << llendl; + } + else + { + llwarns << err_str << llendl; + } + return LLStringUtil::null; } diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h index 46cde5b..8ed739e 100644 --- a/linden/indra/llui/llpanel.h +++ b/linden/indra/llui/llpanel.h @@ -151,8 +151,8 @@ public: void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); void setPanelParameters(LLXMLNodePtr node, LLView *parentp); - std::string getString(const std::string& name, const LLStringUtil::format_map_t& args = LLUIString::sNullArgs) const; - LLUIString getUIString(const std::string& name) const; + std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; + std::string getString(const std::string& name) const; // ** Wrappers for setting child properties by name ** -TomY @@ -261,7 +261,7 @@ private: S32 mLastTabGroup; LLRootHandle mPanelHandle; - typedef std::map ui_string_map_t; + typedef std::map ui_string_map_t; ui_string_map_t mUIStrings; std::string mRequirementsError; diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 6561bb5..e2623fb 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp @@ -67,9 +67,6 @@ struct SortScrollListItem bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) { - if ( mSortOrders.empty() ) - return i1 < i2; - // sort over all columns in order specified by mSortOrders S32 sort_result = 0; for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); @@ -91,7 +88,8 @@ struct SortScrollListItem } } - return sort_result < 0; + // make sure to keep order when sort_result == 0 + return sort_result <= 0; } typedef std::vector > sort_order_t; @@ -2539,12 +2537,6 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) { - if (name.empty()) - { - sortItems(); - return; - } - std::map::iterator itor = mColumns.find(name); if (itor != mColumns.end()) { @@ -2572,6 +2564,19 @@ void LLScrollListCtrl::sortItems() setSorted(TRUE); } +// for one-shot sorts, does not save sort column/order +void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) +{ + std::vector > sort_column; + sort_column.push_back(std::make_pair(column, ascending)); + + // do stable sort to preserve any previous sorts + std::stable_sort( + mItemList.begin(), + mItemList.end(), + SortScrollListItem(sort_column)); +} + void LLScrollListCtrl::dirtyColumns() { mColumnsDirty = TRUE; diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h index 6f26c8d..12b8e2c 100644 --- a/linden/indra/llui/llscrolllistctrl.h +++ b/linden/indra/llui/llscrolllistctrl.h @@ -622,6 +622,8 @@ public: S32 selectMultiple( LLDynamicArray ids ); void sortItems(); + // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) + void sortOnce(S32 column, BOOL ascending); // manually call this whenever editing list items in place to flag need for resorting void setSorted(BOOL sorted) { mSorted = sorted; } -- cgit v1.1 From 4270407eca97bc2275f920a6452d6d5490875779 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 17 Oct 2008 15:56:48 -0500 Subject: Second Life viewer sources 1.21.6 --- linden/indra/llui/llscrolllistctrl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linden/indra/llui') diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index e2623fb..d342378 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp @@ -88,8 +88,7 @@ struct SortScrollListItem } } - // make sure to keep order when sort_result == 0 - return sort_result <= 0; + return sort_result < 0; } typedef std::vector > sort_order_t; -- cgit v1.1